diff --git a/codbex-payments/codbex-payments.gen b/codbex-payments/codbex-payments.gen
index 3e0b24e..456ef54 100644
--- a/codbex-payments/codbex-payments.gen
+++ b/codbex-payments/codbex-payments.gen
@@ -1,49 +1,16 @@
{
"tablePrefix": "CODBEX_",
"brand": "codbex",
- "brandUrl": "https://www.codbex.com/",
- "title": "Payments Management Module",
- "description": "Managing Payments Data",
- "fileName": "codbex-payments",
- "genFolderName": "codbex-payments",
- "dataSource": "DefaultDB",
- "roles": [
- {
- "entityName": "CustomerPayment",
- "roleRead": "codbex-payments.CustomerPayment.CustomerPaymentReadOnly",
- "roleWrite": "codbex-payments.CustomerPayment.CustomerPaymentFullAccess"
- },
- {
- "entityName": "SupplierPayment",
- "roleRead": "codbex-payments.SupplierPayment.SupplierPaymentReadOnly",
- "roleWrite": "codbex-payments.SupplierPayment.SupplierPaymentFullAccess"
- },
- {
- "entityName": "EmployeePayment",
- "roleRead": "codbex-payments.EmployeePayment.EmployeePaymentReadOnly",
- "roleWrite": "codbex-payments.EmployeePayment.EmployeePaymentFullAccess"
- },
- {
- "entityName": "PaymentRecord",
- "roleRead": "codbex-payments.PaymentRecord.PaymentRecordReadOnly",
- "roleWrite": "codbex-payments.PaymentRecord.PaymentRecordFullAccess"
- },
- {
- "entityName": "PaymentType",
- "roleRead": "codbex-payments.Settings.PaymentTypeReadOnly",
- "roleWrite": "codbex-payments.Settings.PaymentTypeFullAccess"
- },
- {
- "entityName": "PaymentAdjustment",
- "roleRead": "codbex-payments.PaymentAdjustment.PaymentAdjustmentReadOnly",
- "roleWrite": "codbex-payments.PaymentAdjustment.PaymentAdjustmentFullAccess"
- }
- ],
- "tprefix": "codbex-payments-model",
+ "brandUrl": "https://www.codbex.com",
+ "title": "Payments Management Application",
+ "description": "Managing payments data",
"projectName": "codbex-payments",
"workspaceName": "workspace",
"filePath": "codbex-payments.model",
"templateId": "template-application-angular-v2/template/template.js",
+ "fileName": "codbex-payments",
+ "genFolderName": "codbex-payments",
+ "dataSource": "DefaultDB",
"perspectives": {
"CustomerPayment": {
"views": [
@@ -264,6 +231,39 @@
"role": ""
}
},
+ "roles": [
+ {
+ "entityName": "CustomerPayment",
+ "roleRead": "codbex-payments.CustomerPayment.CustomerPaymentReadOnly",
+ "roleWrite": "codbex-payments.CustomerPayment.CustomerPaymentFullAccess"
+ },
+ {
+ "entityName": "SupplierPayment",
+ "roleRead": "codbex-payments.SupplierPayment.SupplierPaymentReadOnly",
+ "roleWrite": "codbex-payments.SupplierPayment.SupplierPaymentFullAccess"
+ },
+ {
+ "entityName": "EmployeePayment",
+ "roleRead": "codbex-payments.EmployeePayment.EmployeePaymentReadOnly",
+ "roleWrite": "codbex-payments.EmployeePayment.EmployeePaymentFullAccess"
+ },
+ {
+ "entityName": "PaymentRecord",
+ "roleRead": "codbex-payments.PaymentRecord.PaymentRecordReadOnly",
+ "roleWrite": "codbex-payments.PaymentRecord.PaymentRecordFullAccess"
+ },
+ {
+ "entityName": "PaymentType",
+ "roleRead": "codbex-payments.Settings.PaymentTypeReadOnly",
+ "roleWrite": "codbex-payments.Settings.PaymentTypeFullAccess"
+ },
+ {
+ "entityName": "PaymentAdjustment",
+ "roleRead": "codbex-payments.PaymentAdjustment.PaymentAdjustmentReadOnly",
+ "roleWrite": "codbex-payments.PaymentAdjustment.PaymentAdjustmentFullAccess"
+ }
+ ],
+ "tprefix": "codbex-payments-model",
"models": [
{
"properties": [
diff --git a/codbex-payments/gen/codbex-payments/api/CustomerPayment/CustomerPaymentController.ts b/codbex-payments/gen/codbex-payments/api/CustomerPayment/CustomerPaymentController.ts
index 5260a1a..81625c6 100644
--- a/codbex-payments/gen/codbex-payments/api/CustomerPayment/CustomerPaymentController.ts
+++ b/codbex-payments/gen/codbex-payments/api/CustomerPayment/CustomerPaymentController.ts
@@ -29,7 +29,7 @@ class CustomerPaymentController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -98,7 +98,7 @@ class CustomerPaymentController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/EmployeePayment/EmployeePaymentController.ts b/codbex-payments/gen/codbex-payments/api/EmployeePayment/EmployeePaymentController.ts
index 1c68b4c..bad4d91 100644
--- a/codbex-payments/gen/codbex-payments/api/EmployeePayment/EmployeePaymentController.ts
+++ b/codbex-payments/gen/codbex-payments/api/EmployeePayment/EmployeePaymentController.ts
@@ -29,7 +29,7 @@ class EmployeePaymentController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -98,7 +98,7 @@ class EmployeePaymentController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/PaymentAdjustment/PaymentAdjustmentController.ts b/codbex-payments/gen/codbex-payments/api/PaymentAdjustment/PaymentAdjustmentController.ts
index 3a3590b..a3d2370 100644
--- a/codbex-payments/gen/codbex-payments/api/PaymentAdjustment/PaymentAdjustmentController.ts
+++ b/codbex-payments/gen/codbex-payments/api/PaymentAdjustment/PaymentAdjustmentController.ts
@@ -27,7 +27,7 @@ class PaymentAdjustmentController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -96,7 +96,7 @@ class PaymentAdjustmentController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/PaymentRecord/PaymentRecordController.ts b/codbex-payments/gen/codbex-payments/api/PaymentRecord/PaymentRecordController.ts
index fb125f7..84ee8f0 100644
--- a/codbex-payments/gen/codbex-payments/api/PaymentRecord/PaymentRecordController.ts
+++ b/codbex-payments/gen/codbex-payments/api/PaymentRecord/PaymentRecordController.ts
@@ -27,7 +27,7 @@ class PaymentRecordController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -96,7 +96,7 @@ class PaymentRecordController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts b/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts
index b50fbe2..fb6aa29 100644
--- a/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts
+++ b/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts
@@ -24,7 +24,7 @@ class PaymentDirectionController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -88,7 +88,7 @@ class PaymentDirectionController {
try {
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts b/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts
index d537d7d..371dfa6 100644
--- a/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts
+++ b/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts
@@ -27,7 +27,7 @@ class PaymentTypeController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -96,7 +96,7 @@ class PaymentTypeController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/api/SupplierPayment/SupplierPaymentController.ts b/codbex-payments/gen/codbex-payments/api/SupplierPayment/SupplierPaymentController.ts
index f208a68..35e51e3 100644
--- a/codbex-payments/gen/codbex-payments/api/SupplierPayment/SupplierPaymentController.ts
+++ b/codbex-payments/gen/codbex-payments/api/SupplierPayment/SupplierPaymentController.ts
@@ -29,7 +29,7 @@ class SupplierPaymentController {
const options: Options = {
limit: ctx.queryParameters["$limit"] ? parseInt(ctx.queryParameters["$limit"]) : 20,
offset: ctx.queryParameters["$offset"] ? parseInt(ctx.queryParameters["$offset"]) : 0,
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
return this.repository.findAll(options);
@@ -98,7 +98,7 @@ class SupplierPaymentController {
this.checkPermissions('read');
const id = parseInt(ctx.pathParameters.id);
const options: Options = {
- language: request.getLocale().split("_")[0]
+ language: request.getLocale()?.split("_")[0]
};
const entity = this.repository.findById(id, options);
if (entity) {
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/controller.js b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/controller.js
index 0f94907..af1deba 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/controller.js
@@ -102,6 +102,98 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.data = [];
$scope.dataReset = false;
}
+ if (optionsCustomerHasMore) {
+ const optionsCustomerSearchValues = Array.from(new Set(response.data.map(e => e.Customer)));
+ if (optionsCustomerSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCustomerSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCustomer.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCurrencyHasMore) {
+ const optionsCurrencySearchValues = Array.from(new Set(response.data.map(e => e.Currency)));
+ if (optionsCurrencySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCurrencySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCurrency.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCompanyHasMore) {
+ const optionsCompanySearchValues = Array.from(new Set(response.data.map(e => e.Company)));
+ if (optionsCompanySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCompanySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCompany.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsPaymentMethodHasMore) {
+ const optionsPaymentMethodSearchValues = Array.from(new Set(response.data.map(e => e.PaymentMethod)));
+ if (optionsPaymentMethodSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsPaymentMethodSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsPaymentMethod.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
response.data.forEach(e => {
if (e.Date) {
e.Date = new Date(e.Date);
@@ -228,12 +320,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.optionsCompany = [];
$scope.optionsPaymentMethod = [];
+ let optionsCustomerHasMore = true;
- $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts').then((response) => {
- $scope.optionsCustomer = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts/count').then((response) => {
+ const optionsCustomerCount = response.data.count;
+ $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts').then((response) => {
+ $scope.optionsCustomer = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCustomerHasMore = optionsCustomerCount > $scope.optionsCustomer.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -243,12 +348,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCurrencyHasMore = true;
- $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
- $scope.optionsCurrency = response.data.map(e => ({
- value: e.Id,
- text: e.Code
- }));
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/count').then((response) => {
+ const optionsCurrencyCount = response.data.count;
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
+ $scope.optionsCurrency = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ optionsCurrencyHasMore = optionsCurrencyCount > $scope.optionsCurrency.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -258,12 +376,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCompanyHasMore = true;
- $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
- $scope.optionsCompany = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/count').then((response) => {
+ const optionsCompanyCount = response.data.count;
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
+ $scope.optionsCompany = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCompanyHasMore = optionsCompanyCount > $scope.optionsCompany.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -273,12 +404,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsPaymentMethodHasMore = true;
- $http.get('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts').then((response) => {
- $scope.optionsPaymentMethod = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts/count').then((response) => {
+ const optionsPaymentMethodCount = response.data.count;
+ $http.get('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts').then((response) => {
+ $scope.optionsPaymentMethod = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsPaymentMethodHasMore = optionsPaymentMethodCount > $scope.optionsPaymentMethod.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/controller.js
index 11aeb67..2aaa5fb 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/controller.js
@@ -1,4 +1,4 @@
-angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, ViewParameters) => {
+angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, $http, ViewParameters) => {
const Dialogs = new DialogHub();
$scope.entity = {};
$scope.forms = {
@@ -34,10 +34,18 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.entity = params.entity ?? {};
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCustomer = params.optionsCustomer;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
- $scope.optionsPaymentMethod = params.optionsPaymentMethod;
+ const optionsCustomerMap = new Map();
+ params.optionsCustomer.forEach(e => optionsCustomerMap.set(e.value, e));
+ $scope.optionsCustomer = Array.from(optionsCustomerMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
+ const optionsPaymentMethodMap = new Map();
+ params.optionsPaymentMethod.forEach(e => optionsPaymentMethodMap.set(e.value, e));
+ $scope.optionsPaymentMethod = Array.from(optionsPaymentMethodMap.values());
}
$scope.filter = () => {
@@ -157,6 +165,14 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.resetFilter = () => {
$scope.entity = {};
$scope.filter();
+ lastSearchValuesCustomer.clear();
+ allValuesCustomer.length = 0;
+ lastSearchValuesCurrency.clear();
+ allValuesCurrency.length = 0;
+ lastSearchValuesCompany.clear();
+ allValuesCompany.length = 0;
+ lastSearchValuesPaymentMethod.clear();
+ allValuesPaymentMethod.length = 0;
};
$scope.cancel = () => {
@@ -166,4 +182,366 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
+ const lastSearchValuesCustomer = new Set();
+ const allValuesCustomer = [];
+ let loadMoreOptionsCustomerCounter = 0;
+ $scope.optionsCustomerLoading = false;
+ $scope.optionsCustomerHasMore = true;
+
+ $scope.loadMoreOptionsCustomer = () => {
+ const limit = 20;
+ $scope.optionsCustomerLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCustomerCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCustomer.find(o => o.value === e.value)) {
+ $scope.optionsCustomer.push(e);
+ }
+ })
+ $scope.optionsCustomerHasMore = resultValues.length > 0;
+ $scope.optionsCustomerLoading = false;
+ }, (error) => {
+ $scope.optionsCustomerLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCustomerChange = (event) => {
+ if (allValuesCustomer.length === 0) {
+ allValuesCustomer.push(...$scope.optionsCustomer);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCustomer.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCustomer = allValuesCustomer;
+ $scope.optionsCustomerHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCustomerHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCustomer).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ }
+ });
+ $scope.optionsCustomer = allValuesCustomer.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCustomer.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesPaymentMethod = new Set();
+ const allValuesPaymentMethod = [];
+ let loadMoreOptionsPaymentMethodCounter = 0;
+ $scope.optionsPaymentMethodLoading = false;
+ $scope.optionsPaymentMethodHasMore = true;
+
+ $scope.loadMoreOptionsPaymentMethod = () => {
+ const limit = 20;
+ $scope.optionsPaymentMethodLoading = true;
+ $http.get(`/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentMethodCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentMethod.find(o => o.value === e.value)) {
+ $scope.optionsPaymentMethod.push(e);
+ }
+ })
+ $scope.optionsPaymentMethodHasMore = resultValues.length > 0;
+ $scope.optionsPaymentMethodLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentMethodLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentMethodChange = (event) => {
+ if (allValuesPaymentMethod.length === 0) {
+ allValuesPaymentMethod.push(...$scope.optionsPaymentMethod);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentMethod.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentMethod = allValuesPaymentMethod;
+ $scope.optionsPaymentMethodHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentMethodHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentMethod).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ }
+ });
+ $scope.optionsPaymentMethod = allValuesPaymentMethod.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentMethod.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/index.html b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/index.html
index 5c3e9b1..022382d 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-filter/index.html
@@ -27,8 +27,14 @@
state="{{ forms.details['Customer'].$valid ? '' : 'error' }}"
ng-model="entity.Customer"
dropdown-items="optionsCustomer"
+ ng-keyup="onOptionsCustomerChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CUSTOMER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Customer'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Customer'} }}">
+
+
+
+ More Options
+
@@ -162,8 +168,14 @@
state="{{ forms.details['Currency'].$valid ? '' : 'error' }}"
ng-model="entity.Currency"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -211,8 +223,14 @@
state="{{ forms.details['Company'].$valid ? '' : 'error' }}"
ng-model="entity.Company"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
@@ -277,8 +295,14 @@
state="{{ forms.details['PaymentMethod'].$valid ? '' : 'error' }}"
ng-model="entity.PaymentMethod"
dropdown-items="optionsPaymentMethod"
+ ng-keyup="onOptionsPaymentMethodChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_PAYMENTMETHOD)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentMethod'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentMethod'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/controller.js b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/controller.js
index 34bbfe3..f4ea45d 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/controller.js
@@ -46,10 +46,18 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.entity = params.entity;
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCustomer = params.optionsCustomer;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
- $scope.optionsPaymentMethod = params.optionsPaymentMethod;
+ const optionsCustomerMap = new Map();
+ params.optionsCustomer?.forEach(e => optionsCustomerMap.set(e.value, e));
+ $scope.optionsCustomer = Array.from(optionsCustomerMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency?.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany?.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
+ const optionsPaymentMethodMap = new Map();
+ params.optionsPaymentMethod?.forEach(e => optionsPaymentMethodMap.set(e.value, e));
+ $scope.optionsPaymentMethod = Array.from(optionsPaymentMethodMap.values());
}
$scope.create = () => {
@@ -111,6 +119,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCustomer = new Set();
+ const allValuesCustomer = [];
+ let loadMoreOptionsCustomerCounter = 0;
+ $scope.optionsCustomerLoading = false;
+ $scope.optionsCustomerHasMore = true;
+
+ $scope.loadMoreOptionsCustomer = () => {
+ const limit = 20;
+ $scope.optionsCustomerLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCustomerCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCustomer.find(o => o.value === e.value)) {
+ $scope.optionsCustomer.push(e);
+ }
+ })
+ $scope.optionsCustomerHasMore = resultValues.length > 0;
+ $scope.optionsCustomerLoading = false;
+ }, (error) => {
+ $scope.optionsCustomerLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCustomerChange = (event) => {
+ if (allValuesCustomer.length === 0) {
+ allValuesCustomer.push(...$scope.optionsCustomer);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCustomer.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCustomer = allValuesCustomer;
+ $scope.optionsCustomerHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCustomerHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCustomer).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ }
+ });
+ $scope.optionsCustomer = allValuesCustomer.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCustomer.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCurrency = '/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts';
$scope.optionsCurrency = [];
@@ -129,6 +226,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCompany = '/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts';
$scope.optionsCompany = [];
@@ -147,6 +333,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.servicePaymentMethod = '/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts';
$scope.optionsPaymentMethod = [];
@@ -166,6 +441,100 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
+ const lastSearchValuesPaymentMethod = new Set();
+ const allValuesPaymentMethod = [];
+ let loadMoreOptionsPaymentMethodCounter = 0;
+ $scope.optionsPaymentMethodLoading = false;
+ $scope.optionsPaymentMethodHasMore = true;
+
+ $scope.loadMoreOptionsPaymentMethod = () => {
+ const limit = 20;
+ $scope.optionsPaymentMethodLoading = true;
+ $http.get(`/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentMethodCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentMethod.find(o => o.value === e.value)) {
+ $scope.optionsPaymentMethod.push(e);
+ }
+ })
+ $scope.optionsPaymentMethodHasMore = resultValues.length > 0;
+ $scope.optionsPaymentMethodLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentMethodLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentMethodChange = (event) => {
+ if (allValuesPaymentMethod.length === 0) {
+ allValuesPaymentMethod.push(...$scope.optionsPaymentMethod);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentMethod.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentMethod = allValuesPaymentMethod;
+ $scope.optionsPaymentMethodHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentMethodHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentMethod).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ }
+ });
+ $scope.optionsPaymentMethod = allValuesPaymentMethod.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentMethod.add(event.originalEvent.target.value);
+ }
+ }
+ };
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
+
$scope.alert = (message) => {
if (message) Dialogs.showAlert({
title: description,
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/index.html b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/index.html
index e6ff2a4..3083c68 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/dialog-window/index.html
@@ -30,8 +30,14 @@
ng-model="entity.Customer"
is-readonly="action === 'select'"
dropdown-items="optionsCustomer"
+ ng-keyup="onOptionsCustomerChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CUSTOMER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Customer'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Customer'} }}">
+
+
+
+ More Options
+
@@ -161,8 +167,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -220,8 +232,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
@@ -286,8 +304,14 @@
ng-model="entity.PaymentMethod"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentMethod"
+ ng-keyup="onOptionsPaymentMethodChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_PAYMENTMETHOD)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentMethod'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentMethod'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/controller.js b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/controller.js
index 3c77c9f..cba7917 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/controller.js
@@ -220,6 +220,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
//----------------Dropdowns-----------------//
+ const lastSearchValuesCustomer = new Set();
+ const allValuesCustomer = [];
+ let loadMoreOptionsCustomerCounter = 0;
+ $scope.optionsCustomerLoading = false;
+ $scope.optionsCustomerHasMore = true;
+
+ $scope.loadMoreOptionsCustomer = () => {
+ const limit = 20;
+ $scope.optionsCustomerLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCustomerCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCustomer.find(o => o.value === e.value)) {
+ $scope.optionsCustomer.push(e);
+ }
+ })
+ $scope.optionsCustomerHasMore = resultValues.length > 0;
+ $scope.optionsCustomerLoading = false;
+ }, (error) => {
+ $scope.optionsCustomerLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCustomerChange = (event) => {
+ if (allValuesCustomer.length === 0) {
+ allValuesCustomer.push(...$scope.optionsCustomer);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCustomer.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCustomer = allValuesCustomer;
+ $scope.optionsCustomerHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCustomerHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCustomer).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCustomer.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCustomer.push(e);
+ }
+ });
+ $scope.optionsCustomer = allValuesCustomer.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Customer',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCustomer.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCustomer = () => {
$scope.optionsCustomer = [];
$http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Customers/CustomerController.ts').then((response) => {
@@ -227,6 +316,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCustomer.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -237,6 +327,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCurrency = () => {
$scope.optionsCurrency = [];
$http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
@@ -244,6 +423,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Code
}));
+ allValuesCurrency.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -254,6 +434,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCompany = () => {
$scope.optionsCompany = [];
$http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
@@ -261,6 +530,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCompany.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -271,6 +541,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesPaymentMethod = new Set();
+ const allValuesPaymentMethod = [];
+ let loadMoreOptionsPaymentMethodCounter = 0;
+ $scope.optionsPaymentMethodLoading = false;
+ $scope.optionsPaymentMethodHasMore = true;
+
+ $scope.loadMoreOptionsPaymentMethod = () => {
+ const limit = 20;
+ $scope.optionsPaymentMethodLoading = true;
+ $http.get(`/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentMethodCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentMethod.find(o => o.value === e.value)) {
+ $scope.optionsPaymentMethod.push(e);
+ }
+ })
+ $scope.optionsPaymentMethodHasMore = resultValues.length > 0;
+ $scope.optionsPaymentMethodLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentMethodLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentMethodChange = (event) => {
+ if (allValuesPaymentMethod.length === 0) {
+ allValuesPaymentMethod.push(...$scope.optionsPaymentMethod);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentMethod.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentMethod = allValuesPaymentMethod;
+ $scope.optionsPaymentMethodHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentMethodHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentMethod).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentMethod.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentMethod.push(e);
+ }
+ });
+ $scope.optionsPaymentMethod = allValuesPaymentMethod.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentMethod',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentMethod.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshPaymentMethod = () => {
$scope.optionsPaymentMethod = [];
$http.get('/services/ts/codbex-methods/gen/codbex-methods/api/Settings/PaymentMethodController.ts').then((response) => {
@@ -278,6 +637,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesPaymentMethod.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -289,5 +649,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
};
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
//----------------Dropdowns-----------------//
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/index.html b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/index.html
index 7a48691..cd60618 100644
--- a/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/CustomerPayment/CustomerPayment/main-details/index.html
@@ -28,8 +28,14 @@
ng-model="entity.Customer"
is-readonly="action === 'select'"
dropdown-items="optionsCustomer"
+ ng-keyup="onOptionsCustomerChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CUSTOMER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Customer'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Customer'} }}">
+
+
+
+ More Options
+
@@ -163,8 +169,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -226,8 +238,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
@@ -296,8 +314,14 @@
ng-model="entity.PaymentMethod"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentMethod"
+ ng-keyup="onOptionsPaymentMethodChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.CUSTOMERPAYMENT_PAYMENTMETHOD)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentMethod'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentMethod'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/controller.js b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/controller.js
index da981ea..f9a04a5 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/controller.js
@@ -102,6 +102,75 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.data = [];
$scope.dataReset = false;
}
+ if (optionsEmployeeHasMore) {
+ const optionsEmployeeSearchValues = Array.from(new Set(response.data.map(e => e.Employee)));
+ if (optionsEmployeeSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsEmployeeSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsEmployee.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCurrencyHasMore) {
+ const optionsCurrencySearchValues = Array.from(new Set(response.data.map(e => e.Currency)));
+ if (optionsCurrencySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCurrencySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCurrency.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCompanyHasMore) {
+ const optionsCompanySearchValues = Array.from(new Set(response.data.map(e => e.Company)));
+ if (optionsCompanySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCompanySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCompany.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
response.data.forEach(e => {
if (e.Date) {
e.Date = new Date(e.Date);
@@ -223,12 +292,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.optionsCurrency = [];
$scope.optionsCompany = [];
+ let optionsEmployeeHasMore = true;
- $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts').then((response) => {
- $scope.optionsEmployee = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/count').then((response) => {
+ const optionsEmployeeCount = response.data.count;
+ $http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts').then((response) => {
+ $scope.optionsEmployee = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsEmployeeHasMore = optionsEmployeeCount > $scope.optionsEmployee.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -238,12 +320,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCurrencyHasMore = true;
- $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
- $scope.optionsCurrency = response.data.map(e => ({
- value: e.Id,
- text: e.Code
- }));
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/count').then((response) => {
+ const optionsCurrencyCount = response.data.count;
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
+ $scope.optionsCurrency = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ optionsCurrencyHasMore = optionsCurrencyCount > $scope.optionsCurrency.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -253,12 +348,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCompanyHasMore = true;
- $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
- $scope.optionsCompany = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/count').then((response) => {
+ const optionsCompanyCount = response.data.count;
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
+ $scope.optionsCompany = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCompanyHasMore = optionsCompanyCount > $scope.optionsCompany.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/controller.js
index b7c7d56..824df39 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/controller.js
@@ -1,4 +1,4 @@
-angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, ViewParameters) => {
+angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, $http, ViewParameters) => {
const Dialogs = new DialogHub();
$scope.entity = {};
$scope.forms = {
@@ -34,9 +34,15 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.entity = params.entity ?? {};
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsEmployee = params.optionsEmployee;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsEmployeeMap = new Map();
+ params.optionsEmployee.forEach(e => optionsEmployeeMap.set(e.value, e));
+ $scope.optionsEmployee = Array.from(optionsEmployeeMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.filter = () => {
@@ -156,6 +162,12 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.resetFilter = () => {
$scope.entity = {};
$scope.filter();
+ lastSearchValuesEmployee.clear();
+ allValuesEmployee.length = 0;
+ lastSearchValuesCurrency.clear();
+ allValuesCurrency.length = 0;
+ lastSearchValuesCompany.clear();
+ allValuesCompany.length = 0;
};
$scope.cancel = () => {
@@ -165,4 +177,277 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
+ const lastSearchValuesEmployee = new Set();
+ const allValuesEmployee = [];
+ let loadMoreOptionsEmployeeCounter = 0;
+ $scope.optionsEmployeeLoading = false;
+ $scope.optionsEmployeeHasMore = true;
+
+ $scope.loadMoreOptionsEmployee = () => {
+ const limit = 20;
+ $scope.optionsEmployeeLoading = true;
+ $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsEmployeeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsEmployee.find(o => o.value === e.value)) {
+ $scope.optionsEmployee.push(e);
+ }
+ })
+ $scope.optionsEmployeeHasMore = resultValues.length > 0;
+ $scope.optionsEmployeeLoading = false;
+ }, (error) => {
+ $scope.optionsEmployeeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsEmployeeChange = (event) => {
+ if (allValuesEmployee.length === 0) {
+ allValuesEmployee.push(...$scope.optionsEmployee);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesEmployee.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsEmployee = allValuesEmployee;
+ $scope.optionsEmployeeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsEmployeeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesEmployee).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ }
+ });
+ $scope.optionsEmployee = allValuesEmployee.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesEmployee.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/index.html b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/index.html
index 22cb9d0..bb5c1a5 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-filter/index.html
@@ -27,8 +27,14 @@
state="{{ forms.details['Employee'].$valid ? '' : 'error' }}"
ng-model="entity.Employee"
dropdown-items="optionsEmployee"
+ ng-keyup="onOptionsEmployeeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_EMPLOYEE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Employee'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Employee'} }}">
+
+
+
+ More Options
+
@@ -162,8 +168,14 @@
state="{{ forms.details['Currency'].$valid ? '' : 'error' }}"
ng-model="entity.Currency"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -211,8 +223,14 @@
state="{{ forms.details['Company'].$valid ? '' : 'error' }}"
ng-model="entity.Company"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/controller.js b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/controller.js
index a139f35..6200288 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/controller.js
@@ -46,9 +46,15 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.entity = params.entity;
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsEmployee = params.optionsEmployee;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsEmployeeMap = new Map();
+ params.optionsEmployee?.forEach(e => optionsEmployeeMap.set(e.value, e));
+ $scope.optionsEmployee = Array.from(optionsEmployeeMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency?.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany?.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.create = () => {
@@ -110,6 +116,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesEmployee = new Set();
+ const allValuesEmployee = [];
+ let loadMoreOptionsEmployeeCounter = 0;
+ $scope.optionsEmployeeLoading = false;
+ $scope.optionsEmployeeHasMore = true;
+
+ $scope.loadMoreOptionsEmployee = () => {
+ const limit = 20;
+ $scope.optionsEmployeeLoading = true;
+ $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsEmployeeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsEmployee.find(o => o.value === e.value)) {
+ $scope.optionsEmployee.push(e);
+ }
+ })
+ $scope.optionsEmployeeHasMore = resultValues.length > 0;
+ $scope.optionsEmployeeLoading = false;
+ }, (error) => {
+ $scope.optionsEmployeeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsEmployeeChange = (event) => {
+ if (allValuesEmployee.length === 0) {
+ allValuesEmployee.push(...$scope.optionsEmployee);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesEmployee.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsEmployee = allValuesEmployee;
+ $scope.optionsEmployeeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsEmployeeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesEmployee).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ }
+ });
+ $scope.optionsEmployee = allValuesEmployee.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesEmployee.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCurrency = '/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts';
$scope.optionsCurrency = [];
@@ -128,6 +223,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCompany = '/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts';
$scope.optionsCompany = [];
@@ -147,6 +331,100 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
+
$scope.alert = (message) => {
if (message) Dialogs.showAlert({
title: description,
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/index.html b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/index.html
index 285fdf9..9f853ba 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/dialog-window/index.html
@@ -30,8 +30,14 @@
ng-model="entity.Employee"
is-readonly="action === 'select'"
dropdown-items="optionsEmployee"
+ ng-keyup="onOptionsEmployeeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_EMPLOYEE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Employee'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Employee'} }}">
+
+
+
+ More Options
+
@@ -161,8 +167,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -220,8 +232,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/controller.js b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/controller.js
index af8f0fe..989fbb1 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/controller.js
@@ -205,6 +205,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
//----------------Dropdowns-----------------//
+ const lastSearchValuesEmployee = new Set();
+ const allValuesEmployee = [];
+ let loadMoreOptionsEmployeeCounter = 0;
+ $scope.optionsEmployeeLoading = false;
+ $scope.optionsEmployeeHasMore = true;
+
+ $scope.loadMoreOptionsEmployee = () => {
+ const limit = 20;
+ $scope.optionsEmployeeLoading = true;
+ $http.get(`/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsEmployeeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsEmployee.find(o => o.value === e.value)) {
+ $scope.optionsEmployee.push(e);
+ }
+ })
+ $scope.optionsEmployeeHasMore = resultValues.length > 0;
+ $scope.optionsEmployeeLoading = false;
+ }, (error) => {
+ $scope.optionsEmployeeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsEmployeeChange = (event) => {
+ if (allValuesEmployee.length === 0) {
+ allValuesEmployee.push(...$scope.optionsEmployee);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesEmployee.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsEmployee = allValuesEmployee;
+ $scope.optionsEmployeeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsEmployeeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesEmployee).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesEmployee.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesEmployee.push(e);
+ }
+ });
+ $scope.optionsEmployee = allValuesEmployee.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Employee',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesEmployee.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshEmployee = () => {
$scope.optionsEmployee = [];
$http.get('/services/ts/codbex-employees/gen/codbex-employees/api/Employees/EmployeeController.ts').then((response) => {
@@ -212,6 +301,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesEmployee.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -222,6 +312,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCurrency = () => {
$scope.optionsCurrency = [];
$http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
@@ -229,6 +408,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Code
}));
+ allValuesCurrency.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -239,6 +419,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCompany = () => {
$scope.optionsCompany = [];
$http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
@@ -246,6 +515,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCompany.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -257,5 +527,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
};
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
//----------------Dropdowns-----------------//
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/index.html b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/index.html
index 4865343..0041695 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/EmployeePayment/main-details/index.html
@@ -28,8 +28,14 @@
ng-model="entity.Employee"
is-readonly="action === 'select'"
dropdown-items="optionsEmployee"
+ ng-keyup="onOptionsEmployeeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_EMPLOYEE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Employee'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Employee'} }}">
+
+
+
+ More Options
+
@@ -163,8 +169,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -226,8 +238,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.EMPLOYEEPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
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 fbde1a2..cc16eaa 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/controller.js
@@ -102,6 +102,52 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.data = [];
$scope.dataReset = false;
}
+ if (optionsCurrencyHasMore) {
+ const optionsCurrencySearchValues = Array.from(new Set(response.data.map(e => e.Currency)));
+ if (optionsCurrencySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCurrencySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCurrency.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCompanyHasMore) {
+ const optionsCompanySearchValues = Array.from(new Set(response.data.map(e => e.Company)));
+ if (optionsCompanySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCompanySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCompany.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
response.data.forEach(e => {
if (e.Date) {
e.Date = new Date(e.Date);
@@ -218,12 +264,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.optionsCurrency = [];
$scope.optionsCompany = [];
+ let optionsCurrencyHasMore = true;
- $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
- $scope.optionsCurrency = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/count').then((response) => {
+ const optionsCurrencyCount = response.data.count;
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
+ $scope.optionsCurrency = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCurrencyHasMore = optionsCurrencyCount > $scope.optionsCurrency.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -233,12 +292,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCompanyHasMore = true;
- $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
- $scope.optionsCompany = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/count').then((response) => {
+ const optionsCompanyCount = response.data.count;
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
+ $scope.optionsCompany = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCompanyHasMore = optionsCompanyCount > $scope.optionsCompany.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
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 1fa9591..77090ce 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
@@ -1,4 +1,4 @@
-angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, ViewParameters) => {
+angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, $http, ViewParameters) => {
const Dialogs = new DialogHub();
$scope.entity = {};
$scope.forms = {
@@ -34,8 +34,12 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.entity = params.entity ?? {};
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.filter = () => {
@@ -123,6 +127,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.resetFilter = () => {
$scope.entity = {};
$scope.filter();
+ lastSearchValuesCurrency.clear();
+ allValuesCurrency.length = 0;
+ lastSearchValuesCompany.clear();
+ allValuesCompany.length = 0;
};
$scope.cancel = () => {
@@ -132,4 +140,188 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
});
\ No newline at end of file
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 4a16534..b584ee6 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
@@ -96,8 +96,14 @@
state="{{ forms.details['Currency'].$valid ? '' : 'error' }}"
ng-model="entity.Currency"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -111,8 +117,14 @@
state="{{ forms.details['Company'].$valid ? '' : 'error' }}"
ng-model="entity.Company"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
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 ace94ce..e944190 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
@@ -46,8 +46,12 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.entity = params.entity;
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency?.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany?.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.create = () => {
@@ -109,6 +113,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCompany = '/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts';
$scope.optionsCompany = [];
@@ -128,6 +221,100 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
+
$scope.alert = (message) => {
if (message) Dialogs.showAlert({
title: description,
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/index.html
index 2b9cc74..59111a1 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/index.html
@@ -79,8 +79,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -96,8 +102,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/controller.js
index d5e2829..37fa898 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/controller.js
@@ -190,6 +190,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
//----------------Dropdowns-----------------//
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCurrency = () => {
$scope.optionsCurrency = [];
$http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
@@ -197,6 +286,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCurrency.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -207,6 +297,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCompany = () => {
$scope.optionsCompany = [];
$http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
@@ -214,6 +393,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCompany.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -225,5 +405,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
};
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
//----------------Dropdowns-----------------//
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/index.html
index 24f8243..7dd56d2 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/main-details/index.html
@@ -77,8 +77,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -98,8 +104,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTADJUSTMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/controller.js
index a001739..48b3466 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/controller.js
@@ -102,6 +102,98 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.data = [];
$scope.dataReset = false;
}
+ if (optionsCurrencyHasMore) {
+ const optionsCurrencySearchValues = Array.from(new Set(response.data.map(e => e.Currency)));
+ if (optionsCurrencySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCurrencySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCurrency.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsPaymentDirectionHasMore) {
+ const optionsPaymentDirectionSearchValues = Array.from(new Set(response.data.map(e => e.PaymentDirection)));
+ if (optionsPaymentDirectionSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsPaymentDirectionSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsPaymentDirection.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsPaymentTypeHasMore) {
+ const optionsPaymentTypeSearchValues = Array.from(new Set(response.data.map(e => e.PaymentType)));
+ if (optionsPaymentTypeSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsPaymentTypeSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsPaymentType.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCompanyHasMore) {
+ const optionsCompanySearchValues = Array.from(new Set(response.data.map(e => e.Company)));
+ if (optionsCompanySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCompanySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCompany.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
response.data.forEach(e => {
if (e.Date) {
e.Date = new Date(e.Date);
@@ -231,12 +323,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.optionsPaymentType = [];
$scope.optionsCompany = [];
+ let optionsCurrencyHasMore = true;
- $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
- $scope.optionsCurrency = response.data.map(e => ({
- value: e.Id,
- text: e.Code
- }));
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/count').then((response) => {
+ const optionsCurrencyCount = response.data.count;
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
+ $scope.optionsCurrency = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ optionsCurrencyHasMore = optionsCurrencyCount > $scope.optionsCurrency.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -246,12 +351,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsPaymentDirectionHasMore = true;
- $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts').then((response) => {
- $scope.optionsPaymentDirection = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts/count').then((response) => {
+ const optionsPaymentDirectionCount = response.data.count;
+ $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts').then((response) => {
+ $scope.optionsPaymentDirection = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsPaymentDirectionHasMore = optionsPaymentDirectionCount > $scope.optionsPaymentDirection.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -261,12 +379,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsPaymentTypeHasMore = true;
- $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts').then((response) => {
- $scope.optionsPaymentType = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts/count').then((response) => {
+ const optionsPaymentTypeCount = response.data.count;
+ $http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts').then((response) => {
+ $scope.optionsPaymentType = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsPaymentTypeHasMore = optionsPaymentTypeCount > $scope.optionsPaymentType.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -276,12 +407,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCompanyHasMore = true;
- $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
- $scope.optionsCompany = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/count').then((response) => {
+ const optionsCompanyCount = response.data.count;
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
+ $scope.optionsCompany = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCompanyHasMore = optionsCompanyCount > $scope.optionsCompany.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/controller.js
index 47d8f8d..6b538f3 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/controller.js
@@ -1,4 +1,4 @@
-angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, ViewParameters) => {
+angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, $http, ViewParameters) => {
const Dialogs = new DialogHub();
$scope.entity = {};
$scope.forms = {
@@ -40,10 +40,18 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.entity = params.entity ?? {};
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsPaymentDirection = params.optionsPaymentDirection;
- $scope.optionsPaymentType = params.optionsPaymentType;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsPaymentDirectionMap = new Map();
+ params.optionsPaymentDirection.forEach(e => optionsPaymentDirectionMap.set(e.value, e));
+ $scope.optionsPaymentDirection = Array.from(optionsPaymentDirectionMap.values());
+ const optionsPaymentTypeMap = new Map();
+ params.optionsPaymentType.forEach(e => optionsPaymentTypeMap.set(e.value, e));
+ $scope.optionsPaymentType = Array.from(optionsPaymentTypeMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.filter = () => {
@@ -175,6 +183,14 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.resetFilter = () => {
$scope.entity = {};
$scope.filter();
+ lastSearchValuesCurrency.clear();
+ allValuesCurrency.length = 0;
+ lastSearchValuesPaymentDirection.clear();
+ allValuesPaymentDirection.length = 0;
+ lastSearchValuesPaymentType.clear();
+ allValuesPaymentType.length = 0;
+ lastSearchValuesCompany.clear();
+ allValuesCompany.length = 0;
};
$scope.cancel = () => {
@@ -184,4 +200,366 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesPaymentDirection = new Set();
+ const allValuesPaymentDirection = [];
+ let loadMoreOptionsPaymentDirectionCounter = 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ $scope.optionsPaymentDirectionHasMore = true;
+
+ $scope.loadMoreOptionsPaymentDirection = () => {
+ const limit = 20;
+ $scope.optionsPaymentDirectionLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentDirectionCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentDirection.find(o => o.value === e.value)) {
+ $scope.optionsPaymentDirection.push(e);
+ }
+ })
+ $scope.optionsPaymentDirectionHasMore = resultValues.length > 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentDirectionLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentDirectionChange = (event) => {
+ if (allValuesPaymentDirection.length === 0) {
+ allValuesPaymentDirection.push(...$scope.optionsPaymentDirection);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentDirection.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentDirection = allValuesPaymentDirection;
+ $scope.optionsPaymentDirectionHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentDirectionHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentDirection).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ }
+ });
+ $scope.optionsPaymentDirection = allValuesPaymentDirection.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentDirection.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesPaymentType = new Set();
+ const allValuesPaymentType = [];
+ let loadMoreOptionsPaymentTypeCounter = 0;
+ $scope.optionsPaymentTypeLoading = false;
+ $scope.optionsPaymentTypeHasMore = true;
+
+ $scope.loadMoreOptionsPaymentType = () => {
+ const limit = 20;
+ $scope.optionsPaymentTypeLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentTypeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentType.find(o => o.value === e.value)) {
+ $scope.optionsPaymentType.push(e);
+ }
+ })
+ $scope.optionsPaymentTypeHasMore = resultValues.length > 0;
+ $scope.optionsPaymentTypeLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentTypeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentTypeChange = (event) => {
+ if (allValuesPaymentType.length === 0) {
+ allValuesPaymentType.push(...$scope.optionsPaymentType);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentType.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentType = allValuesPaymentType;
+ $scope.optionsPaymentTypeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentTypeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentType).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ }
+ });
+ $scope.optionsPaymentType = allValuesPaymentType.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentType.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/index.html
index 3e98e5b..c0a2c3e 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-filter/index.html
@@ -147,8 +147,14 @@
state="{{ forms.details['Currency'].$valid ? '' : 'error' }}"
ng-model="entity.Currency"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -162,8 +168,14 @@
state="{{ forms.details['PaymentDirection'].$valid ? '' : 'error' }}"
ng-model="entity.PaymentDirection"
dropdown-items="optionsPaymentDirection"
+ ng-keyup="onOptionsPaymentDirectionChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTDIRECTION)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentDirection'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentDirection'} }}">
+
+
+
+ More Options
+
@@ -177,8 +189,14 @@
state="{{ forms.details['PaymentType'].$valid ? '' : 'error' }}"
ng-model="entity.PaymentType"
dropdown-items="optionsPaymentType"
+ ng-keyup="onOptionsPaymentTypeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTTYPE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentType'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentType'} }}">
+
+
+
+ More Options
+
@@ -226,8 +244,14 @@
state="{{ forms.details['Company'].$valid ? '' : 'error' }}"
ng-model="entity.Company"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/controller.js
index 6a2d080..007e57b 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/controller.js
@@ -49,10 +49,18 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.entity = params.entity;
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsPaymentDirection = params.optionsPaymentDirection;
- $scope.optionsPaymentType = params.optionsPaymentType;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency?.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsPaymentDirectionMap = new Map();
+ params.optionsPaymentDirection?.forEach(e => optionsPaymentDirectionMap.set(e.value, e));
+ $scope.optionsPaymentDirection = Array.from(optionsPaymentDirectionMap.values());
+ const optionsPaymentTypeMap = new Map();
+ params.optionsPaymentType?.forEach(e => optionsPaymentTypeMap.set(e.value, e));
+ $scope.optionsPaymentType = Array.from(optionsPaymentTypeMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany?.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.create = () => {
@@ -114,6 +122,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.servicePaymentDirection = '/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts';
$scope.optionsPaymentDirection = [];
@@ -132,6 +229,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesPaymentDirection = new Set();
+ const allValuesPaymentDirection = [];
+ let loadMoreOptionsPaymentDirectionCounter = 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ $scope.optionsPaymentDirectionHasMore = true;
+
+ $scope.loadMoreOptionsPaymentDirection = () => {
+ const limit = 20;
+ $scope.optionsPaymentDirectionLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentDirectionCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentDirection.find(o => o.value === e.value)) {
+ $scope.optionsPaymentDirection.push(e);
+ }
+ })
+ $scope.optionsPaymentDirectionHasMore = resultValues.length > 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentDirectionLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentDirectionChange = (event) => {
+ if (allValuesPaymentDirection.length === 0) {
+ allValuesPaymentDirection.push(...$scope.optionsPaymentDirection);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentDirection.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentDirection = allValuesPaymentDirection;
+ $scope.optionsPaymentDirectionHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentDirectionHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentDirection).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ }
+ });
+ $scope.optionsPaymentDirection = allValuesPaymentDirection.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentDirection.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.servicePaymentType = '/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts';
$scope.optionsPaymentType = [];
@@ -150,6 +336,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesPaymentType = new Set();
+ const allValuesPaymentType = [];
+ let loadMoreOptionsPaymentTypeCounter = 0;
+ $scope.optionsPaymentTypeLoading = false;
+ $scope.optionsPaymentTypeHasMore = true;
+
+ $scope.loadMoreOptionsPaymentType = () => {
+ const limit = 20;
+ $scope.optionsPaymentTypeLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentTypeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentType.find(o => o.value === e.value)) {
+ $scope.optionsPaymentType.push(e);
+ }
+ })
+ $scope.optionsPaymentTypeHasMore = resultValues.length > 0;
+ $scope.optionsPaymentTypeLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentTypeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentTypeChange = (event) => {
+ if (allValuesPaymentType.length === 0) {
+ allValuesPaymentType.push(...$scope.optionsPaymentType);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentType.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentType = allValuesPaymentType;
+ $scope.optionsPaymentTypeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentTypeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentType).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ }
+ });
+ $scope.optionsPaymentType = allValuesPaymentType.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentType.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCompany = '/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts';
$scope.optionsCompany = [];
@@ -169,6 +444,100 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
+
$scope.alert = (message) => {
if (message) Dialogs.showAlert({
title: description,
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/index.html
index 185538b..e86cf48 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/dialog-window/index.html
@@ -144,8 +144,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -161,8 +167,14 @@
ng-model="entity.PaymentDirection"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentDirection"
+ ng-keyup="onOptionsPaymentDirectionChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTDIRECTION)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentDirection'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentDirection'} }}">
+
+
+
+ More Options
+
@@ -178,8 +190,14 @@
ng-model="entity.PaymentType"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentType"
+ ng-keyup="onOptionsPaymentTypeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTTYPE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentType'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentType'} }}">
+
+
+
+ More Options
+
@@ -237,8 +255,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/controller.js
index 08329d6..d2e22b9 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/controller.js
@@ -226,6 +226,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
//----------------Dropdowns-----------------//
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCurrency = () => {
$scope.optionsCurrency = [];
$http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
@@ -233,6 +322,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Code
}));
+ allValuesCurrency.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -243,6 +333,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesPaymentDirection = new Set();
+ const allValuesPaymentDirection = [];
+ let loadMoreOptionsPaymentDirectionCounter = 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ $scope.optionsPaymentDirectionHasMore = true;
+
+ $scope.loadMoreOptionsPaymentDirection = () => {
+ const limit = 20;
+ $scope.optionsPaymentDirectionLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentDirectionCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentDirection.find(o => o.value === e.value)) {
+ $scope.optionsPaymentDirection.push(e);
+ }
+ })
+ $scope.optionsPaymentDirectionHasMore = resultValues.length > 0;
+ $scope.optionsPaymentDirectionLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentDirectionLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentDirectionChange = (event) => {
+ if (allValuesPaymentDirection.length === 0) {
+ allValuesPaymentDirection.push(...$scope.optionsPaymentDirection);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentDirection.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentDirection = allValuesPaymentDirection;
+ $scope.optionsPaymentDirectionHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentDirectionHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentDirection).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentDirection.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentDirection.push(e);
+ }
+ });
+ $scope.optionsPaymentDirection = allValuesPaymentDirection.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentDirection',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentDirection.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshPaymentDirection = () => {
$scope.optionsPaymentDirection = [];
$http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentDirectionController.ts').then((response) => {
@@ -250,6 +429,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesPaymentDirection.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -260,6 +440,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesPaymentType = new Set();
+ const allValuesPaymentType = [];
+ let loadMoreOptionsPaymentTypeCounter = 0;
+ $scope.optionsPaymentTypeLoading = false;
+ $scope.optionsPaymentTypeHasMore = true;
+
+ $scope.loadMoreOptionsPaymentType = () => {
+ const limit = 20;
+ $scope.optionsPaymentTypeLoading = true;
+ $http.get(`/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts?$limit=${limit}&$offset=${++loadMoreOptionsPaymentTypeCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsPaymentType.find(o => o.value === e.value)) {
+ $scope.optionsPaymentType.push(e);
+ }
+ })
+ $scope.optionsPaymentTypeHasMore = resultValues.length > 0;
+ $scope.optionsPaymentTypeLoading = false;
+ }, (error) => {
+ $scope.optionsPaymentTypeLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsPaymentTypeChange = (event) => {
+ if (allValuesPaymentType.length === 0) {
+ allValuesPaymentType.push(...$scope.optionsPaymentType);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesPaymentType.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsPaymentType = allValuesPaymentType;
+ $scope.optionsPaymentTypeHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsPaymentTypeHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesPaymentType).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesPaymentType.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesPaymentType.push(e);
+ }
+ });
+ $scope.optionsPaymentType = allValuesPaymentType.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'PaymentType',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesPaymentType.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshPaymentType = () => {
$scope.optionsPaymentType = [];
$http.get('/services/ts/codbex-payments/gen/codbex-payments/api/Settings/PaymentTypeController.ts').then((response) => {
@@ -267,6 +536,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesPaymentType.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -277,6 +547,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCompany = () => {
$scope.optionsCompany = [];
$http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
@@ -284,6 +643,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCompany.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -295,5 +655,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
};
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
//----------------Dropdowns-----------------//
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/index.html
index 0a6073e..8456960 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentRecord/PaymentRecord/main-details/index.html
@@ -142,8 +142,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -163,8 +169,14 @@
ng-model="entity.PaymentDirection"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentDirection"
+ ng-keyup="onOptionsPaymentDirectionChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTDIRECTION)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentDirection'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentDirection'} }}">
+
+
+
+ More Options
+
@@ -184,8 +196,14 @@
ng-model="entity.PaymentType"
is-readonly="action === 'select'"
dropdown-items="optionsPaymentType"
+ ng-keyup="onOptionsPaymentTypeChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_PAYMENTTYPE)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'PaymentType'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'PaymentType'} }}">
+
+
+
+ More Options
+
@@ -247,8 +265,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.PAYMENTRECORD_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/Settings/PaymentDirection/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/Settings/PaymentDirection/dialog-filter/controller.js
index b20b3dd..1449068 100644
--- a/codbex-payments/gen/codbex-payments/ui/Settings/PaymentDirection/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/Settings/PaymentDirection/dialog-filter/controller.js
@@ -63,4 +63,5 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/Settings/PaymentType/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/Settings/PaymentType/dialog-filter/controller.js
index 1a167a6..efe3409 100644
--- a/codbex-payments/gen/codbex-payments/ui/Settings/PaymentType/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/Settings/PaymentType/dialog-filter/controller.js
@@ -63,4 +63,5 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/controller.js b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/controller.js
index 8d9495b..2746552 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/controller.js
@@ -102,6 +102,75 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.data = [];
$scope.dataReset = false;
}
+ if (optionsSupplierHasMore) {
+ const optionsSupplierSearchValues = Array.from(new Set(response.data.map(e => e.Supplier)));
+ if (optionsSupplierSearchValues.length > 0) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsSupplierSearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsSupplier.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCurrencyHasMore) {
+ const optionsCurrencySearchValues = Array.from(new Set(response.data.map(e => e.Currency)));
+ if (optionsCurrencySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCurrencySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCurrency.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
+ if (optionsCompanyHasMore) {
+ const optionsCompanySearchValues = Array.from(new Set(response.data.map(e => e.Company)));
+ if (optionsCompanySearchValues.length > 0) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Id', operator: 'IN', value: optionsCompanySearchValues }
+ ]
+ }).then((response) => {
+ $scope.optionsCompany.push(...response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ })));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ }
+ }
response.data.forEach(e => {
if (e.Date) {
e.Date = new Date(e.Date);
@@ -223,12 +292,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.optionsCurrency = [];
$scope.optionsCompany = [];
+ let optionsSupplierHasMore = true;
- $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts').then((response) => {
- $scope.optionsSupplier = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts/count').then((response) => {
+ const optionsSupplierCount = response.data.count;
+ $http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts').then((response) => {
+ $scope.optionsSupplier = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsSupplierHasMore = optionsSupplierCount > $scope.optionsSupplier.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -238,12 +320,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCurrencyHasMore = true;
- $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
- $scope.optionsCurrency = response.data.map(e => ({
- value: e.Id,
- text: e.Code
- }));
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/count').then((response) => {
+ const optionsCurrencyCount = response.data.count;
+ $http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
+ $scope.optionsCurrency = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ optionsCurrencyHasMore = optionsCurrencyCount > $scope.optionsCurrency.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -253,12 +348,25 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+ let optionsCompanyHasMore = true;
- $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
- $scope.optionsCompany = response.data.map(e => ({
- value: e.Id,
- text: e.Name
- }));
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/count').then((response) => {
+ const optionsCompanyCount = response.data.count;
+ $http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
+ $scope.optionsCompany = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ optionsCompanyHasMore = optionsCompanyCount > $scope.optionsCompany.length;
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/controller.js
index 63d9d28..34d871d 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/controller.js
@@ -1,4 +1,4 @@
-angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, ViewParameters) => {
+angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controller('PageController', ($scope, $http, ViewParameters) => {
const Dialogs = new DialogHub();
$scope.entity = {};
$scope.forms = {
@@ -34,9 +34,15 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.entity = params.entity ?? {};
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsSupplier = params.optionsSupplier;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsSupplierMap = new Map();
+ params.optionsSupplier.forEach(e => optionsSupplierMap.set(e.value, e));
+ $scope.optionsSupplier = Array.from(optionsSupplierMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.filter = () => {
@@ -156,6 +162,12 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.resetFilter = () => {
$scope.entity = {};
$scope.filter();
+ lastSearchValuesSupplier.clear();
+ allValuesSupplier.length = 0;
+ lastSearchValuesCurrency.clear();
+ allValuesCurrency.length = 0;
+ lastSearchValuesCompany.clear();
+ allValuesCompany.length = 0;
};
$scope.cancel = () => {
@@ -165,4 +177,277 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale']).controlle
$scope.clearErrorMessage = () => {
$scope.errorMessage = null;
};
+
+ const lastSearchValuesSupplier = new Set();
+ const allValuesSupplier = [];
+ let loadMoreOptionsSupplierCounter = 0;
+ $scope.optionsSupplierLoading = false;
+ $scope.optionsSupplierHasMore = true;
+
+ $scope.loadMoreOptionsSupplier = () => {
+ const limit = 20;
+ $scope.optionsSupplierLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts?$limit=${limit}&$offset=${++loadMoreOptionsSupplierCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsSupplier.find(o => o.value === e.value)) {
+ $scope.optionsSupplier.push(e);
+ }
+ })
+ $scope.optionsSupplierHasMore = resultValues.length > 0;
+ $scope.optionsSupplierLoading = false;
+ }, (error) => {
+ $scope.optionsSupplierLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsSupplierChange = (event) => {
+ if (allValuesSupplier.length === 0) {
+ allValuesSupplier.push(...$scope.optionsSupplier);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesSupplier.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsSupplier = allValuesSupplier;
+ $scope.optionsSupplierHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsSupplierHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesSupplier).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ }
+ });
+ $scope.optionsSupplier = allValuesSupplier.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesSupplier.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/index.html b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/index.html
index df0890f..b13bf8d 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-filter/index.html
@@ -27,8 +27,14 @@
state="{{ forms.details['Supplier'].$valid ? '' : 'error' }}"
ng-model="entity.Supplier"
dropdown-items="optionsSupplier"
+ ng-keyup="onOptionsSupplierChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_SUPPLIER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Supplier'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Supplier'} }}">
+
+
+
+ More Options
+
@@ -162,8 +168,14 @@
state="{{ forms.details['Currency'].$valid ? '' : 'error' }}"
ng-model="entity.Currency"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -211,8 +223,14 @@
state="{{ forms.details['Company'].$valid ? '' : 'error' }}"
ng-model="entity.Company"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/controller.js b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/controller.js
index 58ff3a2..5c3ca30 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/controller.js
@@ -46,9 +46,15 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
$scope.entity = params.entity;
$scope.selectedMainEntityKey = params.selectedMainEntityKey;
$scope.selectedMainEntityId = params.selectedMainEntityId;
- $scope.optionsSupplier = params.optionsSupplier;
- $scope.optionsCurrency = params.optionsCurrency;
- $scope.optionsCompany = params.optionsCompany;
+ const optionsSupplierMap = new Map();
+ params.optionsSupplier?.forEach(e => optionsSupplierMap.set(e.value, e));
+ $scope.optionsSupplier = Array.from(optionsSupplierMap.values());
+ const optionsCurrencyMap = new Map();
+ params.optionsCurrency?.forEach(e => optionsCurrencyMap.set(e.value, e));
+ $scope.optionsCurrency = Array.from(optionsCurrencyMap.values());
+ const optionsCompanyMap = new Map();
+ params.optionsCompany?.forEach(e => optionsCompanyMap.set(e.value, e));
+ $scope.optionsCompany = Array.from(optionsCompanyMap.values());
}
$scope.create = () => {
@@ -110,6 +116,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesSupplier = new Set();
+ const allValuesSupplier = [];
+ let loadMoreOptionsSupplierCounter = 0;
+ $scope.optionsSupplierLoading = false;
+ $scope.optionsSupplierHasMore = true;
+
+ $scope.loadMoreOptionsSupplier = () => {
+ const limit = 20;
+ $scope.optionsSupplierLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts?$limit=${limit}&$offset=${++loadMoreOptionsSupplierCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsSupplier.find(o => o.value === e.value)) {
+ $scope.optionsSupplier.push(e);
+ }
+ })
+ $scope.optionsSupplierHasMore = resultValues.length > 0;
+ $scope.optionsSupplierLoading = false;
+ }, (error) => {
+ $scope.optionsSupplierLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsSupplierChange = (event) => {
+ if (allValuesSupplier.length === 0) {
+ allValuesSupplier.push(...$scope.optionsSupplier);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesSupplier.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsSupplier = allValuesSupplier;
+ $scope.optionsSupplierHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsSupplierHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesSupplier).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ }
+ });
+ $scope.optionsSupplier = allValuesSupplier.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesSupplier.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCurrency = '/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts';
$scope.optionsCurrency = [];
@@ -128,6 +223,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
type: AlertTypes.Error
});
});
+
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
$scope.serviceCompany = '/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts';
$scope.optionsCompany = [];
@@ -147,6 +331,100 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
+
$scope.alert = (message) => {
if (message) Dialogs.showAlert({
title: description,
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/index.html b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/index.html
index 2c8ac22..77c532a 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/dialog-window/index.html
@@ -30,8 +30,14 @@
ng-model="entity.Supplier"
is-readonly="action === 'select'"
dropdown-items="optionsSupplier"
+ ng-keyup="onOptionsSupplierChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_SUPPLIER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Supplier'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Supplier'} }}">
+
+
+
+ More Options
+
@@ -161,8 +167,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -220,8 +232,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/controller.js b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/controller.js
index f844add..067b14d 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/controller.js
@@ -205,6 +205,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
//----------------Dropdowns-----------------//
+ const lastSearchValuesSupplier = new Set();
+ const allValuesSupplier = [];
+ let loadMoreOptionsSupplierCounter = 0;
+ $scope.optionsSupplierLoading = false;
+ $scope.optionsSupplierHasMore = true;
+
+ $scope.loadMoreOptionsSupplier = () => {
+ const limit = 20;
+ $scope.optionsSupplierLoading = true;
+ $http.get(`/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts?$limit=${limit}&$offset=${++loadMoreOptionsSupplierCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsSupplier.find(o => o.value === e.value)) {
+ $scope.optionsSupplier.push(e);
+ }
+ })
+ $scope.optionsSupplierHasMore = resultValues.length > 0;
+ $scope.optionsSupplierLoading = false;
+ }, (error) => {
+ $scope.optionsSupplierLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsSupplierChange = (event) => {
+ if (allValuesSupplier.length === 0) {
+ allValuesSupplier.push(...$scope.optionsSupplier);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesSupplier.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsSupplier = allValuesSupplier;
+ $scope.optionsSupplierHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsSupplierHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesSupplier).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesSupplier.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesSupplier.push(e);
+ }
+ });
+ $scope.optionsSupplier = allValuesSupplier.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Supplier',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesSupplier.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshSupplier = () => {
$scope.optionsSupplier = [];
$http.get('/services/ts/codbex-partners/gen/codbex-partners/api/Suppliers/SupplierController.ts').then((response) => {
@@ -212,6 +301,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesSupplier.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -222,6 +312,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCurrency = new Set();
+ const allValuesCurrency = [];
+ let loadMoreOptionsCurrencyCounter = 0;
+ $scope.optionsCurrencyLoading = false;
+ $scope.optionsCurrencyHasMore = true;
+
+ $scope.loadMoreOptionsCurrency = () => {
+ const limit = 20;
+ $scope.optionsCurrencyLoading = true;
+ $http.get(`/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCurrencyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCurrency.find(o => o.value === e.value)) {
+ $scope.optionsCurrency.push(e);
+ }
+ })
+ $scope.optionsCurrencyHasMore = resultValues.length > 0;
+ $scope.optionsCurrencyLoading = false;
+ }, (error) => {
+ $scope.optionsCurrencyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCurrencyChange = (event) => {
+ if (allValuesCurrency.length === 0) {
+ allValuesCurrency.push(...$scope.optionsCurrency);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCurrency.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCurrency = allValuesCurrency;
+ $scope.optionsCurrencyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCurrencyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCurrency).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts/search', {
+ conditions: [
+ { propertyName: 'Code', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCurrency.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Code
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCurrency.push(e);
+ }
+ });
+ $scope.optionsCurrency = allValuesCurrency.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Currency',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCurrency.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCurrency = () => {
$scope.optionsCurrency = [];
$http.get('/services/ts/codbex-currencies/gen/codbex-currencies/api/Settings/CurrencyController.ts').then((response) => {
@@ -229,6 +408,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Code
}));
+ allValuesCurrency.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -239,6 +419,95 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
});
};
+ const lastSearchValuesCompany = new Set();
+ const allValuesCompany = [];
+ let loadMoreOptionsCompanyCounter = 0;
+ $scope.optionsCompanyLoading = false;
+ $scope.optionsCompanyHasMore = true;
+
+ $scope.loadMoreOptionsCompany = () => {
+ const limit = 20;
+ $scope.optionsCompanyLoading = true;
+ $http.get(`/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts?$limit=${limit}&$offset=${++loadMoreOptionsCompanyCounter * limit}`)
+ .then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const resultValues = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ const newValues = [];
+ resultValues.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ newValues.push(e);
+ }
+ });
+ newValues.forEach(e => {
+ if (!$scope.optionsCompany.find(o => o.value === e.value)) {
+ $scope.optionsCompany.push(e);
+ }
+ })
+ $scope.optionsCompanyHasMore = resultValues.length > 0;
+ $scope.optionsCompanyLoading = false;
+ }, (error) => {
+ $scope.optionsCompanyLoading = false;
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ };
+
+ $scope.onOptionsCompanyChange = (event) => {
+ if (allValuesCompany.length === 0) {
+ allValuesCompany.push(...$scope.optionsCompany);
+ }
+ if (event.originalEvent.target.value === '') {
+ allValuesCompany.sort((a, b) => a.text.localeCompare(b.text));
+ $scope.optionsCompany = allValuesCompany;
+ $scope.optionsCompanyHasMore = true;
+ } else if (isText(event.which)) {
+ $scope.optionsCompanyHasMore = false;
+ let cacheHit = false;
+ Array.from(lastSearchValuesCompany).forEach(e => {
+ if (event.originalEvent.target.value.startsWith(e)) {
+ cacheHit = true;
+ }
+ })
+ if (!cacheHit) {
+ $http.post('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts/search', {
+ conditions: [
+ { propertyName: 'Name', operator: 'LIKE', value: `${event.originalEvent.target.value}%` }
+ ]
+ }).then((response) => {
+ const optionValues = allValuesCompany.map(e => e.value);
+ const searchResult = response.data.map(e => ({
+ value: e.Id,
+ text: e.Name
+ }));
+ searchResult.forEach(e => {
+ if (!optionValues.includes(e.value)) {
+ allValuesCompany.push(e);
+ }
+ });
+ $scope.optionsCompany = allValuesCompany.filter(e => e.text.toLowerCase().startsWith(event.originalEvent.target.value.toLowerCase()));
+ }, (error) => {
+ console.error(error);
+ const message = error.data ? error.data.message : '';
+ Dialogs.showAlert({
+ title: 'Company',
+ message: LocaleService.t('codbex-payments:codbex-payments-model.messages.error.unableToLoad', { message: message }),
+ type: AlertTypes.Error
+ });
+ });
+ lastSearchValuesCompany.add(event.originalEvent.target.value);
+ }
+ }
+ };
+
$scope.refreshCompany = () => {
$scope.optionsCompany = [];
$http.get('/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyController.ts').then((response) => {
@@ -246,6 +515,7 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
value: e.Id,
text: e.Name
}));
+ allValuesCompany.length === 0;
}, (error) => {
console.error(error);
const message = error.data ? error.data.message : '';
@@ -257,5 +527,10 @@ angular.module('page', ['blimpKit', 'platformView', 'platformLocale', 'EntitySer
});
};
+ function isText(keycode) {
+ if ((keycode >= 48 && keycode <= 90) || (keycode >= 96 && keycode <= 111) || (keycode >= 186 && keycode <= 222) || [8, 46, 173].includes(keycode)) return true;
+ return false;
+ }
+
//----------------Dropdowns-----------------//
});
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/index.html b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/index.html
index a916d16..b396a8f 100644
--- a/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/SupplierPayment/SupplierPayment/main-details/index.html
@@ -28,8 +28,14 @@
ng-model="entity.Supplier"
is-readonly="action === 'select'"
dropdown-items="optionsSupplier"
+ ng-keyup="onOptionsSupplierChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_SUPPLIER)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Supplier'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Supplier'} }}">
+
+
+
+ More Options
+
@@ -163,8 +169,14 @@
ng-model="entity.Currency"
is-readonly="action === 'select'"
dropdown-items="optionsCurrency"
+ ng-keyup="onOptionsCurrencyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_CURRENCY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Currency'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Currency'} }}">
+
+
+
+ More Options
+
@@ -226,8 +238,14 @@
ng-model="entity.Company"
is-readonly="action === 'select'"
dropdown-items="optionsCompany"
+ ng-keyup="onOptionsCompanyChange($event)"
placeholder="{{ 'codbex-payments:codbex-payments-model.messages.inputSearch' | t:{'name':'$t(codbex-payments:codbex-payments-model.t.SUPPLIERPAYMENT_COMPANY)'} }}"
btn-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.showHide' | t:{'name':'Company'} }}" list-aria-label="{{ 'codbex-payments:codbex-payments-model.aria.options' | t:{'name':'Company'} }}">
+
+
+
+ More Options
+