invoiceModule.controller('outputReconciliationKeywordsController', ['$scope', '$log', 'uiGridConstants', 'SweetAlert', '$translate', 'stdAccountService', '$interval', 'orgService', '$timeout', '$q', 'commonWebService', 'loginContext', '$uibModal', 'outputReconciliationConfiguration', function ($scope, $log, uiGridConstants, SweetAlert, $translate, stdAccountService, $interval, orgService, $timeout, $q, commonWebService, loginContext, $uibModal, outputReconciliationConfiguration) { 'use strict'; var mainModule = { main: function () { if (!$scope.keywordsList) { $scope.keywordsList = []; } $scope.addKeywords = mainModule.addKeywords; $scope.deleteKeywords = mainModule.deleteKeywords; }, addKeywords: function () { var length = $scope.keywordsList.length; if (length >= 5) { SweetAlert.warning($translate.instant('LimitKeyWords')); return; }; var prefixStr = ''; if (length !== 0) { prefixStr = ';'; } var obj = { id: window.PWC.newGuid(), value: '', prefix: prefixStr, }; $scope.keywordsList.push(obj); }, deleteKeywords: function (obj) { if ($scope.keywordsList && $scope.keywordsList.length > 0) { var findIndex = _.indexOf($scope.keywordsList, obj); if (findIndex > -1) { $scope.keywordsList.splice(findIndex, 1); } if (findIndex === 0 && $scope.keywordsList.length >= 0) { $scope.keywordsList[0].prefix = ''; } } }, }; (function initializa() { mainModule.main(); $log.debug('outputReconciliationKeywordsController.ctor()...'); })(); } ]);