From 294d541013e072a385208e05a4b139a7ff9f176b Mon Sep 17 00:00:00 2001 From: Vishwas Babu A J Date: Sun, 2 Mar 2014 04:09:27 -0800 Subject: [PATCH] reformatting project --- .../accounting/AccCoaController.js | 177 +-- .../accounting/AccCreateGLAccountContoller.js | 108 +- .../accounting/AccCreateRuleController.js | 168 +-- .../accounting/AccEditGLAccountController.js | 142 +- .../accounting/AccEditRuleController.js | 244 ++-- .../accounting/AccFreqPostingController.js | 152 +-- .../accounting/AccViewGLAccountContoller.js | 138 +- .../accounting/AccountingClosureController.js | 66 +- .../accounting/AccountingRuleController.js | 28 +- .../accounting/JournalEntryController.js | 148 +- .../accounting/SearchTransactionController.js | 114 +- .../accounting/ViewAccRuleController.js | 48 +- .../ViewAccountingClosureController.js | 10 +- .../accounting/ViewTransactionController.js | 84 +- .../MakeAccountTransferController.js | 100 +- .../ViewAccountTransferDetailsController.js | 22 +- .../controllers/centers/AddGroupController.js | 52 +- .../centers/CenterAttendanceController.js | 23 +- .../controllers/centers/CenterController.js | 16 +- .../centers/CloseCenterController.js | 16 +- .../centers/CreateCenterController.js | 36 +- .../centers/EditCenterController.js | 32 +- .../centers/ViewCenterController.js | 63 +- .../client/ClientActionsController.js | 250 ++-- .../controllers/client/ClientController.js | 36 +- .../client/ClientDocumentController.js | 50 +- .../client/ClientIdentifierController.js | 10 +- .../client/ClientScreenReportController.js | 60 +- .../client/CreateClientController.js | 128 +- .../client/EditClientController.js | 124 +- .../client/TransactionClientController.js | 42 +- ...ploadClientIdentifierDocumentController.js | 52 +- .../collection/CollectionSheetController.js | 571 ++++---- .../ProductiveCollectionSheetController.js | 360 ++--- .../GlobalConfigurationController.js | 46 +- .../controllers/groups/AddMemberController.js | 26 +- .../controllers/groups/AddRoleController.js | 14 +- .../groups/AssignStaffController.js | 18 +- .../groups/AttachMeetingController.js | 73 +- .../groups/CloseGroupController.js | 16 +- .../groups/CreateGroupController.js | 62 +- .../controllers/groups/EditGroupController.js | 44 +- .../groups/EditMeetingController.js | 82 +- .../groups/GroupAttendanceController.js | 21 +- .../controllers/groups/GroupController.js | 14 +- .../groups/MemberManageController.js | 18 +- .../groups/TransferClientsController.js | 29 +- .../controllers/groups/ViewGroupController.js | 139 +- .../loanAccount/AddLoanChargeController.js | 71 +- .../AddLoanCollateralController.js | 48 +- .../AssignLoanOfficerController.js | 62 +- .../loanAccount/EditGuarantorController.js | 28 +- .../loanAccount/EditLoanAccAppController.js | 352 ++--- .../loanAccount/EditLoanChargeController.js | 44 +- .../EditLoanCollateralController.js | 46 +- .../loanAccount/GuarantorController.js | 39 +- .../LoanAccountActionsController.js | 520 +++---- .../loanAccount/LoanDocumentController.js | 50 +- .../loanAccount/LoanScreenReportController.js | 60 +- .../loanAccount/NewJLGLoanAccAppController.js | 344 ++--- .../loanAccount/NewLoanAccAppController.js | 296 ++-- .../loanAccount/ViewLoanChargeController.js | 74 +- .../ViewLoanCollateralController.js | 52 +- .../loanAccount/ViewLoanDetailsController.js | 705 +++++----- .../ViewLoanTransactionController.js | 40 +- .../main/AdHocQuerySearchController.js | 248 ++-- .../main/ExpertSearchController.js | 352 +++-- .../controllers/main/LoginFormController.js | 42 +- .../controllers/main/MainController.js | 451 +++---- .../controllers/main/NavigationController.js | 374 ++--- .../controllers/main/ProfileController.js | 10 +- .../controllers/main/SearchController.js | 113 +- .../controllers/main/TaskController.js | 628 ++++----- .../main/ViewCheckerinboxController.js | 18 +- .../main/ViewMakerCheckerTaskController.js | 6 +- .../organization/AddCodeController.js | 19 +- .../organization/AddHolController.js | 75 +- .../BulkLoanReassignmentController.js | 33 +- .../organization/CreateEmployeeController.js | 42 +- .../organization/CreateOfficeController.js | 56 +- .../organization/CreateRoleController.js | 28 +- .../organization/CreateUserController.js | 46 +- .../organization/CurrencyConfigController.js | 86 +- .../organization/DataTableController.js | 22 +- .../organization/EditEmployeeController.js | 52 +- .../organization/EditHolidayController.js | 80 +- .../organization/EditOfficeController.js | 73 +- .../organization/EditUserController.js | 70 +- .../organization/EmployeeController.js | 30 +- .../controllers/organization/HolController.js | 18 +- .../organization/MakerCheckerController.js | 153 +-- .../organization/ManageFundsController.js | 64 +- .../organization/OfficesController.js | 113 +- .../organization/RoleController.js | 30 +- .../organization/ViewAccRuleController.js | 36 +- .../organization/ViewCodeController.js | 16 +- .../organization/ViewDataTableController.js | 48 +- .../organization/ViewEmployeeController.js | 24 +- .../organization/ViewHolController.js | 12 +- .../organization/ViewOfficeController.js | 24 +- .../organization/ViewRoleController.js | 153 +-- .../private/SuperuserController.js | 304 ++--- .../controllers/product/ChargeController.js | 34 +- .../product/CreateChargeController.js | 26 +- .../product/CreateLoanProductController.js | 426 +++--- .../product/CreateSavingProductController.js | 349 +++-- .../product/EditChargeController.js | 36 +- .../product/EditLoanProductController.js | 654 ++++----- .../product/EditSavingProductController.js | 450 +++---- .../product/LoanProductController.js | 34 +- .../product/SavingProductController.js | 30 +- .../product/ViewChargeController.js | 60 +- .../product/ViewLoanProductController.js | 32 +- .../product/ViewSavingProductController.js | 28 +- .../productmix/AddProductMixController.js | 44 +- .../productmix/ProductMixController.js | 10 +- .../productmix/ViewProductMixController.js | 44 +- .../reports/RunReportsController.js | 674 +++++----- .../reports/ViewReportsController.js | 99 +- .../controllers/reports/XBRLController.js | 237 ++-- .../reports/XBRLReportController.js | 52 +- .../savings/AddNewSavingsChargeController.js | 104 +- .../savings/CreateSavingAccountController.js | 259 ++-- .../savings/EditSavingAccountController.js | 296 ++-- .../savings/SavingAccountActionsController.js | 66 +- .../savings/ViewSavingDetailsController.js | 424 +++--- .../ViewSavingsTransactionController.js | 46 +- .../controllers/system/AddCodeController.js | 13 +- .../controllers/system/AuditController.js | 95 +- .../controllers/system/CodeController.js | 16 +- .../system/CreateDataTableController.js | 114 +- .../system/CreateReportController.js | 108 +- .../controllers/system/DataTableController.js | 28 +- .../system/DataTableEntryController.js | 246 ++-- .../controllers/system/EditCodeController.js | 34 +- .../system/EditDataTableController.js | 268 ++-- .../system/EditReportController.js | 140 +- .../system/EditSchedulerJobController.js | 50 +- .../system/MakeDataTableEntryController.js | 58 +- .../controllers/system/ReportsController.js | 30 +- .../system/SchedulerJobsController.js | 182 +-- .../controllers/system/ViewAuditController.js | 12 +- .../controllers/system/ViewCodeController.js | 42 +- .../system/ViewDataTableController.js | 82 +- .../system/ViewReportController.js | 50 +- .../system/ViewSchedulerJobController.js | 22 +- .../ViewSchedulerJobHistoryController.js | 27 +- .../template/CreateTemplateController.js | 223 +-- .../template/EditTemplateController.js | 287 ++-- .../template/TemplateController.js | 22 +- .../template/ViewTemplateController.js | 54 +- .../controllers/user/UserController.js | 30 +- .../controllers/user/UserFormController.js | 106 +- .../controllers/user/UserListController.js | 30 +- .../controllers/user/UserSettingController.js | 72 +- .../controllers/user/ViewUserController.js | 86 +- .../ActivitiesDisplayPanelDirective.js | 15 +- .../directives/ApiValidationDirective.js | 22 +- app/scripts/directives/AutofocusDirective.js | 14 +- app/scripts/directives/BigPanelDirective.js | 15 +- .../directives/ChosenComboboxDirective.js | 12 +- app/scripts/directives/CkEditorDirective.js | 48 +- app/scripts/directives/DialogDirective.js | 62 +- .../directives/FormSubmitValidateDirective.js | 34 +- .../directives/FormValidateDirective.js | 18 +- .../directives/HasPermissionDirective.js | 47 +- .../directives/LateValidateDirective.js | 12 +- app/scripts/directives/OnBlurDirective.js | 15 +- app/scripts/directives/OverlayDirective.js | 76 +- app/scripts/directives/PanelDirective.js | 9 +- .../directives/ScrollbarTopDirective.js | 16 +- app/scripts/directives/SummaryDirective.js | 15 +- app/scripts/directives/TreeviewDirective.js | 52 +- app/scripts/filters/DateFormat.js | 12 +- app/scripts/filters/DayMonthFormat.js | 48 +- app/scripts/filters/DotRemove.js | 10 +- app/scripts/filters/StatusLookup.js | 68 +- app/scripts/filters/UrlToString.js | 8 +- app/scripts/filters/YesOrNo.js | 10 +- app/scripts/filters/sort.js | 6 +- app/scripts/initialTasks.js | 6 +- app/scripts/loader-build.js | 88 +- app/scripts/loader.js | 88 +- app/scripts/mifosX.js | 14 +- app/scripts/mifosXComponents-build.js | 56 +- app/scripts/mifosXStyles-build.js | 8 +- app/scripts/mifosXStyles.js | 32 +- app/scripts/models/Langs.js | 21 +- app/scripts/models/LoggedInUser.js | 22 +- app/scripts/models/Role.js | 16 +- app/scripts/models/roleMap.js | 16 +- app/scripts/modules/KeyboardManager.js | 410 +++--- .../modules/angularjs-nvd3-directives.js | 696 +++++----- app/scripts/modules/chosen.jquery.min.js | 298 +++- app/scripts/modules/configurations.js | 8 +- app/scripts/modules/csv.js | 174 +-- app/scripts/modules/datepicker.js | 209 +-- app/scripts/modules/localstorage.js | 462 +++---- app/scripts/modules/notificationWidget.js | 256 ++-- app/scripts/routes.js | 1037 +++++++------- app/scripts/services/AuthenticationService.js | 44 +- app/scripts/services/HttpServiceProvider.js | 106 +- app/scripts/services/Paginator.js | 88 +- .../services/ResourceFactoryProvider.js | 642 ++++----- app/scripts/services/SessionManager.js | 70 +- app/scripts/webstorage-configuration.js | 28 +- app/views/accounting/accounting.html | 73 +- app/views/accounting/accounting_coa.html | 89 +- app/views/accounting/accounting_rules.html | 33 +- app/views/accounting/accounts_closure.html | 5 +- app/views/accounting/add_acc_rule.html | 204 +-- app/views/accounting/createclosure.html | 20 +- app/views/accounting/createglaccounting.html | 1 + app/views/accounting/edit_acc_rule.html | 218 +-- app/views/accounting/editglaccounting.html | 240 ++-- app/views/accounting/freqposting.html | 200 +-- .../accounting/journalentry_posting.html | 280 ++-- app/views/accounting/search_transaction.html | 131 +- app/views/accounting/view_acc_rule.html | 108 +- .../accounting/view_close_accounting.html | 11 +- app/views/accounting/view_transactions.html | 71 +- app/views/accounting/viewglaccounting.html | 111 +- .../make_accounttransfer.html | 224 +-- .../view_accounttransfer.html | 151 ++- app/views/administration/addrole.html | 69 +- app/views/administration/createuser.html | 170 ++- app/views/administration/edituser.html | 133 +- app/views/administration/global.html | 10 +- app/views/administration/makerchecker.html | 91 +- app/views/administration/organization.html | 80 +- app/views/administration/roles.html | 31 +- app/views/administration/system.html | 91 +- app/views/administration/userFormDialog.html | 53 +- app/views/administration/users.html | 32 +- app/views/administration/usersettings.html | 5 +- app/views/administration/userslist.html | 32 +- app/views/administration/viewrole.html | 122 +- app/views/administration/viewuser.html | 99 +- app/views/centers/addgroup.html | 37 +- app/views/centers/centerattendance.html | 20 +- app/views/centers/centers.html | 19 +- app/views/centers/closecenter.html | 18 +- app/views/centers/createcenter.html | 35 +- app/views/centers/editcenter.html | 41 +- app/views/centers/viewcenter.html | 124 +- app/views/clients/addclientdocument.html | 80 +- app/views/clients/addclientidentifier.html | 85 +- .../clients/addclientidentifierdocument.html | 74 +- app/views/clients/clientactions.html | 100 +- app/views/clients/clients.html | 46 +- app/views/clients/clientscreenreport.html | 34 +- app/views/clients/createclient.html | 180 +-- app/views/clients/editclient.html | 264 ++-- app/views/clients/transferclient.html | 63 +- app/views/clients/viewclient.html | 908 +++++++------ app/views/collection/collectionsheet.html | 371 ++--- .../collection/productivecollectionsheet.html | 140 +- app/views/expertsearch.html | 36 +- app/views/footer.html | 2 +- app/views/groups/addmember.html | 43 +- app/views/groups/addrole.html | 12 +- app/views/groups/assignstaff.html | 10 +- app/views/groups/attachmeeting.html | 60 +- app/views/groups/closegroup.html | 18 +- app/views/groups/creategroup.html | 52 +- app/views/groups/editgroup.html | 34 +- app/views/groups/editmeeting.html | 57 +- app/views/groups/groupattendance.html | 20 +- app/views/groups/groups.html | 18 +- app/views/groups/membermanage.html | 22 +- app/views/groups/transferclients.html | 14 +- app/views/groups/viewgroup.html | 733 +++++----- app/views/header.html | 25 +- app/views/help.html | 4 +- app/views/home.html | 12 +- app/views/loans/addloancharge.html | 121 +- app/views/loans/addloancollateral.html | 79 +- app/views/loans/addloandocument.html | 78 +- app/views/loans/assignloanofficer.html | 64 +- app/views/loans/editguarantor.html | 28 +- app/views/loans/editloanaccount.html | 635 +++++---- app/views/loans/editloancharge.html | 54 +- app/views/loans/editloancollateral.html | 80 +- app/views/loans/guarantor.html | 45 +- app/views/loans/loanaccountactions.html | 296 ++-- app/views/loans/loanscreenreport.html | 34 +- app/views/loans/newjlgloanaccount.html | 823 +++++------ app/views/loans/newloanaccount.html | 619 +++++---- app/views/loans/view_loan_transaction.html | 143 +- app/views/loans/viewloanaccountdetails.html | 1198 +++++++++-------- app/views/loans/viewloancharge.html | 60 +- app/views/loans/viewloancollateral.html | 62 +- app/views/login.html | 21 +- app/views/navigation/offices.html | 689 +++++----- app/views/organization/bulkloan.html | 61 +- app/views/organization/createemployee.html | 94 +- app/views/organization/createholiday.html | 53 +- app/views/organization/createoffice.html | 115 +- app/views/organization/currencyconfig.html | 66 +- app/views/organization/editemployee.html | 122 +- app/views/organization/editholiday.html | 47 +- app/views/organization/editoffice.html | 121 +- app/views/organization/employees.html | 28 +- app/views/organization/holidays.html | 14 +- app/views/organization/managefunds.html | 31 +- app/views/organization/offices.html | 84 +- app/views/organization/viewemployee.html | 72 +- app/views/organization/viewholiday.html | 17 +- app/views/organization/viewoffice.html | 60 +- app/views/private/home_superuser.html | 8 +- app/views/products/charges.html | 28 +- app/views/products/createcharge.html | 85 +- app/views/products/createloanproduct.html | 1015 +++++++------- app/views/products/createsavingproduct.html | 1020 +++++++------- app/views/products/editcharge.html | 65 +- app/views/products/editloanproduct.html | 537 ++++---- app/views/products/editsavingproduct.html | 1022 +++++++------- app/views/products/loanproducts.html | 33 +- .../products/productmix/addproductmix.html | 25 +- .../products/productmix/editproductmix.html | 19 +- app/views/products/productmix/productmix.html | 3 +- .../products/productmix/viewproductmix.html | 11 +- app/views/products/products.html | 56 +- app/views/products/savingproducts.html | 25 +- app/views/products/viewcharge.html | 24 +- app/views/products/viewsavingproduct.html | 440 +++--- app/views/profile.html | 5 +- app/views/reports/run_reports.html | 73 +- app/views/reports/view_reports.html | 31 +- app/views/reports/xbrl.html | 230 ++-- app/views/reports/xbrlreport.html | 15 +- app/views/savings/addnewsavingscharge.html | 131 +- .../edit_saving_account_application.html | 439 +++--- .../new_saving_account_application.html | 427 +++--- app/views/savings/saving_account_actions.html | 253 ++-- .../savings/view_saving_account_details.html | 466 ++++--- .../savings/view_saving_transaction.html | 139 +- app/views/search/advsearch.html | 265 ++-- app/views/search/glresults.html | 353 ++--- app/views/system/addcode.html | 15 +- app/views/system/audit.html | 103 +- app/views/system/checkerActionPerformed.html | 2 +- app/views/system/codes.html | 11 +- app/views/system/createdatatable.html | 214 +-- app/views/system/createreport.html | 266 ++-- app/views/system/datatables.html | 27 +- app/views/system/editcode.html | 36 +- app/views/system/editdatatable.html | 233 ++-- app/views/system/editreport.html | 265 ++-- app/views/system/editschedulerjob.html | 78 +- app/views/system/makedatatableentry.html | 58 +- app/views/system/reports.html | 41 +- app/views/system/schedulerjobs.html | 69 +- app/views/system/viewMakerCheckerTask.html | 3 +- app/views/system/viewaudit.html | 3 +- app/views/system/viewcheckerinbox.html | 16 +- app/views/system/viewcode.html | 71 +- app/views/system/viewdatatable.html | 38 +- app/views/system/viewdatatableentry.html | 71 +- app/views/system/viewreport.html | 71 +- app/views/system/viewschedulerjob.html | 64 +- app/views/system/viewschedulerjobhistory.html | 36 +- app/views/tasks.html | 501 +++---- app/views/templates/createtemplate.html | 169 +-- app/views/templates/edittemplate.html | 183 +-- app/views/templates/templates.html | 28 +- app/views/templates/viewtemplate.html | 61 +- test/functional/demoTest.js | 30 +- test/functional/scenarioTest.js | 56 +- .../scenarios/role_management_scenario.js | 28 +- .../scenarios/user_authentication_scenario.js | 140 +- .../scenarios/user_management_scenario.js | 69 +- test/functional/testHelper.js | 46 +- test/functional/testInitializer.js | 22 +- .../controllers/LoginFormControllerSpec.js | 66 +- test/spec/controllers/MainControllerSpec.js | 126 +- test/spec/controllers/RoleControllerSpec.js | 32 +- test/spec/controllers/SearchControllerSpec.js | 92 +- .../client/ClientControllerSpec.js | 8 +- .../user/UserFormControllerSpec.js | 254 ++-- .../user/UserListControllerSpec.js | 10 +- .../user/UserSettingControllerSpec.js | 18 +- test/spec/directives/DialogDirectiveSpec.js | 134 +- test/spec/directives/OverlayDirectiveSpec.js | 172 +-- test/spec/models/LoggedInUserSpec.js | 34 +- test/spec/models/RoleSpec.js | 24 +- .../services/AuthenticationServiceSpec.js | 74 +- test/spec/services/HttpServiceProviderSpec.js | 164 +-- .../services/ResourceFactoryProviderSpec.js | 68 +- test/spec/services/SessionManagerSpec.js | 148 +- test/spec/specHelper.js | 34 +- 391 files changed, 25838 insertions(+), 22732 deletions(-) diff --git a/app/scripts/controllers/accounting/AccCoaController.js b/app/scripts/controllers/accounting/AccCoaController.js index 5a2dcf2c..e57356b7 100644 --- a/app/scripts/controllers/accounting/AccCoaController.js +++ b/app/scripts/controllers/accounting/AccCoaController.js @@ -1,95 +1,96 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AccCoaController: function(scope, resourceFactory,location) { - scope.coadata = []; - scope.isTreeView = false; - scope.routeTo = function(id){ - location.path('/viewglaccount/' + id); - }; +(function (module) { + mifosX.controllers = _.extend(module, { + AccCoaController: function (scope, resourceFactory, location) { + scope.coadata = []; + scope.isTreeView = false; + scope.routeTo = function (id) { + location.path('/viewglaccount/' + id); + }; - scope.deepCopy = function (obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - return obj; - } - - resourceFactory.accountCoaResource.getAllAccountCoas(function(data) { - scope.coadatas = scope.deepCopy(data); - - var assetObject = {id:-1, name:"ASSET", parentId:-999, children:[]}; - var liabilitiesObject = {id:-2, name:"LIABILITY", parentId:-999, children:[]}; - var equitiyObject = {id:-3, name:"EQUITY", parentId:-999, children:[]}; - var incomeObject = {id:-4, name:"INCOME", parentId:-999, children:[]}; - var expenseObject = {id:-5, name:"EXPENSE", parentId:-999, children:[]}; - var rootObject = {id:-999, name:"Accounting", children:[]}; - var rootArray = [rootObject, assetObject, liabilitiesObject, equitiyObject, incomeObject, expenseObject]; - - var idToNodeMap = {}; - for(var i in rootArray){ - idToNodeMap[rootArray[i].id] = rootArray[i]; - } - - for(i=0;i 0) { - scope.lastClosed = data[0].closingDate; - } - }); + resourceFactory.accountingClosureResource.get({officeId: officeId}, function (data) { + scope.accountClosures = data; + scope.lastClosed = undefined; + if (data.length > 0) { + scope.lastClosed = data[0].closingDate; + } + }); } scope.closedAccountingDetails = function (officeId) { - resourceFactory.accountingClosureResource.get({officeId:officeId}, function(data){ - scope.accountClosures = data; - }); + resourceFactory.accountingClosureResource.get({officeId: officeId}, function (data) { + scope.accountClosures = data; + }); } - } - }); - mifosX.ng.application.controller('AccountingClosureController', ['$scope', 'ResourceFactory', '$location', '$translate', '$routeParams','dateFilter', mifosX.controllers.AccountingClosureController]).run(function($log) { - $log.info("AccountingClosureController initialized"); - }); + } + }); + mifosX.ng.application.controller('AccountingClosureController', ['$scope', 'ResourceFactory', '$location', '$translate', '$routeParams', 'dateFilter', mifosX.controllers.AccountingClosureController]).run(function ($log) { + $log.info("AccountingClosureController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/AccountingRuleController.js b/app/scripts/controllers/accounting/AccountingRuleController.js index 3b9d0cf4..d0f53855 100644 --- a/app/scripts/controllers/accounting/AccountingRuleController.js +++ b/app/scripts/controllers/accounting/AccountingRuleController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AccountingRuleController: function(scope, resourceFactory, location) { - scope.routeTo = function(id){ - location.path('/viewaccrule/' + id); - }; - resourceFactory.accountingRulesResource.get(function(data){ - scope.rules = data; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + AccountingRuleController: function (scope, resourceFactory, location) { + scope.routeTo = function (id) { + location.path('/viewaccrule/' + id); + }; + resourceFactory.accountingRulesResource.get(function (data) { + scope.rules = data; + }); - } - }); - mifosX.ng.application.controller('AccountingRuleController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.AccountingRuleController]).run(function($log) { - $log.info("AccountingRuleController initialized"); - }); + } + }); + mifosX.ng.application.controller('AccountingRuleController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccountingRuleController]).run(function ($log) { + $log.info("AccountingRuleController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/accounting/JournalEntryController.js b/app/scripts/controllers/accounting/JournalEntryController.js index 0017d1dc..5ec6bb64 100644 --- a/app/scripts/controllers/accounting/JournalEntryController.js +++ b/app/scripts/controllers/accounting/JournalEntryController.js @@ -1,6 +1,6 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - JournalEntryController: function(scope, resourceFactory, location,dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + JournalEntryController: function (scope, resourceFactory, location, dateFilter) { scope.formData = {}; scope.formData.crAccounts = []; @@ -11,113 +11,113 @@ scope.creditaccounttemplate = false; scope.debitaccounttemplate = false; scope.restrictDate = new Date(); - scope.showPaymentDetails =false; - resourceFactory.accountCoaResource.getAllAccountCoas({manualEntriesAllowed:true, usage:1, disabled:false}, function(data){ - scope.glAccounts = data; + scope.showPaymentDetails = false; + resourceFactory.accountCoaResource.getAllAccountCoas({manualEntriesAllowed: true, usage: 1, disabled: false}, function (data) { + scope.glAccounts = data; }); - resourceFactory.codeValueResource.getAllCodeValues({codeId:12}, function(data){ - if(data.length > 0){ - scope.formData.paymentTypeId=data[0].id; + resourceFactory.codeValueResource.getAllCodeValues({codeId: 12}, function (data) { + if (data.length > 0) { + scope.formData.paymentTypeId = data[0].id; } scope.paymentTypes = data; }); - resourceFactory.currencyConfigResource.get({fields : 'selectedCurrencyOptions'}, function(data){ - scope.currencyOptions = data.selectedCurrencyOptions; + resourceFactory.currencyConfigResource.get({fields: 'selectedCurrencyOptions'}, function (data) { + scope.currencyOptions = data.selectedCurrencyOptions; }); - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = data; - scope.formData.officeId = scope.offices[0].id; + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + scope.formData.officeId = scope.offices[0].id; }); //events for credits scope.addCrAccount = function () { - if(scope.formData.crAmountTemplate != undefined){ - scope.errorcreditevent = false; - if (scope.formData.creditAccountTemplate) { - scope.creditaccounttemplate = false; - scope.formData.crAccounts.push({crGlAccountId: scope.formData.creditAccountTemplate.id, crGlcode: scope.formData.creditAccountTemplate.glCode, crGlName : scope.formData.creditAccountTemplate.name , crAmount : scope.formData.crAmountTemplate}); - scope.formData.crAmountTemplate = undefined; + if (scope.formData.crAmountTemplate != undefined) { + scope.errorcreditevent = false; + if (scope.formData.creditAccountTemplate) { + scope.creditaccounttemplate = false; + scope.formData.crAccounts.push({crGlAccountId: scope.formData.creditAccountTemplate.id, crGlcode: scope.formData.creditAccountTemplate.glCode, crGlName: scope.formData.creditAccountTemplate.name, crAmount: scope.formData.crAmountTemplate}); + scope.formData.crAmountTemplate = undefined; + } else { + scope.creditaccounttemplate = true; + scope.labelcrediterror = 'selectcredit'; + } } else { - scope.creditaccounttemplate = true; - scope.labelcrediterror = 'selectcredit'; + scope.errorcreditevent = true; + scope.labelcrediterror = 'requiredfield'; } - } else { - scope.errorcreditevent = true; - scope.labelcrediterror = 'requiredfield'; - } } - scope.removeCrAccount = function(index) { - scope.formData.crAccounts.splice(index,1); + scope.removeCrAccount = function (index) { + scope.formData.crAccounts.splice(index, 1); } //events for debits scope.addDebitAccount = function () { - if(scope.formData.debitAmountTemplate != undefined){ - scope.errordebitevent = false; - if (scope.formData.debitAccountTemplate) { - scope.debitaccounttemplate = false; - scope.formData.dbAccounts.push({debitGlAccountId: scope.formData.debitAccountTemplate.id, debitGlcode: scope.formData.debitAccountTemplate.glCode, debitGlName : scope.formData.debitAccountTemplate.name , debitAmount : scope.formData.debitAmountTemplate}); - scope.formData.debitAmountTemplate = undefined; + if (scope.formData.debitAmountTemplate != undefined) { + scope.errordebitevent = false; + if (scope.formData.debitAccountTemplate) { + scope.debitaccounttemplate = false; + scope.formData.dbAccounts.push({debitGlAccountId: scope.formData.debitAccountTemplate.id, debitGlcode: scope.formData.debitAccountTemplate.glCode, debitGlName: scope.formData.debitAccountTemplate.name, debitAmount: scope.formData.debitAmountTemplate}); + scope.formData.debitAmountTemplate = undefined; + } else { + scope.debitaccounttemplate = true; + scope.labeldebiterror = 'selectdebit'; + } } else { - scope.debitaccounttemplate = true; - scope.labeldebiterror = 'selectdebit'; + scope.errordebitevent = true; + scope.labeldebiterror = 'requiredfield'; } - } else { - scope.errordebitevent = true; - scope.labeldebiterror = 'requiredfield'; - } } - scope.removeDebitAccount = function(index) { - scope.formData.dbAccounts.splice(index,1); + scope.removeDebitAccount = function (index) { + scope.formData.dbAccounts.splice(index, 1); } - scope.submit = function() { - var jeTransaction = new Object(); - var reqDate = dateFilter(scope.first.date,scope.df); - jeTransaction.locale = scope.optlang.code; - jeTransaction.dateFormat = scope.df; - jeTransaction.officeId=this.formData.officeId; - jeTransaction.transactionDate = reqDate; - jeTransaction.referenceNumber = this.formData.referenceNumber; - jeTransaction.comments = this.formData.comments; - jeTransaction.currencyCode = this.formData.currencyCode; - jeTransaction.paymentTypeId = this.formData.paymentTypeId; - jeTransaction.accountNumber =this.formData.accountNumber; - jeTransaction.checkNumber = this.formData.checkNumber; - jeTransaction.routingCode = this.formData.routingCode; - jeTransaction.receiptNumber = this.formData.receiptNumber; - jeTransaction.bankNumber = this.formData.bankNumber; + scope.submit = function () { + var jeTransaction = new Object(); + var reqDate = dateFilter(scope.first.date, scope.df); + jeTransaction.locale = scope.optlang.code; + jeTransaction.dateFormat = scope.df; + jeTransaction.officeId = this.formData.officeId; + jeTransaction.transactionDate = reqDate; + jeTransaction.referenceNumber = this.formData.referenceNumber; + jeTransaction.comments = this.formData.comments; + jeTransaction.currencyCode = this.formData.currencyCode; + jeTransaction.paymentTypeId = this.formData.paymentTypeId; + jeTransaction.accountNumber = this.formData.accountNumber; + jeTransaction.checkNumber = this.formData.checkNumber; + jeTransaction.routingCode = this.formData.routingCode; + jeTransaction.receiptNumber = this.formData.receiptNumber; + jeTransaction.bankNumber = this.formData.bankNumber; - //Construct credits array - jeTransaction.credits = []; - for (var i = 0; i < this.formData.crAccounts.length; i++) { + //Construct credits array + jeTransaction.credits = []; + for (var i = 0; i < this.formData.crAccounts.length; i++) { var temp = new Object(); temp.glAccountId = this.formData.crAccounts[i].crGlAccountId; temp.amount = this.formData.crAccounts[i].crAmount; jeTransaction.credits.push(temp); - } + } - //construct debits array - jeTransaction.debits = []; - for (var i = 0; i < this.formData.dbAccounts.length; i++) { + //construct debits array + jeTransaction.debits = []; + for (var i = 0; i < this.formData.dbAccounts.length; i++) { var temp = new Object(); temp.glAccountId = this.formData.dbAccounts[i].debitGlAccountId; temp.amount = this.formData.dbAccounts[i].debitAmount; jeTransaction.debits.push(temp); - } + } - resourceFactory.journalEntriesResource.save(jeTransaction,function(data){ - location.path('/viewtransactions/'+data.transactionId); - }); + resourceFactory.journalEntriesResource.save(jeTransaction, function (data) { + location.path('/viewtransactions/' + data.transactionId); + }); } - } - }); - mifosX.ng.application.controller('JournalEntryController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.JournalEntryController]).run(function($log) { - $log.info("JournalEntryController initialized"); - }); + } + }); + mifosX.ng.application.controller('JournalEntryController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.JournalEntryController]).run(function ($log) { + $log.info("JournalEntryController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/SearchTransactionController.js b/app/scripts/controllers/accounting/SearchTransactionController.js index d0d2169b..eced1778 100644 --- a/app/scripts/controllers/accounting/SearchTransactionController.js +++ b/app/scripts/controllers/accounting/SearchTransactionController.js @@ -1,59 +1,81 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - SearchTransactionController: function(scope, resourceFactory , paginatorService,dateFilter,location) { +(function (module) { + mifosX.controllers = _.extend(module, { + SearchTransactionController: function (scope, resourceFactory, paginatorService, dateFilter, location) { - scope.filters = [{option: "All", value: ""},{option: "Manual Entries", value: true},{option: "System Entries", value: false}]; - scope.isCollapsed = true; - scope.displayResults = false; - scope.transactions = []; - scope.glAccounts = []; - scope.offices = []; - scope.date={}; - scope.formData={}; - scope.routeTo = function(id){ - location.path('/viewtransactions/' + id); - }; - resourceFactory.accountCoaResource.getAllAccountCoas({manualEntriesAllowed:true, usage:1, disabled:false}, function(data){ - scope.glAccounts = data; - }); + scope.filters = [ + {option: "All", value: ""}, + {option: "Manual Entries", value: true}, + {option: "System Entries", value: false} + ]; + scope.isCollapsed = true; + scope.displayResults = false; + scope.transactions = []; + scope.glAccounts = []; + scope.offices = []; + scope.date = {}; + scope.formData = {}; + scope.routeTo = function (id) { + location.path('/viewtransactions/' + id); + }; + resourceFactory.accountCoaResource.getAllAccountCoas({manualEntriesAllowed: true, usage: 1, disabled: false}, function (data) { + scope.glAccounts = data; + }); - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = data; - }); + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + }); - var fetchFunction = function(offset, limit, callback) { - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var params = {}; - params.offset = offset; - params.limit = limit; - params.locale = "en"; - params.dateFormat = "dd MMMM yyyy"; + var fetchFunction = function (offset, limit, callback) { + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var params = {}; + params.offset = offset; + params.limit = limit; + params.locale = "en"; + params.dateFormat = "dd MMMM yyyy"; - if (scope.formData.transactionId) { params.transactionId = scope.formData.transactionId; }; + if (scope.formData.transactionId) { + params.transactionId = scope.formData.transactionId; + } + ; - if (scope.formData.glAccount) { params.glAccountId = scope.formData.glAccount.id; }; + if (scope.formData.glAccount) { + params.glAccountId = scope.formData.glAccount.id; + } + ; - if (scope.formData.officeId) { params.officeId = scope.formData.officeId; }; + if (scope.formData.officeId) { + params.officeId = scope.formData.officeId; + } + ; - if (scope.formData.manualEntriesOnly) { params.manualEntriesOnly = scope.formData.manualEntriesOnly; }; + if (scope.formData.manualEntriesOnly) { + params.manualEntriesOnly = scope.formData.manualEntriesOnly; + } + ; - if (scope.date.first) { params.fromDate = reqFirstDate; }; + if (scope.date.first) { + params.fromDate = reqFirstDate; + } + ; - if (scope.date.second) { params.toDate = reqSecondDate; }; + if (scope.date.second) { + params.toDate = reqSecondDate; + } + ; - resourceFactory.journalEntriesResource.search(params, callback); - }; + resourceFactory.journalEntriesResource.search(params, callback); + }; - scope.searchTransaction = function () { - scope.displayResults = true; - scope.transactions = paginatorService.paginate(fetchFunction, 14); - scope.isCollapsed= true; - }; + scope.searchTransaction = function () { + scope.displayResults = true; + scope.transactions = paginatorService.paginate(fetchFunction, 14); + scope.isCollapsed = true; + }; - } - }); - mifosX.ng.application.controller('SearchTransactionController', ['$scope', 'ResourceFactory', 'PaginatorService','dateFilter','$location', mifosX.controllers.SearchTransactionController]).run(function($log) { - $log.info("SearchTransactionController initialized"); - }); + } + }); + mifosX.ng.application.controller('SearchTransactionController', ['$scope', 'ResourceFactory', 'PaginatorService', 'dateFilter', '$location', mifosX.controllers.SearchTransactionController]).run(function ($log) { + $log.info("SearchTransactionController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/accounting/ViewAccRuleController.js b/app/scripts/controllers/accounting/ViewAccRuleController.js index 6a99148e..65072bab 100644 --- a/app/scripts/controllers/accounting/ViewAccRuleController.js +++ b/app/scripts/controllers/accounting/ViewAccRuleController.js @@ -1,31 +1,31 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewAccRuleController: function(scope, resourceFactory, routeParams, location,$modal) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewAccRuleController: function (scope, resourceFactory, routeParams, location, $modal) { - resourceFactory.accountingRulesResource.getById({accountingRuleId:routeParams.id}, function(data){ - scope.rule = data; - }); - scope.deleteRule = function (){ - $modal.open({ - templateUrl: 'deleteaccrule.html', - controller: AccRuleDeleteCtrl + resourceFactory.accountingRulesResource.getById({accountingRuleId: routeParams.id}, function (data) { + scope.rule = data; }); - }; - var AccRuleDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.accountingRulesResource.delete({accountingRuleId:routeParams.id}, {}, function(data){ - location.path('/accounting_rules'); + scope.deleteRule = function () { + $modal.open({ + templateUrl: 'deleteaccrule.html', + controller: AccRuleDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var AccRuleDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.accountingRulesResource.delete({accountingRuleId: routeParams.id}, {}, function (data) { + location.path('/accounting_rules'); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewAccRuleController', ['$scope', 'ResourceFactory', '$routeParams', '$location','$modal', mifosX.controllers.ViewAccRuleController]).run(function($log) { - $log.info("ViewAccRuleController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewAccRuleController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewAccRuleController]).run(function ($log) { + $log.info("ViewAccRuleController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/accounting/ViewAccountingClosureController.js b/app/scripts/controllers/accounting/ViewAccountingClosureController.js index 6df4f827..05174eda 100644 --- a/app/scripts/controllers/accounting/ViewAccountingClosureController.js +++ b/app/scripts/controllers/accounting/ViewAccountingClosureController.js @@ -1,9 +1,9 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewAccountingClosureController: function(scope, resourceFactory, location, routeParams,$modal) { + ViewAccountingClosureController: function (scope, resourceFactory, location, routeParams, $modal) { scope.accountClosure = {}; scope.choice = 0; - resourceFactory.accountingClosureResource.getView({accId:routeParams.id}, function(data){ + resourceFactory.accountingClosureResource.getView({accId: routeParams.id}, function (data) { scope.accountClosure = data; }); scope.deleteAcc = function () { @@ -14,7 +14,7 @@ }; var AccDeleteCtrl = function ($scope, $modalInstance) { $scope.delete = function () { - resourceFactory.accountingClosureResource.delete({accId:routeParams.id},{}, function(data){ + resourceFactory.accountingClosureResource.delete({accId: routeParams.id}, {}, function (data) { location.path('/accounts_closure'); }); $modalInstance.close('delete'); @@ -26,7 +26,7 @@ } }); - mifosX.ng.application.controller('ViewAccountingClosureController', ['$scope', 'ResourceFactory', '$location','$routeParams','$modal', mifosX.controllers.ViewAccountingClosureController]).run(function($log) { + mifosX.ng.application.controller('ViewAccountingClosureController', ['$scope', 'ResourceFactory', '$location', '$routeParams', '$modal', mifosX.controllers.ViewAccountingClosureController]).run(function ($log) { $log.info("ViewAccountingClosureController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/ViewTransactionController.js b/app/scripts/controllers/accounting/ViewTransactionController.js index e312d5e1..53eee37c 100644 --- a/app/scripts/controllers/accounting/ViewTransactionController.js +++ b/app/scripts/controllers/accounting/ViewTransactionController.js @@ -1,53 +1,53 @@ -(function(module) { - mifosX.controllers = _.extend(module, { +(function (module) { + mifosX.controllers = _.extend(module, { - ViewTransactionController: function(scope, routeParams, resourceFactory, location,route, $modal) { - scope.flag=false; - resourceFactory.journalEntriesResource.get({transactionId : routeParams.transactionId}, function(data){ - scope.transactionNumber = routeParams.transactionId; - scope.transactions = data.pageItems; - for(var i in data.pageItems){ - if(data.pageItems[i].reversed==false){ - scope.flag = true; - } - } - }); - scope.confirmation = function () { - $modal.open({ - templateUrl: 'confirmation.html', - controller: ConfirmationCtrl, - resolve: { - id: function () { - return scope.trxnid; + ViewTransactionController: function (scope, routeParams, resourceFactory, location, route, $modal) { + scope.flag = false; + resourceFactory.journalEntriesResource.get({transactionId: routeParams.transactionId}, function (data) { + scope.transactionNumber = routeParams.transactionId; + scope.transactions = data.pageItems; + for (var i in data.pageItems) { + if (data.pageItems[i].reversed == false) { + scope.flag = true; } } }); - }; - - var ConfirmationCtrl = function ($scope, $modalInstance,id) { - $scope.transactionnumber = id.transactionId; - $scope.redirect = function () { - location.path('/viewtransactions/'+id.transactionId); - $modalInstance.close('delete'); + scope.confirmation = function () { + $modal.open({ + templateUrl: 'confirmation.html', + controller: ConfirmationCtrl, + resolve: { + id: function () { + return scope.trxnid; + } + } + }); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + + var ConfirmationCtrl = function ($scope, $modalInstance, id) { + $scope.transactionnumber = id.transactionId; + $scope.redirect = function () { + location.path('/viewtransactions/' + id.transactionId); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - scope.reverseTransaction = function (transactionId) { + scope.reverseTransaction = function (transactionId) { - resourceFactory.journalEntriesResource.reverse({transactionId : transactionId},function(data){ - scope.trxnid = data; - scope.confirmation(); + resourceFactory.journalEntriesResource.reverse({transactionId: transactionId}, function (data) { + scope.trxnid = data; + scope.confirmation(); - route.reload(); + route.reload(); - }); - } + }); + } - } - }); - mifosX.ng.application.controller('ViewTransactionController', ['$scope', '$routeParams', 'ResourceFactory', '$location','$route','$modal', mifosX.controllers.ViewTransactionController]).run(function($log) { - $log.info("ViewTransactionController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewTransactionController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', '$modal', mifosX.controllers.ViewTransactionController]).run(function ($log) { + $log.info("ViewTransactionController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounttransfers/MakeAccountTransferController.js b/app/scripts/controllers/accounttransfers/MakeAccountTransferController.js index d8ffeb42..add7d8a3 100644 --- a/app/scripts/controllers/accounttransfers/MakeAccountTransferController.js +++ b/app/scripts/controllers/accounttransfers/MakeAccountTransferController.js @@ -1,56 +1,56 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - MakeAccountTransferController: function(scope, resourceFactory, location, routeParams, dateFilter) { - scope.restrictDate = new Date(); - var params = {fromAccountId : routeParams.accountId}; - var accountType = routeParams.accountType || ''; - if (accountType == 'fromsavings') params.fromAccountType = 2; - else if (accountType == 'fromloans') params.fromAccountType = 1; - else params.fromAccountType = 0; +(function (module) { + mifosX.controllers = _.extend(module, { + MakeAccountTransferController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.restrictDate = new Date(); + var params = {fromAccountId: routeParams.accountId}; + var accountType = routeParams.accountType || ''; + if (accountType == 'fromsavings') params.fromAccountType = 2; + else if (accountType == 'fromloans') params.fromAccountType = 1; + else params.fromAccountType = 0; - scope.toOffices = []; - scope.toClients = []; - scope.toAccountTypes = []; - scope.toAccounts = []; + scope.toOffices = []; + scope.toClients = []; + scope.toAccountTypes = []; + scope.toAccounts = []; - scope.formData = {fromAccountId:params.fromAccountId, fromAccountType:params.fromAccountType}; - resourceFactory.accountTransfersTemplateResource.get(params, function(data){ - scope.transfer = data; - scope.toOffices = data.toOfficeOptions; - scope.toAccountTypes = data.toAccountTypeOptions; - scope.formData.transferAmount = data.transferAmount; - }); + scope.formData = {fromAccountId: params.fromAccountId, fromAccountType: params.fromAccountType}; + resourceFactory.accountTransfersTemplateResource.get(params, function (data) { + scope.transfer = data; + scope.toOffices = data.toOfficeOptions; + scope.toAccountTypes = data.toAccountTypeOptions; + scope.formData.transferAmount = data.transferAmount; + }); - scope.changeEvent = function () { - - var params = scope.formData; - delete params.transferAmount; - delete params.transferDate; - delete params.transferDescription; + scope.changeEvent = function () { - resourceFactory.accountTransfersTemplateResource.get(params, function(data){ - scope.transfer = data; - scope.toOffices = data.toOfficeOptions; - scope.toAccountTypes = data.toAccountTypeOptions; - scope.toClients = data.toClientOptions; - scope.toAccounts = data.toAccountOptions; - scope.formData.transferAmount = data.transferAmount; - }); - }; + var params = scope.formData; + delete params.transferAmount; + delete params.transferDate; + delete params.transferDescription; - scope.submit = function() { - this.formData.locale = "en"; - this.formData.dateFormat = "dd MMMM yyyy"; - if (this.formData.transferDate) this.formData.transferDate = dateFilter(this.formData.transferDate,scope.df); - this.formData.fromClientId = scope.transfer.fromClient.id; - this.formData.fromOfficeId = scope.transfer.fromClient.officeId; - resourceFactory.accountTransferResource.save(this.formData,function(data){ - location.path('/viewsavingaccount/' + data.savingsId); - }); - }; - } - }); - mifosX.ng.application.controller('MakeAccountTransferController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.MakeAccountTransferController]).run(function($log) { - $log.info("MakeAccountTransferController initialized"); - }); + resourceFactory.accountTransfersTemplateResource.get(params, function (data) { + scope.transfer = data; + scope.toOffices = data.toOfficeOptions; + scope.toAccountTypes = data.toAccountTypeOptions; + scope.toClients = data.toClientOptions; + scope.toAccounts = data.toAccountOptions; + scope.formData.transferAmount = data.transferAmount; + }); + }; + + scope.submit = function () { + this.formData.locale = "en"; + this.formData.dateFormat = "dd MMMM yyyy"; + if (this.formData.transferDate) this.formData.transferDate = dateFilter(this.formData.transferDate, scope.df); + this.formData.fromClientId = scope.transfer.fromClient.id; + this.formData.fromOfficeId = scope.transfer.fromClient.officeId; + resourceFactory.accountTransferResource.save(this.formData, function (data) { + location.path('/viewsavingaccount/' + data.savingsId); + }); + }; + } + }); + mifosX.ng.application.controller('MakeAccountTransferController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.MakeAccountTransferController]).run(function ($log) { + $log.info("MakeAccountTransferController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/accounttransfers/ViewAccountTransferDetailsController.js b/app/scripts/controllers/accounttransfers/ViewAccountTransferDetailsController.js index e98cd8c7..06a5a221 100644 --- a/app/scripts/controllers/accounttransfers/ViewAccountTransferDetailsController.js +++ b/app/scripts/controllers/accounttransfers/ViewAccountTransferDetailsController.js @@ -1,13 +1,13 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewAccountTransferDetailsController: function(scope, resourceFactory, location, routeParams) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewAccountTransferDetailsController: function (scope, resourceFactory, location, routeParams) { - resourceFactory.accountTransferResource.get({transferId:routeParams.id}, function(data){ - scope.transferData = data; - }); - } - }); - mifosX.ng.application.controller('ViewAccountTransferDetailsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.ViewAccountTransferDetailsController]).run(function($log) { - $log.info("ViewAccountTransferDetailsController initialized"); - }); + resourceFactory.accountTransferResource.get({transferId: routeParams.id}, function (data) { + scope.transferData = data; + }); + } + }); + mifosX.ng.application.controller('ViewAccountTransferDetailsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.ViewAccountTransferDetailsController]).run(function ($log) { + $log.info("ViewAccountTransferDetailsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/centers/AddGroupController.js b/app/scripts/controllers/centers/AddGroupController.js index 04f10116..43fb889c 100644 --- a/app/scripts/controllers/centers/AddGroupController.js +++ b/app/scripts/controllers/centers/AddGroupController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddGroupController: function(scope, resourceFactory, location, routeParams,dateFilter) { + AddGroupController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.first = {}; scope.restrictDate = new Date(); scope.addedClients = []; @@ -8,73 +8,69 @@ scope.added = []; scope.formData = {}; scope.formData.clientMembers = []; - resourceFactory.groupTemplateResource.get({centerId: routeParams.centerId} , function(data) { + resourceFactory.groupTemplateResource.get({centerId: routeParams.centerId}, function (data) { scope.groupTemplate = data; scope.clients = data.clientOptions; }); - scope.setChoice = function(){ - if(this.formData.active){ + scope.setChoice = function () { + if (this.formData.active) { scope.choice = 1; } - else if(!this.formData.active){ + else if (!this.formData.active) { scope.choice = 0; } }; - scope.add = function(){ - for(var i in this.available) - { - for(var j in scope.clients){ - if(scope.clients[j].id == this.available[i]) - { + scope.add = function () { + for (var i in this.available) { + for (var j in scope.clients) { + if (scope.clients[j].id == this.available[i]) { var temp = {}; temp.id = this.available[i]; temp.displayName = scope.clients[j].displayName; scope.addedClients.push(temp); - scope.clients.splice(j,1); + scope.clients.splice(j, 1); } } } }; - scope.sub = function(){ - for(var i in this.added) - { - for(var j in scope.addedClients){ - if(scope.addedClients[j].id == this.added[i]) - { + scope.sub = function () { + for (var i in this.added) { + for (var j in scope.addedClients) { + if (scope.addedClients[j].id == this.added[i]) { var temp = {}; temp.id = this.added[i]; temp.displayName = scope.addedClients[j].displayName; scope.clients.push(temp); - scope.addedClients.splice(j,1); + scope.addedClients.splice(j, 1); } } } }; - scope.submit = function(){ - for(var i in scope.addedClients){ + scope.submit = function () { + for (var i in scope.addedClients) { scope.formData.clientMembers[i] = scope.addedClients[i].id; } if (this.formData.active) { - var reqDate = dateFilter(scope.first.date,scope.df); + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.activationDate = reqDate; } if (scope.first.submitondate) { - this.formData.submittedOnDate = dateFilter(scope.first.submitondate,scope.df); + this.formData.submittedOnDate = dateFilter(scope.first.submitondate, scope.df); } this.formData.dateFormat = scope.df; this.formData.active = this.formData.active || false; this.formData.locale = scope.optlang.code; - this.formData.centerId = routeParams.centerId ; + this.formData.centerId = routeParams.centerId; this.formData.officeId = routeParams.officeId; - resourceFactory.groupResource.save(this.formData,function(data) { - location.path('/viewcenter/'+routeParams.centerId); + resourceFactory.groupResource.save(this.formData, function (data) { + location.path('/viewcenter/' + routeParams.centerId); }); }; } }); - mifosX.ng.application.controller('AddGroupController', ['$scope', 'ResourceFactory', '$location','$routeParams','dateFilter', mifosX.controllers.AddGroupController]).run(function($log) { + mifosX.ng.application.controller('AddGroupController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.AddGroupController]).run(function ($log) { $log.info("AddGroupController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/centers/CenterAttendanceController.js b/app/scripts/controllers/centers/CenterAttendanceController.js index 7edd8f90..551c3629 100644 --- a/app/scripts/controllers/centers/CenterAttendanceController.js +++ b/app/scripts/controllers/centers/CenterAttendanceController.js @@ -1,40 +1,39 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CenterAttendanceController: function(scope, resourceFactory , routeParams, location,dateFilter) { + CenterAttendanceController: function (scope, resourceFactory, routeParams, location, dateFilter) { scope.center = []; scope.tempData = {}; scope.formData = {}; scope.first = {}; scope.first.date = new Date(); - resourceFactory.centerResource.get({centerId: routeParams.centerId, associations:'groupMembers,collectionMeetingCalendar'} , function(data) { + resourceFactory.centerResource.get({centerId: routeParams.centerId, associations: 'groupMembers,collectionMeetingCalendar'}, function (data) { scope.center = data; scope.meeting = data.collectionMeetingCalendar; }); - resourceFactory.centerMeetingResource.getMeetingInfo({centerId: routeParams.centerId,templateSource: 'template',calenderId: routeParams.calendarId}, function(data) { + resourceFactory.centerMeetingResource.getMeetingInfo({centerId: routeParams.centerId, templateSource: 'template', calenderId: routeParams.calendarId}, function (data) { scope.clients = data.clients; scope.attendanceOptions = data.attendanceTypeOptions; }); - scope.attendanceUpdate = function(id){ - var reqDate = dateFilter(scope.first.date,scope.df); + scope.attendanceUpdate = function (id) { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.meetingDate = reqDate; - this.formData.clientsAttendance=[]; - for(var i=0; i 0 ? true : false; scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; scope.singleRow = []; - for(var i in data.columnHeaders) { + for (var i in data.columnHeaders) { if (scope.datatabledetails.columnHeaders[i].columnCode) { - for (var j in scope.datatabledetails.columnHeaders[i].columnValues){ - for(var k in data.data) { + for (var j in scope.datatabledetails.columnHeaders[i].columnValues) { + for (var k in data.data) { if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; } } } - } - } - if(scope.datatabledetails.isData){ - for(var i in data.columnHeaders){ - if(!scope.datatabledetails.isMultirow){ - var row = {}; - row.key = data.columnHeaders[i].columnName; - row.value = data.data[0].row[i]; - scope.singleRow.push(row); } - } } + } + if (scope.datatabledetails.isData) { + for (var i in data.columnHeaders) { + if (!scope.datatabledetails.isMultirow) { + var row = {}; + row.key = data.columnHeaders[i].columnName; + row.value = data.data[0].row[i]; + scope.singleRow.push(row); + } + } + } }); }; scope.deleteAll = function (apptableName, entityId) { - resourceFactory.DataTablesResource.delete({datatablename:apptableName, entityId:entityId, genericResultSet:'true'}, {}, function(data){ + resourceFactory.DataTablesResource.delete({datatablename: apptableName, entityId: entityId, genericResultSet: 'true'}, {}, function (data) { route.reload(); }); }; } }); - mifosX.ng.application.controller('ViewCenterController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory','$modal', mifosX.controllers.ViewCenterController]).run(function($log) { + mifosX.ng.application.controller('ViewCenterController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', '$modal', mifosX.controllers.ViewCenterController]).run(function ($log) { $log.info("ViewCenterController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/ClientActionsController.js b/app/scripts/controllers/client/ClientActionsController.js index e0cfddeb..35cd5df5 100644 --- a/app/scripts/controllers/client/ClientActionsController.js +++ b/app/scripts/controllers/client/ClientActionsController.js @@ -1,131 +1,131 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ClientActionsController: function(scope, resourceFactory, location, routeParams, dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + ClientActionsController: function (scope, resourceFactory, location, routeParams, dateFilter) { - scope.action = routeParams.action || ""; - scope.clientId = routeParams.id; - scope.formData = {}; - scope.restrictDate = new Date(); + scope.action = routeParams.action || ""; + scope.clientId = routeParams.id; + scope.formData = {}; + scope.restrictDate = new Date(); - // Transaction UI Related + // Transaction UI Related - switch (scope.action) { - case "activate": - resourceFactory.clientResource.get({clientId: routeParams.id} , function(data) { - scope.client = data; - if (data.timeline.submittedOnDate) { - scope.mindate = new Date(data.timeline.submittedOnDate); + switch (scope.action) { + case "activate": + resourceFactory.clientResource.get({clientId: routeParams.id}, function (data) { + scope.client = data; + if (data.timeline.submittedOnDate) { + scope.mindate = new Date(data.timeline.submittedOnDate); + } + }); + scope.labelName = 'label.input.activationdate'; + scope.breadcrumbName = 'label.anchor.activate'; + scope.modelName = 'activationDate'; + scope.showActivationDateField = true; + scope.showDateField = false; + break; + case "assignstaff": + scope.breadcrumbName = 'label.anchor.assignstaff'; + scope.labelName = 'label.input.staff'; + scope.staffField = true; + resourceFactory.clientResource.get({clientId: routeParams.id, template: 'true'}, function (data) { + if (data.staffOptions) { + scope.staffOptions = data.staffOptions; + scope.formData.staffId = scope.staffOptions[0].id; + } + }); + break; + case "close": + scope.labelName = 'label.input.closuredate'; + scope.labelNameClosurereason = 'label.input.closurereason'; + scope.breadcrumbName = 'label.anchor.close'; + scope.modelName = 'closureDate'; + scope.closureReasonField = true; + scope.showDateField = true; + resourceFactory.clientResource.get({anotherresource: 'template', commandParam: 'close'}, function (data) { + scope.closureReasons = data.closureReasons; + scope.formData.closureReasonId = scope.closureReasons[0].id; + }); + break; + case "delete": + scope.breadcrumbName = 'label.anchor.delete'; + scope.labelName = 'label.areyousure'; + scope.showDeleteClient = true; + break; + case "unassignstaff": + scope.labelName = 'label.areyousure'; + scope.showDeleteClient = true; + break; + case "acceptclienttransfer": + scope.showNoteField = true; + break; + case "rejecttransfer": + scope.showNoteField = true; + break; + case "undotransfer": + scope.showNoteField = true; + break; + } + + scope.cancel = function () { + location.path('/viewclient/' + routeParams.id); + } + + scope.submit = function () { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + if (this.formData[scope.modelName]) { + this.formData[scope.modelName] = dateFilter(this.formData[scope.modelName], scope.df); } - }); - scope.labelName = 'label.input.activationdate'; - scope.breadcrumbName = 'label.anchor.activate'; - scope.modelName = 'activationDate'; - scope.showActivationDateField = true; - scope.showDateField = false; - break; - case "assignstaff": - scope.breadcrumbName = 'label.anchor.assignstaff'; - scope.labelName = 'label.input.staff'; - scope.staffField = true; - resourceFactory.clientResource.get({clientId: routeParams.id, template : 'true'},function(data){ - if (data.staffOptions) { - scope.staffOptions = data.staffOptions; - scope.formData.staffId = scope.staffOptions[0].id; - } - }); - break; - case "close": - scope.labelName = 'label.input.closuredate'; - scope.labelNameClosurereason = 'label.input.closurereason'; - scope.breadcrumbName = 'label.anchor.close'; - scope.modelName = 'closureDate'; - scope.closureReasonField = true; - scope.showDateField = true; - resourceFactory.clientResource.get({anotherresource: 'template', commandParam : 'close'} , function(data) { - scope.closureReasons = data.closureReasons; - scope.formData.closureReasonId = scope.closureReasons[0].id; - }); - break; - case "delete": - scope.breadcrumbName = 'label.anchor.delete'; - scope.labelName = 'label.areyousure'; - scope.showDeleteClient = true; - break; - case "unassignstaff": - scope.labelName = 'label.areyousure'; - scope.showDeleteClient = true; - break; - case "acceptclienttransfer": - scope.showNoteField = true; - break; - case "rejecttransfer": - scope.showNoteField = true; - break; - case "undotransfer": - scope.showNoteField = true; - break; + + if (scope.action == "activate") { + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'activate'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "assignstaff") { + delete this.formData.locale; + delete this.formData.dateFormat; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'assignStaff'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "unassignstaff") { + delete this.formData.locale; + delete this.formData.dateFormat; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'unassignstaff'}, {staffId: routeParams.staffId}, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "close") { + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'close'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "acceptclienttransfer") { + delete this.formData.locale; + delete this.formData.dateFormat; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'acceptTransfer'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "rejecttransfer") { + delete this.formData.locale; + delete this.formData.dateFormat; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'rejectTransfer'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + if (scope.action == "undotransfer") { + delete this.formData.locale; + delete this.formData.dateFormat; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'withdrawTransfer'}, this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + } + }; } - - scope.cancel = function() { - location.path('/viewclient/' + routeParams.id); - } - - scope.submit = function() { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - if (this.formData[scope.modelName]) { - this.formData[scope.modelName] = dateFilter(this.formData[scope.modelName],scope.df); - } - - if (scope.action == "activate") { - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'activate'}, this.formData,function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "assignstaff") { - delete this.formData.locale; - delete this.formData.dateFormat; - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'assignStaff'}, this.formData,function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "unassignstaff") { - delete this.formData.locale; - delete this.formData.dateFormat; - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'unassignstaff'}, {staffId:routeParams.staffId},function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "close") { - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'close'}, this.formData,function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "acceptclienttransfer") { - delete this.formData.locale; - delete this.formData.dateFormat; - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'acceptTransfer'}, this.formData, function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "rejecttransfer") { - delete this.formData.locale; - delete this.formData.dateFormat; - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'rejectTransfer'}, this.formData, function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - if (scope.action == "undotransfer") { - delete this.formData.locale; - delete this.formData.dateFormat; - resourceFactory.clientResource.save({clientId: routeParams.id, command : 'withdrawTransfer'}, this.formData, function(data){ - location.path('/viewclient/' + data.clientId); - }); - } - }; - } - }); - mifosX.ng.application.controller('ClientActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ClientActionsController]).run(function($log) { - $log.info("ClientActionsController initialized"); - }); + }); + mifosX.ng.application.controller('ClientActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ClientActionsController]).run(function ($log) { + $log.info("ClientActionsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/ClientController.js b/app/scripts/controllers/client/ClientController.js index ad4f25f0..8ce77ad6 100644 --- a/app/scripts/controllers/client/ClientController.js +++ b/app/scripts/controllers/client/ClientController.js @@ -1,20 +1,20 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ClientController: function(scope, resourceFactory, paginatorService, location) { - - scope.clients = []; - scope.routeTo = function(id){ - location.path('/viewclient/'+ id); - }; +(function (module) { + mifosX.controllers = _.extend(module, { + ClientController: function (scope, resourceFactory, paginatorService, location) { - var fetchFunction = function(offset, limit, callback) { - resourceFactory.clientResource.getAllClients({offset: offset, limit: limit} , callback); - }; - - scope.clients = paginatorService.paginate(fetchFunction, 14); - } - }); - mifosX.ng.application.controller('ClientController', ['$scope', 'ResourceFactory', 'PaginatorService','$location', mifosX.controllers.ClientController]).run(function($log) { - $log.info("ClientController initialized"); - }); + scope.clients = []; + scope.routeTo = function (id) { + location.path('/viewclient/' + id); + }; + + var fetchFunction = function (offset, limit, callback) { + resourceFactory.clientResource.getAllClients({offset: offset, limit: limit}, callback); + }; + + scope.clients = paginatorService.paginate(fetchFunction, 14); + } + }); + mifosX.ng.application.controller('ClientController', ['$scope', 'ResourceFactory', 'PaginatorService', '$location', mifosX.controllers.ClientController]).run(function ($log) { + $log.info("ClientController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/ClientDocumentController.js b/app/scripts/controllers/client/ClientDocumentController.js index a4f2fabd..221956c9 100644 --- a/app/scripts/controllers/client/ClientDocumentController.js +++ b/app/scripts/controllers/client/ClientDocumentController.js @@ -1,27 +1,27 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ClientDocumentController: function(scope, location, http, routeParams, API_VERSION,$upload,$rootScope) { - scope.clientId = routeParams.clientId; - scope.onFileSelect = function($files) { - scope.file = $files[0]; - }; +(function (module) { + mifosX.controllers = _.extend(module, { + ClientDocumentController: function (scope, location, http, routeParams, API_VERSION, $upload, $rootScope) { + scope.clientId = routeParams.clientId; + scope.onFileSelect = function ($files) { + scope.file = $files[0]; + }; - scope.submit = function () { - $upload.upload({ - url: $rootScope.hostUrl + API_VERSION + '/clients/'+scope.clientId+'/documents', - data: scope.formData, - file: scope.file - }).then(function(data) { - // to fix IE not refreshing the model - if (!scope.$$phase) { - scope.$apply(); - } - location.path('/viewclient/'+scope.clientId); - }); - }; - } - }); - mifosX.ng.application.controller('ClientDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION','$upload','$rootScope', mifosX.controllers.ClientDocumentController]).run(function($log) { - $log.info("ClientDocumentController initialized"); - }); + scope.submit = function () { + $upload.upload({ + url: $rootScope.hostUrl + API_VERSION + '/clients/' + scope.clientId + '/documents', + data: scope.formData, + file: scope.file + }).then(function (data) { + // to fix IE not refreshing the model + if (!scope.$$phase) { + scope.$apply(); + } + location.path('/viewclient/' + scope.clientId); + }); + }; + } + }); + mifosX.ng.application.controller('ClientDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.ClientDocumentController]).run(function ($log) { + $log.info("ClientDocumentController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/client/ClientIdentifierController.js b/app/scripts/controllers/client/ClientIdentifierController.js index b3d2ba86..96af05da 100644 --- a/app/scripts/controllers/client/ClientIdentifierController.js +++ b/app/scripts/controllers/client/ClientIdentifierController.js @@ -1,23 +1,23 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ClientIdentifierController: function(scope, routeParams , location, resourceFactory) { + ClientIdentifierController: function (scope, routeParams, location, resourceFactory) { scope.clientId = routeParams.clientId; scope.formData = {}; scope.documenttypes = []; - resourceFactory.clientIdenfierTemplateResource.get({clientId: routeParams.clientId}, function(data) { + resourceFactory.clientIdenfierTemplateResource.get({clientId: routeParams.clientId}, function (data) { scope.documenttypes = data.allowedDocumentTypes; scope.formData.documentTypeId = data.allowedDocumentTypes[0].id; }); scope.submit = function () { - resourceFactory.clientIdenfierResource.save({clientId:scope.clientId},this.formData,function(data){ + resourceFactory.clientIdenfierResource.save({clientId: scope.clientId}, this.formData, function (data) { location.path('/viewclient/' + data.clientId); }); }; } }); - mifosX.ng.application.controller('ClientIdentifierController', ['$scope', '$routeParams', '$location', 'ResourceFactory', mifosX.controllers.ClientIdentifierController]).run(function($log) { + mifosX.ng.application.controller('ClientIdentifierController', ['$scope', '$routeParams', '$location', 'ResourceFactory', mifosX.controllers.ClientIdentifierController]).run(function ($log) { $log.info("ClientIdentifierController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/ClientScreenReportController.js b/app/scripts/controllers/client/ClientScreenReportController.js index 39320e08..461c4654 100644 --- a/app/scripts/controllers/client/ClientScreenReportController.js +++ b/app/scripts/controllers/client/ClientScreenReportController.js @@ -1,32 +1,32 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ClientScreenReportController: function(scope, resourceFactory, location, $http, API_VERSION, routeParams,$rootScope) { - resourceFactory.templateResource.get({entityId : 0, typeId : 0}, function(data) { - scope.clientTemplateData = data; - }); - scope.print = function(template){ - var templateWindow = window.open('', 'Screen Report', 'height=400,width=600'); - templateWindow.document.write(''); - templateWindow.document.write(''); - templateWindow.document.write(template); - templateWindow.document.write(''); - templateWindow.print(); - templateWindow.close(); - }; +(function (module) { + mifosX.controllers = _.extend(module, { + ClientScreenReportController: function (scope, resourceFactory, location, $http, API_VERSION, routeParams, $rootScope) { + resourceFactory.templateResource.get({entityId: 0, typeId: 0}, function (data) { + scope.clientTemplateData = data; + }); + scope.print = function (template) { + var templateWindow = window.open('', 'Screen Report', 'height=400,width=600'); + templateWindow.document.write(''); + templateWindow.document.write(''); + templateWindow.document.write(template); + templateWindow.document.write(''); + templateWindow.print(); + templateWindow.close(); + }; - scope.getClientTemplate = function(templateId) { - scope.selectedTemplate = templateId; - $http({ - method:'POST', - url: $rootScope.hostUrl + API_VERSION + '/templates/'+templateId+'?clientId='+routeParams.clientId, - data: {} - }).then(function(data) { - scope.template = data.data; - }); - }; - } - }); - mifosX.ng.application.controller('ClientScreenReportController', ['$scope', 'ResourceFactory', '$location','$http', 'API_VERSION', '$routeParams','$rootScope', mifosX.controllers.ClientScreenReportController]).run(function($log) { - $log.info("ClientScreenReportController initialized"); - }); + scope.getClientTemplate = function (templateId) { + scope.selectedTemplate = templateId; + $http({ + method: 'POST', + url: $rootScope.hostUrl + API_VERSION + '/templates/' + templateId + '?clientId=' + routeParams.clientId, + data: {} + }).then(function (data) { + scope.template = data.data; + }); + }; + } + }); + mifosX.ng.application.controller('ClientScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', mifosX.controllers.ClientScreenReportController]).run(function ($log) { + $log.info("ClientScreenReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/CreateClientController.js b/app/scripts/controllers/client/CreateClientController.js index 4b717fc0..95a09af8 100644 --- a/app/scripts/controllers/client/CreateClientController.js +++ b/app/scripts/controllers/client/CreateClientController.js @@ -1,66 +1,66 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateClientController: function(scope, resourceFactory, location, http, dateFilter, API_VERSION,$upload,$rootScope) { - scope.offices = []; - scope.staffs = []; - scope.savingproducts = []; - scope.first = {}; - scope.first.date = new Date(); - scope.formData = {}; - scope.restrictDate = new Date(); - scope.showSavingOptions = false; - scope.opensavingsproduct = false; - resourceFactory.clientTemplateResource.get(function(data) { - scope.offices = data.officeOptions; - scope.staffs = data.staffOptions; - scope.formData.officeId = scope.offices[0].id; - scope.savingproducts = data.savingProductOptions; - if(data.savingProductOptions.length > 0){ - scope.showSavingOptions = true; - } - }); - - scope.changeOffice =function(officeId) { - resourceFactory.clientTemplateResource.get({staffInSelectedOfficeOnly : false, officeId : officeId - }, function(data) { - scope.staffs = data.staffOptions; - scope.savingproducts = data.savingProductOptions; - }); - }; - - scope.setChoice = function(){ - if(this.formData.active){ - scope.choice = 1; - } - else if(!this.formData.active){ - scope.choice = 0; - } - }; - - scope.submit = function() { - var reqDate = dateFilter(scope.first.date,scope.df); - - this.formData.locale = scope.optlang.code; - this.formData.active = this.formData.active || false; - this.formData.dateFormat = scope.df; - this.formData.activationDate = reqDate; - - if (scope.first.submitondate) { - reqDate = dateFilter(scope.first.submitondate,scope.df); - this.formData.submittedOnDate = reqDate; - } - - if(!scope.opensavingsproduct){ - this.formData.savingsProductId = null; - } - - resourceFactory.clientResource.save(this.formData,function(data){ - location.path('/viewclient/' + data.clientId); +(function (module) { + mifosX.controllers = _.extend(module, { + CreateClientController: function (scope, resourceFactory, location, http, dateFilter, API_VERSION, $upload, $rootScope) { + scope.offices = []; + scope.staffs = []; + scope.savingproducts = []; + scope.first = {}; + scope.first.date = new Date(); + scope.formData = {}; + scope.restrictDate = new Date(); + scope.showSavingOptions = false; + scope.opensavingsproduct = false; + resourceFactory.clientTemplateResource.get(function (data) { + scope.offices = data.officeOptions; + scope.staffs = data.staffOptions; + scope.formData.officeId = scope.offices[0].id; + scope.savingproducts = data.savingProductOptions; + if (data.savingProductOptions.length > 0) { + scope.showSavingOptions = true; + } }); - }; - } - }); - mifosX.ng.application.controller('CreateClientController', ['$scope', 'ResourceFactory', '$location', '$http', 'dateFilter', 'API_VERSION','$upload','$rootScope', mifosX.controllers.CreateClientController]).run(function($log) { - $log.info("CreateClientController initialized"); - }); + + scope.changeOffice = function (officeId) { + resourceFactory.clientTemplateResource.get({staffInSelectedOfficeOnly: false, officeId: officeId + }, function (data) { + scope.staffs = data.staffOptions; + scope.savingproducts = data.savingProductOptions; + }); + }; + + scope.setChoice = function () { + if (this.formData.active) { + scope.choice = 1; + } + else if (!this.formData.active) { + scope.choice = 0; + } + }; + + scope.submit = function () { + var reqDate = dateFilter(scope.first.date, scope.df); + + this.formData.locale = scope.optlang.code; + this.formData.active = this.formData.active || false; + this.formData.dateFormat = scope.df; + this.formData.activationDate = reqDate; + + if (scope.first.submitondate) { + reqDate = dateFilter(scope.first.submitondate, scope.df); + this.formData.submittedOnDate = reqDate; + } + + if (!scope.opensavingsproduct) { + this.formData.savingsProductId = null; + } + + resourceFactory.clientResource.save(this.formData, function (data) { + location.path('/viewclient/' + data.clientId); + }); + }; + } + }); + mifosX.ng.application.controller('CreateClientController', ['$scope', 'ResourceFactory', '$location', '$http', 'dateFilter', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.CreateClientController]).run(function ($log) { + $log.info("CreateClientController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/EditClientController.js b/app/scripts/controllers/client/EditClientController.js index 17fcc533..9d8340b2 100644 --- a/app/scripts/controllers/client/EditClientController.js +++ b/app/scripts/controllers/client/EditClientController.js @@ -1,63 +1,65 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditClientController: function(scope, routeParams, resourceFactory, location, http, dateFilter, API_VERSION,$upload,$rootScope) { - scope.offices = []; - scope.date = {}; - scope.restrictDate = new Date(); - scope.savingproducts = []; - scope.clientId = routeParams.id; - scope.showSavingOptions = 'false'; - scope.opensavingsproduct = 'false'; - resourceFactory.clientResource.get({clientId: routeParams.id, template: 'true'} , function(data) { - scope.offices = data.officeOptions; - scope.staffs = data.staffOptions; - scope.savingproducts = data.savingProductOptions; - scope.officeId = data.officeId; - scope.formData = { - firstname : data.firstname, - lastname : data.lastname, - middlename : data.middlename, - active : data.active, - accountNo : data.accountNo, - staffId : data.staffId, - externalId: data.externalId, - mobileNo : data.mobileNo, - savingsProductId : data.savingsProductId +(function (module) { + mifosX.controllers = _.extend(module, { + EditClientController: function (scope, routeParams, resourceFactory, location, http, dateFilter, API_VERSION, $upload, $rootScope) { + scope.offices = []; + scope.date = {}; + scope.restrictDate = new Date(); + scope.savingproducts = []; + scope.clientId = routeParams.id; + scope.showSavingOptions = 'false'; + scope.opensavingsproduct = 'false'; + resourceFactory.clientResource.get({clientId: routeParams.id, template: 'true'}, function (data) { + scope.offices = data.officeOptions; + scope.staffs = data.staffOptions; + scope.savingproducts = data.savingProductOptions; + scope.officeId = data.officeId; + scope.formData = { + firstname: data.firstname, + lastname: data.lastname, + middlename: data.middlename, + active: data.active, + accountNo: data.accountNo, + staffId: data.staffId, + externalId: data.externalId, + mobileNo: data.mobileNo, + savingsProductId: data.savingsProductId + }; + + if (data.savingsProductId != null) { + scope.opensavingsproduct = 'true'; + scope.showSavingOptions = 'true'; + } else if (data.savingProductOptions.length > 0) { + scope.showSavingOptions = 'true'; + } + + var actDate = dateFilter(data.activationDate, scope.df); + scope.date.activationDate = new Date(actDate); + if (data.active) { + scope.choice = 1; + scope.showSavingOptions = 'false'; + scope.opensavingsproduct = 'false'; + } + + }); + scope.submit = function () { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + if (scope.opensavingsproduct == 'false') { + this.formData.savingsProductId = null; + } + if (scope.choice === 1) { + if (scope.date.activationDate) { + this.formData.activationDate = dateFilter(scope.date.activationDate, scope.df); + } + } + + resourceFactory.clientResource.update({'clientId': routeParams.id}, this.formData, function (data) { + location.path('/viewclient/' + routeParams.id); + }); }; - - if(data.savingsProductId != null){ - scope.opensavingsproduct = 'true'; - scope.showSavingOptions = 'true'; - }else if(data.savingProductOptions.length > 0){ - scope.showSavingOptions = 'true'; - } - - var actDate = dateFilter(data.activationDate,scope.df); - scope.date.activationDate = new Date(actDate); - if(data.active){ - scope.choice = 1; - scope.showSavingOptions = 'false'; - scope.opensavingsproduct = 'false'; - } - - }); - scope.submit = function() { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - if(scope.opensavingsproduct == 'false'){ - this.formData.savingsProductId = null; - } - if (scope.choice === 1) { - if(scope.date.activationDate){this.formData.activationDate = dateFilter(scope.date.activationDate,scope.df);} - } - - resourceFactory.clientResource.update({'clientId': routeParams.id},this.formData,function(data){ - location.path('/viewclient/' + routeParams.id); - }); - }; - } - }); - mifosX.ng.application.controller('EditClientController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$http','dateFilter', 'API_VERSION','$upload','$rootScope', mifosX.controllers.EditClientController]).run(function($log) { - $log.info("EditClientController initialized"); - }); + } + }); + mifosX.ng.application.controller('EditClientController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$http', 'dateFilter', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.EditClientController]).run(function ($log) { + $log.info("EditClientController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/TransactionClientController.js b/app/scripts/controllers/client/TransactionClientController.js index bb677aef..70e2b189 100644 --- a/app/scripts/controllers/client/TransactionClientController.js +++ b/app/scripts/controllers/client/TransactionClientController.js @@ -1,25 +1,25 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - TransactionClientController: function(scope, resourceFactory, routeParams, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + TransactionClientController: function (scope, resourceFactory, routeParams, location) { - scope.formData = {}; - scope.clientId = routeParams.id; - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = data; - scope.formData.destinationOfficeId = scope.offices[0].id; - }); + scope.formData = {}; + scope.clientId = routeParams.id; + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + scope.formData.destinationOfficeId = scope.offices[0].id; + }); - scope.submit = function() { - this.formData.locale = "en"; - this.formData.dateFormat = "dd MMMM yyyy"; - resourceFactory.clientResource.save({clientId : routeParams.id, command : 'proposeTransfer'}, this.formData, function(data){ - location.path('/viewclient/'+routeParams.id); - }); - }; + scope.submit = function () { + this.formData.locale = "en"; + this.formData.dateFormat = "dd MMMM yyyy"; + resourceFactory.clientResource.save({clientId: routeParams.id, command: 'proposeTransfer'}, this.formData, function (data) { + location.path('/viewclient/' + routeParams.id); + }); + }; - } - }); - mifosX.ng.application.controller('TransactionClientController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.TransactionClientController]).run(function($log) { - $log.info("TransactionClientController initialized"); - }); + } + }); + mifosX.ng.application.controller('TransactionClientController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.TransactionClientController]).run(function ($log) { + $log.info("TransactionClientController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/UploadClientIdentifierDocumentController.js b/app/scripts/controllers/client/UploadClientIdentifierDocumentController.js index 21f7e470..85a00d24 100644 --- a/app/scripts/controllers/client/UploadClientIdentifierDocumentController.js +++ b/app/scripts/controllers/client/UploadClientIdentifierDocumentController.js @@ -1,28 +1,28 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - UploadClientIdentifierDocumentController: function(scope, location, http, routeParams, API_VERSION,$upload,$rootScope) { - scope.clientId = routeParams.clientId; - scope.resourceId = routeParams.resourceId; - scope.onFileSelect = function($files) { - scope.file = $files[0]; - }; +(function (module) { + mifosX.controllers = _.extend(module, { + UploadClientIdentifierDocumentController: function (scope, location, http, routeParams, API_VERSION, $upload, $rootScope) { + scope.clientId = routeParams.clientId; + scope.resourceId = routeParams.resourceId; + scope.onFileSelect = function ($files) { + scope.file = $files[0]; + }; - scope.submit = function () { - $upload.upload({ - url: $rootScope.hostUrl + API_VERSION + '/client_identifiers/'+scope.resourceId+'/documents', - data: scope.formData, - file: scope.file - }).then(function(data) { - // to fix IE not refreshing the model - if (!scope.$$phase) { - scope.$apply(); - } - location.path('/viewclient/'+scope.clientId); - }); - }; - } - }); - mifosX.ng.application.controller('UploadClientIdentifierDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION','$upload','$rootScope', mifosX.controllers.UploadClientIdentifierDocumentController]).run(function($log) { - $log.info("UploadClientIdentifierDocumentController initialized"); - }); + scope.submit = function () { + $upload.upload({ + url: $rootScope.hostUrl + API_VERSION + '/client_identifiers/' + scope.resourceId + '/documents', + data: scope.formData, + file: scope.file + }).then(function (data) { + // to fix IE not refreshing the model + if (!scope.$$phase) { + scope.$apply(); + } + location.path('/viewclient/' + scope.clientId); + }); + }; + } + }); + mifosX.ng.application.controller('UploadClientIdentifierDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.UploadClientIdentifierDocumentController]).run(function ($log) { + $log.info("UploadClientIdentifierDocumentController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/collection/CollectionSheetController.js b/app/scripts/controllers/collection/CollectionSheetController.js index 3064153d..325b8875 100644 --- a/app/scripts/controllers/collection/CollectionSheetController.js +++ b/app/scripts/controllers/collection/CollectionSheetController.js @@ -1,312 +1,311 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CollectionSheetController: function(scope, resourceFactory, location, routeParams, dateFilter, localStorageService, route, $timeout) { - scope.offices = []; - scope.centers = []; - scope.groups = []; - scope.clientsAttendance = []; - scope.calendarId = ''; - scope.formData = {}; - scope.centerId = ''; - scope.groupId = ''; - scope.date = {}; - var centerOrGroupResource = ''; - resourceFactory.officeResource.getAllOffices(function(data) { - scope.offices = data; - }); - - scope.productiveCollectionSheet = function () { - for (var i = 0; i < scope.offices.length; i++) { - if (scope.offices[i].id === scope.officeId) { - scope.officeName = scope.offices[i].name; - } - } - scope.meetingDate = dateFilter(scope.date.transactionDate,scope.df); - location.path('/productivesheet/'+scope.officeId+'/'+scope.officeName+'/'+scope.meetingDate+'/'+scope.loanOfficerId); - } - - scope.officeSelected = function(officeId) { - scope.officeId = officeId; - if(officeId) { - resourceFactory.employeeResource.getAllEmployees({loanOfficersOnly : 'true', officeId : officeId}, function(data) { - scope.loanOfficers = data; - }); - } - }; - - if (localStorageService.get('Success') == 'true') { - scope.savesuccess = true; - localStorageService.remove('Success'); - scope.val = true; - $timeout(function() { - scope.val = false; - }, 3000); - - } - - scope.loanOfficerSelected = function(loanOfficerId) { - if(loanOfficerId) { - resourceFactory.centerResource.getAllCenters({officeId : scope.officeId, staffId : loanOfficerId, orderBy: 'name', sortOrder: 'ASC', limit: -1}, function(data) { - scope.centers = data; - if (data.length > 0) { - scope.centerMandatory = true; - } - }); - - resourceFactory.groupResource.getAllGroups({officeId : scope.officeId, staffId : loanOfficerId, orderBy: 'name', sortOrder: 'ASC', limit: -1}, function(data) { - scope.groups = data; - if (data.length > 0 && scope.centers.length < 0) { - scope.groupMandatory = true; - } - }); - } else { - scope.centers = ''; - scope.groups = ''; - } - }; - - scope.centerSelected = function(centerId) { - if(centerId) { - scope.collectionsheetdata = ""; - resourceFactory.centerResource.get({'centerId' : centerId, associations : 'groupMembers,collectionMeetingCalendar' }, function(data) { - scope.centerdetails = data; - if (data.groupMembers.length > 0) { - scope.groups = data.groupMembers; - } - - if (data.collectionMeetingCalendar && data.collectionMeetingCalendar.recentEligibleMeetingDate) { - scope.date.transactionDate = new Date(dateFilter(data.collectionMeetingCalendar.recentEligibleMeetingDate,scope.df)); - } - if (data.collectionMeetingCalendar) { - scope.calendarId = data.collectionMeetingCalendar.id; - } - centerOrGroupResource = "centerResource"; - }); - } - }; - - scope.groupSelected = function(groupId) { - if(groupId) { - scope.collectionsheetdata = ""; - resourceFactory.groupResource.get({'groupId' : groupId, associations : 'collectionMeetingCalendar'}, function(data) { - scope.groupdetails = data.pageItems; - if (data.collectionMeetingCalendar) { - scope.calendarId = data.collectionMeetingCalendar.id; - } - if (data.collectionMeetingCalendar && data.collectionMeetingCalendar.recentEligibleMeetingDate) { - scope.date.transactionDate = new Date(dateFilter(data.collectionMeetingCalendar.recentEligibleMeetingDate,scope.df)); - } - centerOrGroupResource = "groupResource"; - }); - } else if(scope.centerId){ - centerOrGroupResource = "centerResource" - } - }; - - scope.previewCollectionSheet = function() { +(function (module) { + mifosX.controllers = _.extend(module, { + CollectionSheetController: function (scope, resourceFactory, location, routeParams, dateFilter, localStorageService, route, $timeout) { + scope.offices = []; + scope.centers = []; + scope.groups = []; + scope.clientsAttendance = []; + scope.calendarId = ''; scope.formData = {}; - scope.formData.dateFormat = "dd MMMM yyyy"; - scope.formData.locale = "en"; - scope.formData.calendarId = scope.calendarId; - if (scope.date.transactionDate) { - scope.formData.transactionDate = dateFilter(scope.date.transactionDate,scope.df); - } - if (centerOrGroupResource == "centerResource" && scope.calendarId !== "") { - resourceFactory.centerResource.save({'centerId' : scope.centerId, command : 'generateCollectionSheet'}, scope.formData,function(data){ - if (data.groups.length > 0) { - scope.collectionsheetdata = data; - scope.clientsAttendanceArray(data.groups); - scope.total(data); - } else { - scope.noData = true; - $timeout(function() { - scope.noData = false; - }, 3000); + scope.centerId = ''; + scope.groupId = ''; + scope.date = {}; + var centerOrGroupResource = ''; + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + }); + + scope.productiveCollectionSheet = function () { + for (var i = 0; i < scope.offices.length; i++) { + if (scope.offices[i].id === scope.officeId) { + scope.officeName = scope.offices[i].name; } - - }); - } else if (centerOrGroupResource == "groupResource" && scope.calendarId !== "") { - resourceFactory.groupResource.save({'groupId' : scope.groupId, command : 'generateCollectionSheet'}, scope.formData,function(data){ - if (data.groups.length > 0) { + } + scope.meetingDate = dateFilter(scope.date.transactionDate, scope.df); + location.path('/productivesheet/' + scope.officeId + '/' + scope.officeName + '/' + scope.meetingDate + '/' + scope.loanOfficerId); + } + + scope.officeSelected = function (officeId) { + scope.officeId = officeId; + if (officeId) { + resourceFactory.employeeResource.getAllEmployees({loanOfficersOnly: 'true', officeId: officeId}, function (data) { + scope.loanOfficers = data; + }); + } + }; + + if (localStorageService.get('Success') == 'true') { + scope.savesuccess = true; + localStorageService.remove('Success'); + scope.val = true; + $timeout(function () { + scope.val = false; + }, 3000); + + } + + scope.loanOfficerSelected = function (loanOfficerId) { + if (loanOfficerId) { + resourceFactory.centerResource.getAllCenters({officeId: scope.officeId, staffId: loanOfficerId, orderBy: 'name', sortOrder: 'ASC', limit: -1}, function (data) { + scope.centers = data; + if (data.length > 0) { + scope.centerMandatory = true; + } + }); + + resourceFactory.groupResource.getAllGroups({officeId: scope.officeId, staffId: loanOfficerId, orderBy: 'name', sortOrder: 'ASC', limit: -1}, function (data) { + scope.groups = data; + if (data.length > 0 && scope.centers.length < 0) { + scope.groupMandatory = true; + } + }); + } else { + scope.centers = ''; + scope.groups = ''; + } + }; + + scope.centerSelected = function (centerId) { + if (centerId) { + scope.collectionsheetdata = ""; + resourceFactory.centerResource.get({'centerId': centerId, associations: 'groupMembers,collectionMeetingCalendar' }, function (data) { + scope.centerdetails = data; + if (data.groupMembers.length > 0) { + scope.groups = data.groupMembers; + } + + if (data.collectionMeetingCalendar && data.collectionMeetingCalendar.recentEligibleMeetingDate) { + scope.date.transactionDate = new Date(dateFilter(data.collectionMeetingCalendar.recentEligibleMeetingDate, scope.df)); + } + if (data.collectionMeetingCalendar) { + scope.calendarId = data.collectionMeetingCalendar.id; + } + centerOrGroupResource = "centerResource"; + }); + } + }; + + scope.groupSelected = function (groupId) { + if (groupId) { + scope.collectionsheetdata = ""; + resourceFactory.groupResource.get({'groupId': groupId, associations: 'collectionMeetingCalendar'}, function (data) { + scope.groupdetails = data.pageItems; + if (data.collectionMeetingCalendar) { + scope.calendarId = data.collectionMeetingCalendar.id; + } + if (data.collectionMeetingCalendar && data.collectionMeetingCalendar.recentEligibleMeetingDate) { + scope.date.transactionDate = new Date(dateFilter(data.collectionMeetingCalendar.recentEligibleMeetingDate, scope.df)); + } + centerOrGroupResource = "groupResource"; + }); + } else if (scope.centerId) { + centerOrGroupResource = "centerResource" + } + }; + + scope.previewCollectionSheet = function () { + scope.formData = {}; + scope.formData.dateFormat = "dd MMMM yyyy"; + scope.formData.locale = "en"; + scope.formData.calendarId = scope.calendarId; + if (scope.date.transactionDate) { + scope.formData.transactionDate = dateFilter(scope.date.transactionDate, scope.df); + } + if (centerOrGroupResource == "centerResource" && scope.calendarId !== "") { + resourceFactory.centerResource.save({'centerId': scope.centerId, command: 'generateCollectionSheet'}, scope.formData, function (data) { + if (data.groups.length > 0) { + scope.collectionsheetdata = data; + scope.clientsAttendanceArray(data.groups); + scope.total(data); + } else { + scope.noData = true; + $timeout(function () { + scope.noData = false; + }, 3000); + } + + }); + } else if (centerOrGroupResource == "groupResource" && scope.calendarId !== "") { + resourceFactory.groupResource.save({'groupId': scope.groupId, command: 'generateCollectionSheet'}, scope.formData, function (data) { + if (data.groups.length > 0) { + scope.collectionsheetdata = data; + scope.clientsAttendanceArray(data.groups); + scope.total(data); + } else { + scope.noData = true; + $timeout(function () { + scope.noData = false; + }, 3000); + } + }); + } else { + resourceFactory.groupResource.save({'groupId': 0, command: 'generateCollectionSheet'}, scope.formData, function (data) { scope.collectionsheetdata = data; - scope.clientsAttendanceArray(data.groups); - scope.total(data); - } else { - scope.noData = true; - $timeout(function() { - scope.noData = false; - }, 3000); + }); + } + }; + + //client transaction amount is update this method will update both individual/all groups + //total for a specific product + scope.bulkRepaymentTransactionAmountChange = function () { + scope.collectionData = scope.collectionsheetdata; + scope.total(scope.collectionData); + }; + + scope.clientsAttendanceArray = function (groups) { + var gl = groups.length; + for (var i = 0; i < gl; i++) { + scope.clients = groups[i].clients; + var cl = scope.clients.length; + for (var j = 0; j < cl; j++) { + scope.client = scope.clients[j]; + if (scope.client.attendanceType.id === 0) { + scope.client.attendanceType.id = 1; + } } - }); - } else { - resourceFactory.groupResource.save({'groupId' : 0, command : 'generateCollectionSheet'}, scope.formData,function(data){ - scope.collectionsheetdata = data; - }); - } - }; - - //client transaction amount is update this method will update both individual/all groups - //total for a specific product - scope.bulkRepaymentTransactionAmountChange = function() { - scope.collectionData = scope.collectionsheetdata; - scope.total(scope.collectionData); - }; - - scope.clientsAttendanceArray = function (groups) { - var gl = groups.length; - for (var i = 0; i < gl; i++) { - scope.clients = groups[i].clients; - var cl = scope.clients.length; - for (var j = 0; j < cl; j++) { - scope.client = scope.clients[j]; - if (scope.client.attendanceType.id === 0) { - scope.client.attendanceType.id = 1; - } - } - } - }; - - function deepCopy(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); } - return out; - } - return obj; - } + }; - scope.total = function (data) { - scope.bulkRepaymentTransactions = []; - scope.bulkDisbursementTransactions = []; - scope.groupTotal = []; - scope.loanProductArray = []; - scope.loanDueTotalCollections = []; - - for (var i = 0; i < data.loanProducts.length; i++) { - loanProductTemp = { - productId : data.loanProducts[i].id, - transactionAmount : 0, - disbursementAmount : 0 + function deepCopy(obj) { + if (Object.prototype.toString.call(obj) === '[object Array]') { + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; } - scope.loanProductArray.push(loanProductTemp); - - //getting unique currency symbol the below logic helps - var loanProduct = data.loanProducts[i]; - if (scope.loanDueTotalCollections.length > 0) { - scope.loanDueTotalCollections = _.reject(scope.loanDueTotalCollections, - function (loanProductCurrency) - { - return loanProductCurrency.currencySymbol === loanProduct.currency.displaySymbol; - }); - } - var tempLoanDueCollection = { - currencySymbol : loanProduct.currency.displaySymbol, - amount : 0 + if (typeof obj === 'object') { + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; } - scope.loanDueTotalCollections.push(tempLoanDueCollection); + return obj; } - scope.groupArray = scope.collectionsheetdata.groups; - var gl = scope.groupArray.length; - for (var i = 0; i < gl; i++) { - var loanProductArrayDup = deepCopy(scope.loanProductArray); + scope.total = function (data) { + scope.bulkRepaymentTransactions = []; + scope.bulkDisbursementTransactions = []; + scope.groupTotal = []; + scope.loanProductArray = []; + scope.loanDueTotalCollections = []; - var temp = {}; - temp.groupId = scope.groupArray[i].groupId; + for (var i = 0; i < data.loanProducts.length; i++) { + loanProductTemp = { + productId: data.loanProducts[i].id, + transactionAmount: 0, + disbursementAmount: 0 + } + scope.loanProductArray.push(loanProductTemp); - scope.clientArray = scope.groupArray[i].clients; - var cl = scope.clientArray.length; - for (var j = 0; j < cl; j++) { - scope.loanArray = scope.clientArray[j].loans; - var ll = scope.loanArray.length; - for (var k = 0; k < ll; k++) { - scope.loan = scope.loanArray[k]; - if (scope.loan.totalDue > 0) { - scope.bulkRepaymentTransactions.push({ - loanId : scope.loan.loanId, - transactionAmount : scope.loan.totalDue + //getting unique currency symbol the below logic helps + var loanProduct = data.loanProducts[i]; + if (scope.loanDueTotalCollections.length > 0) { + scope.loanDueTotalCollections = _.reject(scope.loanDueTotalCollections, + function (loanProductCurrency) { + return loanProductCurrency.currencySymbol === loanProduct.currency.displaySymbol; }); - } + } + var tempLoanDueCollection = { + currencySymbol: loanProduct.currency.displaySymbol, + amount: 0 + } + scope.loanDueTotalCollections.push(tempLoanDueCollection); + } - for (var l = 0; l < loanProductArrayDup.length; l++) { - if (loanProductArrayDup[l].productId == scope.loan.productId) { - if (scope.loan.chargesDue) { - loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue) + Number(scope.loan.chargesDue)); - loanProductArrayDup[l].transactionAmount = Math.ceil(loanProductArrayDup[l].transactionAmount * 100)/100; - } else { - loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue)); - } + scope.groupArray = scope.collectionsheetdata.groups; + var gl = scope.groupArray.length; + for (var i = 0; i < gl; i++) { + var loanProductArrayDup = deepCopy(scope.loanProductArray); + + var temp = {}; + temp.groupId = scope.groupArray[i].groupId; + + scope.clientArray = scope.groupArray[i].clients; + var cl = scope.clientArray.length; + for (var j = 0; j < cl; j++) { + scope.loanArray = scope.clientArray[j].loans; + var ll = scope.loanArray.length; + for (var k = 0; k < ll; k++) { + scope.loan = scope.loanArray[k]; + if (scope.loan.totalDue > 0) { + scope.bulkRepaymentTransactions.push({ + loanId: scope.loan.loanId, + transactionAmount: scope.loan.totalDue + }); + } + + for (var l = 0; l < loanProductArrayDup.length; l++) { + if (loanProductArrayDup[l].productId == scope.loan.productId) { + if (scope.loan.chargesDue) { + loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue) + Number(scope.loan.chargesDue)); + loanProductArrayDup[l].transactionAmount = Math.ceil(loanProductArrayDup[l].transactionAmount * 100) / 100; + } else { + loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue)); + } + } + } + + var ldt = scope.loanDueTotalCollections.length; + for (var m = 0; m < ldt; m++) { + var loanDueTotal = scope.loanDueTotalCollections[m]; + if (loanDueTotal.currencySymbol === scope.loan.currency.displaySymbol) { + loanDueTotal.amount = Number(loanDueTotal.amount + Number(scope.loan.totalDue)); + loanDueTotal.amount = Math.ceil(loanDueTotal.amount * 100) / 100; + } } } + } + temp.loanProductArrayDup = loanProductArrayDup; + scope.groupTotal.push(temp); + } - var ldt = scope.loanDueTotalCollections.length; - for (var m = 0; m < ldt; m++) { - var loanDueTotal = scope.loanDueTotalCollections[m]; - if (loanDueTotal.currencySymbol === scope.loan.currency.displaySymbol) { - loanDueTotal.amount = Number(loanDueTotal.amount + Number(scope.loan.totalDue)); - loanDueTotal.amount = Math.ceil(loanDueTotal.amount * 100)/100; + var loanProductArrayTotal = deepCopy(scope.loanProductArray); + for (var i = 0; i < scope.groupTotal.length; i++) { + var groupProductTotal = scope.groupTotal[i]; + for (var j = 0; j < groupProductTotal.loanProductArrayDup.length; j++) { + var productObjectTotal = groupProductTotal.loanProductArrayDup[j]; + for (var k = 0; k < loanProductArrayTotal.length; k++) { + var productArrayTotal = loanProductArrayTotal[k]; + if (productObjectTotal.productId == productArrayTotal.productId) { + productArrayTotal.transactionAmount = productArrayTotal.transactionAmount + productObjectTotal.transactionAmount; + productArrayTotal.disbursementAmount = productArrayTotal.disbursementAmount + productObjectTotal.disbursementAmount; } } } } - temp.loanProductArrayDup = loanProductArrayDup; - scope.groupTotal.push(temp); + scope.grandTotal = loanProductArrayTotal; } - var loanProductArrayTotal = deepCopy(scope.loanProductArray); - for (var i = 0; i < scope.groupTotal.length; i++) { - var groupProductTotal = scope.groupTotal[i]; - for (var j = 0; j < groupProductTotal.loanProductArrayDup.length; j++) { - var productObjectTotal = groupProductTotal.loanProductArrayDup[j]; - for (var k = 0; k < loanProductArrayTotal.length; k++) { - var productArrayTotal = loanProductArrayTotal[k]; - if (productObjectTotal.productId == productArrayTotal.productId) { - productArrayTotal.transactionAmount = productArrayTotal.transactionAmount + productObjectTotal.transactionAmount; - productArrayTotal.disbursementAmount = productArrayTotal.disbursementAmount + productObjectTotal.disbursementAmount; - } - } + scope.submit = function () { + scope.formData.calendarId = scope.calendarId; + scope.formData.dateFormat = "dd MMMM yyyy"; + scope.formData.locale = "en"; + if (scope.date.transactionDate) { + scope.formData.transactionDate = dateFilter(scope.date.transactionDate, scope.df); } - } - scope.grandTotal = loanProductArrayTotal; + scope.formData.actualDisbursementDate = this.formData.transactionDate; + scope.formData.clientsAttendance = scope.clientsAttendance; + scope.formData.bulkDisbursementTransactions = []; + scope.formData.bulkRepaymentTransactions = scope.bulkRepaymentTransactions; + if (centerOrGroupResource == "centerResource") { + resourceFactory.centerResource.save({'centerId': scope.centerId, command: 'saveCollectionSheet'}, scope.formData, function (data) { + localStorageService.add('Success', true); + route.reload(); + }); + } else if (centerOrGroupResource == "groupResource") { + resourceFactory.groupResource.save({'groupId': scope.groupId, command: 'saveCollectionSheet'}, scope.formData, function (data) { + localStorageService.add('Success', true); + route.reload(); + }); + } + }; + } - - scope.submit = function() { - scope.formData.calendarId = scope.calendarId; - scope.formData.dateFormat = "dd MMMM yyyy"; - scope.formData.locale = "en"; - if (scope.date.transactionDate) { - scope.formData.transactionDate = dateFilter(scope.date.transactionDate,scope.df); - } - scope.formData.actualDisbursementDate = this.formData.transactionDate; - scope.formData.clientsAttendance = scope.clientsAttendance; - scope.formData.bulkDisbursementTransactions = []; - scope.formData.bulkRepaymentTransactions = scope.bulkRepaymentTransactions; - if (centerOrGroupResource == "centerResource") { - resourceFactory.centerResource.save({'centerId' : scope.centerId, command : 'saveCollectionSheet'}, scope.formData,function(data){ - localStorageService.add('Success', true); - route.reload(); - }); - } else if (centerOrGroupResource == "groupResource") { - resourceFactory.groupResource.save({'groupId' : scope.groupId, command : 'saveCollectionSheet'}, scope.formData,function(data){ - localStorageService.add('Success', true); - route.reload(); - }); - } - }; - - } - }); - mifosX.ng.application.controller('CollectionSheetController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', 'localStorageService', - '$route', '$timeout', mifosX.controllers.CollectionSheetController]).run(function($log) { - $log.info("CollectionSheetController initialized"); - }); + }); + mifosX.ng.application.controller('CollectionSheetController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', 'localStorageService', + '$route', '$timeout', mifosX.controllers.CollectionSheetController]).run(function ($log) { + $log.info("CollectionSheetController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/collection/ProductiveCollectionSheetController.js b/app/scripts/controllers/collection/ProductiveCollectionSheetController.js index edd931a1..11259e1f 100644 --- a/app/scripts/controllers/collection/ProductiveCollectionSheetController.js +++ b/app/scripts/controllers/collection/ProductiveCollectionSheetController.js @@ -1,204 +1,204 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ProductiveCollectionSheetController: function(scope, routeParams , resourceFactory, dateFilter, location) { - var params = {}; - params.locale = "en"; - params.dateFormat = "dd MMMM yyyy"; - params.meetingDate = routeParams.meetingDate; - params.officeId = routeParams.officeId; - params.staffId = routeParams.staffId; - var centerIdArray = []; - scope.submitButtonShow = false; - scope.completedCenter = false; - scope.officeName = routeParams.officeName; - scope.meetingDate = routeParams.meetingDate; - - resourceFactory.centerResource.getAllMeetingFallCenters(params, function (data) { - if (data[0]) { - scope.staffCenterData = data[0].meetingFallCenters; - for (var i = 0; i < scope.staffCenterData.length; i++) { - centerIdArray.push({id : scope.staffCenterData[i].id, calendarId : scope.staffCenterData[i].collectionMeetingCalendar.id}); - } - scope.getAllGroupsByCenter(data[0].meetingFallCenters[0].id, data[0].meetingFallCenters[0].collectionMeetingCalendar.id); - } - }); - - scope.getAllGroupsByCenter = function (centerId, calendarId) { +(function (module) { + mifosX.controllers = _.extend(module, { + ProductiveCollectionSheetController: function (scope, routeParams, resourceFactory, dateFilter, location) { + var params = {}; + params.locale = "en"; + params.dateFormat = "dd MMMM yyyy"; + params.meetingDate = routeParams.meetingDate; + params.officeId = routeParams.officeId; + params.staffId = routeParams.staffId; + var centerIdArray = []; scope.submitButtonShow = false; - scope.selectedTab = centerId; - scope.centerId = centerId; - scope.calendarId = calendarId; - scope.formData = {}; - scope.formData.dateFormat = "dd MMMM yyyy"; - scope.formData.locale = "en"; - scope.formData.calendarId = scope.calendarId; - scope.formData.transactionDate = routeParams.meetingDate; - resourceFactory.centerResource.save({'centerId' : scope.centerId, command : 'generateCollectionSheet'}, scope.formData,function(data){ - scope.collectionsheetdata = data; - scope.clientsAttendanceArray(data.groups); - scope.total(data); + scope.completedCenter = false; + scope.officeName = routeParams.officeName; + scope.meetingDate = routeParams.meetingDate; + + resourceFactory.centerResource.getAllMeetingFallCenters(params, function (data) { + if (data[0]) { + scope.staffCenterData = data[0].meetingFallCenters; + for (var i = 0; i < scope.staffCenterData.length; i++) { + centerIdArray.push({id: scope.staffCenterData[i].id, calendarId: scope.staffCenterData[i].collectionMeetingCalendar.id}); + } + scope.getAllGroupsByCenter(data[0].meetingFallCenters[0].id, data[0].meetingFallCenters[0].collectionMeetingCalendar.id); + } }); - }; - scope.bulkRepaymentTransactionAmountChange = function () { - scope.collectionData = scope.collectionsheetdata; - scope.total(scope.collectionData); - }; + scope.getAllGroupsByCenter = function (centerId, calendarId) { + scope.submitButtonShow = false; + scope.selectedTab = centerId; + scope.centerId = centerId; + scope.calendarId = calendarId; + scope.formData = {}; + scope.formData.dateFormat = "dd MMMM yyyy"; + scope.formData.locale = "en"; + scope.formData.calendarId = scope.calendarId; + scope.formData.transactionDate = routeParams.meetingDate; + resourceFactory.centerResource.save({'centerId': scope.centerId, command: 'generateCollectionSheet'}, scope.formData, function (data) { + scope.collectionsheetdata = data; + scope.clientsAttendanceArray(data.groups); + scope.total(data); + }); + }; - scope.clientsAttendanceArray = function (groups) { - var gl = groups.length; - for (var i = 0; i < gl; i++) { - scope.clients = groups[i].clients; - var cl = scope.clients.length; - for (var j = 0; j < cl; j++) { - scope.client = scope.clients[j]; - if (scope.client.attendanceType.id === 0) { - scope.client.attendanceType.id = 1; + scope.bulkRepaymentTransactionAmountChange = function () { + scope.collectionData = scope.collectionsheetdata; + scope.total(scope.collectionData); + }; + + scope.clientsAttendanceArray = function (groups) { + var gl = groups.length; + for (var i = 0; i < gl; i++) { + scope.clients = groups[i].clients; + var cl = scope.clients.length; + for (var j = 0; j < cl; j++) { + scope.client = scope.clients[j]; + if (scope.client.attendanceType.id === 0) { + scope.client.attendanceType.id = 1; + } } } - } - }; + }; - function deepCopy(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); + function deepCopy(obj) { + if (Object.prototype.toString.call(obj) === '[object Array]') { + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; } - return out; - } - return obj; - } - - scope.total = function (data) { - scope.bulkRepaymentTransactions = []; - scope.bulkDisbursementTransactions = []; - scope.groupTotal = []; - scope.loanProductArray = []; - scope.loanDueTotalCollections = []; - - for (var i = 0; i < data.loanProducts.length; i++) { - loanProductTemp = { - productId : data.loanProducts[i].id, - transactionAmount : 0, - disbursementAmount : 0 + if (typeof obj === 'object') { + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; } - scope.loanProductArray.push(loanProductTemp); + return obj; } - scope.groupArray = scope.collectionsheetdata.groups; - var gl = scope.groupArray.length; - for (var i = 0; i < gl; i++) { - var loanProductArrayDup = deepCopy(scope.loanProductArray); + scope.total = function (data) { + scope.bulkRepaymentTransactions = []; + scope.bulkDisbursementTransactions = []; + scope.groupTotal = []; + scope.loanProductArray = []; + scope.loanDueTotalCollections = []; - var temp = {}; - temp.groupId = scope.groupArray[i].groupId; + for (var i = 0; i < data.loanProducts.length; i++) { + loanProductTemp = { + productId: data.loanProducts[i].id, + transactionAmount: 0, + disbursementAmount: 0 + } + scope.loanProductArray.push(loanProductTemp); + } - scope.clientArray = scope.groupArray[i].clients; - var cl = scope.clientArray.length; - for (var j = 0; j < cl; j++) { - scope.loanArray = scope.clientArray[j].loans; - var ll = scope.loanArray.length; - for (var k = 0; k < ll; k++) { - scope.loan = scope.loanArray[k]; - if (scope.loan.totalDue > 0) { - scope.bulkRepaymentTransactions.push({ - loanId : scope.loan.loanId, - transactionAmount : scope.loan.totalDue - }); - } + scope.groupArray = scope.collectionsheetdata.groups; + var gl = scope.groupArray.length; + for (var i = 0; i < gl; i++) { + var loanProductArrayDup = deepCopy(scope.loanProductArray); - for (var l = 0; l < loanProductArrayDup.length; l++) { - if (loanProductArrayDup[l].productId == scope.loan.productId) { - if (scope.loan.chargesDue) { - loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue) + Number(scope.loan.chargesDue)); - loanProductArrayDup[l].transactionAmount = Math.ceil(loanProductArrayDup[l].transactionAmount * 100)/100; - } else { - loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue)); - } + var temp = {}; + temp.groupId = scope.groupArray[i].groupId; + + scope.clientArray = scope.groupArray[i].clients; + var cl = scope.clientArray.length; + for (var j = 0; j < cl; j++) { + scope.loanArray = scope.clientArray[j].loans; + var ll = scope.loanArray.length; + for (var k = 0; k < ll; k++) { + scope.loan = scope.loanArray[k]; + if (scope.loan.totalDue > 0) { + scope.bulkRepaymentTransactions.push({ + loanId: scope.loan.loanId, + transactionAmount: scope.loan.totalDue + }); + } + + for (var l = 0; l < loanProductArrayDup.length; l++) { + if (loanProductArrayDup[l].productId == scope.loan.productId) { + if (scope.loan.chargesDue) { + loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue) + Number(scope.loan.chargesDue)); + loanProductArrayDup[l].transactionAmount = Math.ceil(loanProductArrayDup[l].transactionAmount * 100) / 100; + } else { + loanProductArrayDup[l].transactionAmount = Number(loanProductArrayDup[l].transactionAmount + Number(scope.loan.totalDue)); + } + } } } - } + } + temp.loanProductArrayDup = loanProductArrayDup; + scope.groupTotal.push(temp); } - temp.loanProductArrayDup = loanProductArrayDup; - scope.groupTotal.push(temp); - } - var loanProductArrayTotal = deepCopy(scope.loanProductArray); - for (var i = 0; i < scope.groupTotal.length; i++) { - var groupProductTotal = scope.groupTotal[i]; - for (var j = 0; j < groupProductTotal.loanProductArrayDup.length; j++) { - var productObjectTotal = groupProductTotal.loanProductArrayDup[j]; - for (var k = 0; k < loanProductArrayTotal.length; k++) { - var productArrayTotal = loanProductArrayTotal[k]; - if (productObjectTotal.productId == productArrayTotal.productId) { - productArrayTotal.transactionAmount = productArrayTotal.transactionAmount + productObjectTotal.transactionAmount; - productArrayTotal.disbursementAmount = productArrayTotal.disbursementAmount + productObjectTotal.disbursementAmount; + var loanProductArrayTotal = deepCopy(scope.loanProductArray); + for (var i = 0; i < scope.groupTotal.length; i++) { + var groupProductTotal = scope.groupTotal[i]; + for (var j = 0; j < groupProductTotal.loanProductArrayDup.length; j++) { + var productObjectTotal = groupProductTotal.loanProductArrayDup[j]; + for (var k = 0; k < loanProductArrayTotal.length; k++) { + var productArrayTotal = loanProductArrayTotal[k]; + if (productObjectTotal.productId == productArrayTotal.productId) { + productArrayTotal.transactionAmount = productArrayTotal.transactionAmount + productObjectTotal.transactionAmount; + productArrayTotal.disbursementAmount = productArrayTotal.disbursementAmount + productObjectTotal.disbursementAmount; + } } } } + scope.grandTotal = loanProductArrayTotal; } - scope.grandTotal = loanProductArrayTotal; + + scope.viewFullScreen = function () { + var element = document.getElementById("productive_sheet"); + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } + }; + + scope.submit = function () { + scope.formData.calendarId = scope.calendarId; + scope.formData.dateFormat = "dd MMMM yyyy"; + scope.formData.locale = "en"; + scope.formData.transactionDate = dateFilter(routeParams.meetingDate, scope.df); + scope.formData.clientsAttendance = scope.clientsAttendance; + scope.formData.bulkDisbursementTransactions = []; + scope.formData.bulkRepaymentTransactions = scope.bulkRepaymentTransactions; + resourceFactory.centerResource.save({'centerId': scope.centerId, command: 'saveCollectionSheet'}, scope.formData, function (data) { + scope.tempId = scope.centerId; + if (centerIdArray.length === 1) { + location.path('/entercollectionsheet'); + } + for (var i = 0; i < centerIdArray.length; i++) { + if (scope.centerId === centerIdArray[i].id && scope.staffCenterData[i].id === scope.centerId && centerIdArray.length > 1) { + scope.staffCenterData = _.without(scope.staffCenterData, scope.staffCenterData[i]); + if (i === centerIdArray.length - 1 && centerIdArray.length > 0) { + scope.selectedTab = centerIdArray[0].id; + } else { + scope.selectedTab = centerIdArray[i + 1].id; + scope.getAllGroupsByCenter(deepCopy(centerIdArray[i + 1].id), deepCopy(centerIdArray[i + 1].calendarId)); + } + + centerIdArray = _.without(centerIdArray, centerIdArray[i]); + if (centerIdArray.length > 1) { + scope.submitButtonShow = false; + } else { + scope.submitButtonShow = true; + } + + break; + } + } + }); + }; } - - scope.viewFullScreen = function () { - var element = document.getElementById("productive_sheet"); - if(element.requestFullscreen) { - element.requestFullscreen(); - } else if(element.mozRequestFullScreen) { - element.mozRequestFullScreen(); - } else if(element.webkitRequestFullscreen) { - element.webkitRequestFullscreen(); - } else if(element.msRequestFullscreen) { - element.msRequestFullscreen(); - } - }; - - scope.submit = function() { - scope.formData.calendarId = scope.calendarId; - scope.formData.dateFormat = "dd MMMM yyyy"; - scope.formData.locale = "en"; - scope.formData.transactionDate = dateFilter(routeParams.meetingDate,scope.df); - scope.formData.clientsAttendance = scope.clientsAttendance; - scope.formData.bulkDisbursementTransactions = []; - scope.formData.bulkRepaymentTransactions = scope.bulkRepaymentTransactions; - resourceFactory.centerResource.save({'centerId' : scope.centerId, command : 'saveCollectionSheet'}, scope.formData,function (data) { - scope.tempId = scope.centerId; - if (centerIdArray.length === 1) { - location.path('/entercollectionsheet'); - } - for (var i=0; i < centerIdArray.length; i++) { - if (scope.centerId === centerIdArray[i].id && scope.staffCenterData[i].id === scope.centerId && centerIdArray.length > 1) { - scope.staffCenterData = _.without(scope.staffCenterData, scope.staffCenterData[i]); - if (i === centerIdArray.length-1 && centerIdArray.length > 0) { - scope.selectedTab = centerIdArray[0].id; - } else { - scope.selectedTab = centerIdArray[i+1].id; - scope.getAllGroupsByCenter(deepCopy(centerIdArray[i+1].id), deepCopy(centerIdArray[i+1].calendarId)); - } - - centerIdArray = _.without(centerIdArray, centerIdArray[i]); - if (centerIdArray.length > 1) { - scope.submitButtonShow = false; - } else { - scope.submitButtonShow = true; - } - - break; - } - } - }); - }; - } - }); - mifosX.ng.application.controller('ProductiveCollectionSheetController', ['$scope', '$routeParams','ResourceFactory', 'dateFilter', '$location', mifosX.controllers.ProductiveCollectionSheetController]).run(function($log) { - $log.info("ProductiveCollectionSheetController initialized"); - }); + }); + mifosX.ng.application.controller('ProductiveCollectionSheetController', ['$scope', '$routeParams', 'ResourceFactory', 'dateFilter', '$location', mifosX.controllers.ProductiveCollectionSheetController]).run(function ($log) { + $log.info("ProductiveCollectionSheetController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/configurations/GlobalConfigurationController.js b/app/scripts/controllers/configurations/GlobalConfigurationController.js index ead3fac7..0c31e39a 100644 --- a/app/scripts/controllers/configurations/GlobalConfigurationController.js +++ b/app/scripts/controllers/configurations/GlobalConfigurationController.js @@ -1,51 +1,49 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - GlobalConfigurationController: function(scope, resourceFactory , location,route) { + GlobalConfigurationController: function (scope, resourceFactory, location, route) { scope.configs = []; - resourceFactory.configurationResource.get(function(data) { - for(var i in data.globalConfiguration){ + resourceFactory.configurationResource.get(function (data) { + for (var i in data.globalConfiguration) { scope.configs.push(data.globalConfiguration[i]) } - resourceFactory.cacheResource.get(function(data) { - for(var i in data ){ - if(data[i].cacheType.id==2){ + resourceFactory.cacheResource.get(function (data) { + for (var i in data) { + if (data[i].cacheType.id == 2) { var cache = {}; cache.name = 'Is Cache Enabled'; - cache.enabled = data[i].enabled; + cache.enabled = data[i].enabled; } } scope.configs.push(cache); }); }); - scope.enable = function(id,name) { - if(name=='Is Cache Enabled'){ + scope.enable = function (id, name) { + if (name == 'Is Cache Enabled') { var temp = {}; temp.cacheType = 2; - resourceFactory.cacheResource.update(temp,function(data) { - route.reload(); + resourceFactory.cacheResource.update(temp, function (data) { + route.reload(); }); } - else - { - var temp = {'enabled':'true'}; - resourceFactory.configurationResource.update({'id':id}, temp, function(data) { + else { + var temp = {'enabled': 'true'}; + resourceFactory.configurationResource.update({'id': id}, temp, function (data) { route.reload(); }); } }; - scope.disable = function(id,name) { - if(name=='Is Cache Enabled'){ + scope.disable = function (id, name) { + if (name == 'Is Cache Enabled') { var temp = {}; temp.cacheType = 1; - resourceFactory.cacheResource.update(temp,function(data) { + resourceFactory.cacheResource.update(temp, function (data) { route.reload(); }); } - else - { - var temp = {'enabled':'false'}; - resourceFactory.configurationResource.update({'id':id}, temp, function(data) { + else { + var temp = {'enabled': 'false'}; + resourceFactory.configurationResource.update({'id': id}, temp, function (data) { route.reload(); }); } @@ -53,7 +51,7 @@ } }); - mifosX.ng.application.controller('GlobalConfigurationController', ['$scope', 'ResourceFactory', '$location','$route', mifosX.controllers.GlobalConfigurationController]).run(function($log) { + mifosX.ng.application.controller('GlobalConfigurationController', ['$scope', 'ResourceFactory', '$location', '$route', mifosX.controllers.GlobalConfigurationController]).run(function ($log) { $log.info("GlobalConfigurationController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/AddMemberController.js b/app/scripts/controllers/groups/AddMemberController.js index eede16fe..36c769e5 100644 --- a/app/scripts/controllers/groups/AddMemberController.js +++ b/app/scripts/controllers/groups/AddMemberController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddMemberController: function(scope, resourceFactory, location, routeParams,dateFilter) { + AddMemberController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.first = {}; scope.restrictDate = new Date(); scope.first.date = new Date(); @@ -9,35 +9,35 @@ if (routeParams.groupId) { scope.groupId = routeParams.groupId; } - resourceFactory.clientTemplateResource.get({officeId: routeParams.officeId} , function(data) { + resourceFactory.clientTemplateResource.get({officeId: routeParams.officeId}, function (data) { scope.clientTemplate = data; }); - scope.setChoice = function(){ - if(this.formData.active){ + scope.setChoice = function () { + if (this.formData.active) { scope.choice = 1; } - else if(!this.formData.active){ + else if (!this.formData.active) { scope.choice = 0; } }; - scope.submit = function(){ + scope.submit = function () { if (scope.first.date) { - var reqDate = dateFilter(scope.first.date,scope.df); + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.activationDate = reqDate; this.formData.dateFormat = scope.df; } this.formData.active = this.formData.active || false; this.formData.locale = scope.optlang.code; - this.formData.groupId = routeParams.groupId ; + this.formData.groupId = routeParams.groupId; this.formData.officeId = routeParams.officeId; - resourceFactory.clientResource.save(this.formData,function(data) { - location.path('/viewgroup/'+data.groupId); + resourceFactory.clientResource.save(this.formData, function (data) { + location.path('/viewgroup/' + data.groupId); }); }; - + } }); - mifosX.ng.application.controller('AddMemberController', ['$scope', 'ResourceFactory', '$location','$routeParams','dateFilter', mifosX.controllers.AddMemberController]).run(function($log) { + mifosX.ng.application.controller('AddMemberController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.AddMemberController]).run(function ($log) { $log.info("AddMemberController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/AddRoleController.js b/app/scripts/controllers/groups/AddRoleController.js index b9f8d05a..d63c533b 100644 --- a/app/scripts/controllers/groups/AddRoleController.js +++ b/app/scripts/controllers/groups/AddRoleController.js @@ -1,8 +1,8 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddRoleController: function(scope, routeParams , location, resourceFactory) { + AddRoleController: function (scope, routeParams, location, resourceFactory) { scope.formData = {}; - resourceFactory.groupResource.get({groupId: routeParams.id,associations:'all',template:'true'} , function(data) { + resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'all', template: 'true'}, function (data) { scope.group = data; scope.clients = data.clientMembers; scope.roles = data.availableRoles; @@ -10,15 +10,15 @@ scope.formData.role = data.availableRoles[0].id; }); - scope.addrole = function(){ - resourceFactory.groupResource.save({groupId: routeParams.id,command: 'assignRole'},this.formData, function(data) { - location.path('/viewgroup/'+data.groupId); + scope.addrole = function () { + resourceFactory.groupResource.save({groupId: routeParams.id, command: 'assignRole'}, this.formData, function (data) { + location.path('/viewgroup/' + data.groupId); }); }; } }); - mifosX.ng.application.controller('AddRoleController', ['$scope', '$routeParams', '$location', 'ResourceFactory', mifosX.controllers.AddRoleController]).run(function($log) { + mifosX.ng.application.controller('AddRoleController', ['$scope', '$routeParams', '$location', 'ResourceFactory', mifosX.controllers.AddRoleController]).run(function ($log) { $log.info("AddRoleController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/AssignStaffController.js b/app/scripts/controllers/groups/AssignStaffController.js index 26be4b6f..8e731c17 100644 --- a/app/scripts/controllers/groups/AssignStaffController.js +++ b/app/scripts/controllers/groups/AssignStaffController.js @@ -1,29 +1,29 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AssignStaffController: function(scope, resourceFactory, location, routeParams) { + AssignStaffController: function (scope, resourceFactory, location, routeParams) { scope.group = []; scope.staff = []; scope.formData = {}; - resourceFactory.assignStaffResource.get({groupOrCenter : routeParams.entityType, groupOrCenterId : routeParams.id,template:'true'} , function(data) { + resourceFactory.assignStaffResource.get({groupOrCenter: routeParams.entityType, groupOrCenterId: routeParams.id, template: 'true'}, function (data) { scope.group = data; scope.staffs = data.staffOptions; scope.formData.staffId = data.staffOptions[0].id; }); - scope.assignStaff = function(){ + scope.assignStaff = function () { - if(routeParams.entityType == "groups") { + if (routeParams.entityType == "groups") { scope.r = "viewgroup/"; } - else if(routeParams.entityType == "centers") { + else if (routeParams.entityType == "centers") { scope.r = "viewcenter/"; } - resourceFactory.assignStaffResource.save({groupOrCenterId : routeParams.id,command: 'assignStaff'},this.formData, function(data) { - location.path(scope.r +data.groupId); + resourceFactory.assignStaffResource.save({groupOrCenterId: routeParams.id, command: 'assignStaff'}, this.formData, function (data) { + location.path(scope.r + data.groupId); }); }; } }); - mifosX.ng.application.controller('AssignStaffController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.AssignStaffController]).run(function($log) { + mifosX.ng.application.controller('AssignStaffController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.AssignStaffController]).run(function ($log) { $log.info("AssignStaffController initialized"); }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/groups/AttachMeetingController.js b/app/scripts/controllers/groups/AttachMeetingController.js index 1c05c343..396fd6eb 100644 --- a/app/scripts/controllers/groups/AttachMeetingController.js +++ b/app/scripts/controllers/groups/AttachMeetingController.js @@ -1,75 +1,80 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AttachMeetingController: function(scope, resourceFactory, location, routeParams,dateFilter) { - resourceFactory.attachMeetingResource.get({groupOrCenter : routeParams.entityType, groupOrCenterId : routeParams.id, - templateSource : 'template'}, function(data) { + AttachMeetingController: function (scope, resourceFactory, location, routeParams, dateFilter) { + resourceFactory.attachMeetingResource.get({groupOrCenter: routeParams.entityType, groupOrCenterId: routeParams.id, + templateSource: 'template'}, function (data) { scope.entityType = routeParams.entityType; scope.groupOrCenterId = routeParams.id; scope.groupCenterData = data; scope.restrictDate = new Date(); scope.first = {}; scope.periodValue = "day(s)"; - scope.repeatsOptions = [{id:1,value:"daily"}, {id:2,value:"weekly"}, {id:3,value:"monthly"}, {id:4,value:"yearly"}]; - scope.repeatsEveryOptions = ["1","2","3"]; + scope.repeatsOptions = [ + {id: 1, value: "daily"}, + {id: 2, value: "weekly"}, + {id: 3, value: "monthly"}, + {id: 4, value: "yearly"} + ]; + scope.repeatsEveryOptions = ["1", "2", "3"]; //to display default in select boxes scope.formData = { - repeating :'true', - frequency:scope.repeatsOptions[0].id, - interval:'1' + repeating: 'true', + frequency: scope.repeatsOptions[0].id, + interval: '1' } }); - scope.selectedPeriod = function(period) { - if(period == 1) { - scope.repeatsEveryOptions = ["1","2","3"]; + scope.selectedPeriod = function (period) { + if (period == 1) { + scope.repeatsEveryOptions = ["1", "2", "3"]; scope.periodValue = "day(s)" } - if(period == 2) { - scope.repeatsEveryOptions = ["1","2","3"]; + if (period == 2) { + scope.repeatsEveryOptions = ["1", "2", "3"]; scope.formData.repeatsOnDay = '1'; scope.periodValue = "week(s)"; - scope.repeatsOnOptions = [ - {name : "MON", value : "1"}, - {name : "TUE", value : "2"}, - {name : "WED", value : "3"}, - {name : "THU", value : "4"}, - {name : "FRI", value : "5"}, - {name : "SAT", value : "6"}, - {name : "SUN", value : "7"} + scope.repeatsOnOptions = [ + {name: "MON", value: "1"}, + {name: "TUE", value: "2"}, + {name: "WED", value: "3"}, + {name: "THU", value: "4"}, + {name: "FRI", value: "5"}, + {name: "SAT", value: "6"}, + {name: "SUN", value: "7"} ] } - if(period == 3) { + if (period == 3) { scope.periodValue = "month(s)"; - scope.repeatsEveryOptions = ["1","2","3","4", "5", "6", "7", "8", "9", "10", "11"]; + scope.repeatsEveryOptions = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]; } - if(period == 4) { + if (period == 4) { scope.periodValue = "year(s)"; - scope.repeatsEveryOptions = ["1","2","3"]; + scope.repeatsEveryOptions = ["1", "2", "3"]; } } - scope.submit = function() { - var reqDate = dateFilter(scope.first.date,scope.df); + scope.submit = function () { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.startDate = reqDate; this.formData.locale = "en"; this.formData.dateFormat = "dd MMMM yyyy"; this.formData.typeId = "1"; - if(routeParams.entityType == "groups") { - this.formData.title = "groups_"+routeParams.id+"_CollectionMeeting"; + if (routeParams.entityType == "groups") { + this.formData.title = "groups_" + routeParams.id + "_CollectionMeeting"; scope.r = "viewgroup/"; } - else if(routeParams.entityType == "centers") { - this.formData.title = "centers_"+routeParams.id+"_CollectionMeeting"; + else if (routeParams.entityType == "centers") { + this.formData.title = "centers_" + routeParams.id + "_CollectionMeeting"; scope.r = "viewcenter/"; } - resourceFactory.attachMeetingResource.save({groupOrCenter : routeParams.entityType, groupOrCenterId : routeParams.id}, this.formData,function(data){ + resourceFactory.attachMeetingResource.save({groupOrCenter: routeParams.entityType, groupOrCenterId: routeParams.id}, this.formData, function (data) { location.path(scope.r + routeParams.id); }); }; } }); - mifosX.ng.application.controller('AttachMeetingController', ['$scope', 'ResourceFactory', '$location', '$routeParams','dateFilter', mifosX.controllers.AttachMeetingController]).run(function($log) { + mifosX.ng.application.controller('AttachMeetingController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.AttachMeetingController]).run(function ($log) { $log.info("AttachMeetingController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/CloseGroupController.js b/app/scripts/controllers/groups/CloseGroupController.js index 27b153d1..f3b65baf 100644 --- a/app/scripts/controllers/groups/CloseGroupController.js +++ b/app/scripts/controllers/groups/CloseGroupController.js @@ -1,32 +1,32 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CloseGroupController: function(scope, routeParams, route, location, resourceFactory,dateFilter) { + CloseGroupController: function (scope, routeParams, route, location, resourceFactory, dateFilter) { scope.group = []; scope.template = []; scope.first = {}; scope.first.date = new Date(); scope.restrictDate = new Date(); scope.formData = {}; - resourceFactory.groupResource.get({groupId: routeParams.id,associations:'all'} , function(data) { + resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'all'}, function (data) { scope.group = data; }); - resourceFactory.groupTemplateResource.get({command:'close'}, function(data){ + resourceFactory.groupTemplateResource.get({command: 'close'}, function (data) { scope.template = data; scope.formData.closureReasonId = data.closureReasons[0].id; }); - scope.closeGroup = function(){ - var reqDate = dateFilter(scope.first.date,scope.df); + scope.closeGroup = function () { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.closureDate = reqDate; this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; - resourceFactory.groupResource.save({groupId: routeParams.id ,command:'close'},this.formData, function(data){ + resourceFactory.groupResource.save({groupId: routeParams.id, command: 'close'}, this.formData, function (data) { location.path('/viewgroup/' + data.resourceId); }); }; } }); - mifosX.ng.application.controller('CloseGroupController', ['$scope', '$routeParams','$route', '$location', 'ResourceFactory','dateFilter', mifosX.controllers.CloseGroupController]).run(function($log) { + mifosX.ng.application.controller('CloseGroupController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', 'dateFilter', mifosX.controllers.CloseGroupController]).run(function ($log) { $log.info("CloseGroupController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/CreateGroupController.js b/app/scripts/controllers/groups/CreateGroupController.js index 781fff9c..2f35cdae 100644 --- a/app/scripts/controllers/groups/CreateGroupController.js +++ b/app/scripts/controllers/groups/CreateGroupController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CreateGroupController: function(scope, resourceFactory, location,dateFilter) { + CreateGroupController: function (scope, resourceFactory, location, dateFilter) { scope.offices = []; scope.staffs = []; scope.data = {}; @@ -13,83 +13,79 @@ scope.added = []; scope.formData = {}; scope.formData.clientMembers = []; - resourceFactory.groupTemplateResource.get({orderBy: 'name', sortOrder: 'ASC'}, function(data) { + resourceFactory.groupTemplateResource.get({orderBy: 'name', sortOrder: 'ASC'}, function (data) { scope.offices = data.officeOptions; scope.staffs = data.staffOptions; scope.clients = data.clientOptions; }); - scope.add = function(){ - for(var i in this.available) - { - for(var j in scope.clients){ - if(scope.clients[j].id == this.available[i]) - { + scope.add = function () { + for (var i in this.available) { + for (var j in scope.clients) { + if (scope.clients[j].id == this.available[i]) { var temp = {}; temp.id = this.available[i]; temp.displayName = scope.clients[j].displayName; scope.addedClients.push(temp); - scope.clients.splice(j,1); + scope.clients.splice(j, 1); } } } }; - scope.sub = function(){ - for(var i in this.added) - { - for(var j in scope.addedClients){ - if(scope.addedClients[j].id == this.added[i]) - { + scope.sub = function () { + for (var i in this.added) { + for (var j in scope.addedClients) { + if (scope.addedClients[j].id == this.added[i]) { var temp = {}; temp.id = this.added[i]; temp.displayName = scope.addedClients[j].displayName; scope.clients.push(temp); - scope.addedClients.splice(j,1); + scope.addedClients.splice(j, 1); } } } }; - scope.changeOffice =function(officeId) { + scope.changeOffice = function (officeId) { scope.addedClients = []; - resourceFactory.groupTemplateResource.get({staffInSelectedOfficeOnly : false, officeId : officeId - }, function(data) { + resourceFactory.groupTemplateResource.get({staffInSelectedOfficeOnly: false, officeId: officeId + }, function (data) { scope.staffs = data.staffOptions; }); - resourceFactory.groupTemplateResource.get({officeId : officeId }, function(data) { + resourceFactory.groupTemplateResource.get({officeId: officeId }, function (data) { scope.clients = data.clientOptions; }); }; - scope.setChoice = function(){ - if(this.formData.active){ + scope.setChoice = function () { + if (this.formData.active) { scope.choice = 1; } - else if(!this.formData.active){ + else if (!this.formData.active) { scope.choice = 0; } }; - scope.submit = function() { - for(var i in scope.addedClients){ + scope.submit = function () { + for (var i in scope.addedClients) { scope.formData.clientMembers[i] = scope.addedClients[i].id; } - if(this.formData.active){ - var reqDate = dateFilter(scope.first.date,scope.df); + if (this.formData.active) { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.activationDate = reqDate; } if (scope.first.submitondate) { - reqDat = dateFilter(scope.first.submitondate,scope.df); + reqDat = dateFilter(scope.first.submitondate, scope.df); this.formData.submittedOnDate = reqDat; } - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; this.formData.active = this.formData.active || false; - resourceFactory.groupResource.save(this.formData,function(data){ + resourceFactory.groupResource.save(this.formData, function (data) { location.path('/viewgroup/' + data.resourceId); }); }; } }); - mifosX.ng.application.controller('CreateGroupController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.CreateGroupController]).run(function($log) { + mifosX.ng.application.controller('CreateGroupController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateGroupController]).run(function ($log) { $log.info("CreateGroupController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/EditGroupController.js b/app/scripts/controllers/groups/EditGroupController.js index 8fb93762..c6db2bff 100644 --- a/app/scripts/controllers/groups/EditGroupController.js +++ b/app/scripts/controllers/groups/EditGroupController.js @@ -1,52 +1,52 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditGroupController: function(scope, resourceFactory,location, routeParams,dateFilter ) { + EditGroupController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.first = {}; scope.managecode = routeParams.managecode; scope.restrictDate = new Date(); - resourceFactory.groupResource.get({groupId: routeParams.id,associations:'clientMembers',template:'true'} , function(data) { + resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'clientMembers', template: 'true'}, function (data) { scope.editGroup = data; scope.formData = { - name:data.name, - externalId:data.externalId, - staffId:data.staffId - }; - if(data.activationDate){ - var actDate = dateFilter(data.activationDate,scope.df); + name: data.name, + externalId: data.externalId, + staffId: data.staffId + }; + if (data.activationDate) { + var actDate = dateFilter(data.activationDate, scope.df); scope.first.date = new Date(actDate); } }); - resourceFactory.groupResource.get({groupId: routeParams.id}, function(data) { - if (data.timeline.submittedOnDate) { - scope.mindate = new Date(data.timeline.submittedOnDate); - } + resourceFactory.groupResource.get({groupId: routeParams.id}, function (data) { + if (data.timeline.submittedOnDate) { + scope.mindate = new Date(data.timeline.submittedOnDate); + } }); - scope.updateGroup = function(){ - var reqDate = dateFilter(scope.first.date,scope.df); + scope.updateGroup = function () { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.activationDate = reqDate; this.formData.locale = "en"; this.formData.dateFormat = scope.df; - resourceFactory.groupResource.update({groupId:routeParams.id},this.formData , function(data) { - location.path('/viewgroup/'+routeParams.id); + resourceFactory.groupResource.update({groupId: routeParams.id}, this.formData, function (data) { + location.path('/viewgroup/' + routeParams.id); }); }; - scope.activate = function(){ - var reqDate = dateFilter(scope.first.date,scope.df); + scope.activate = function () { + var reqDate = dateFilter(scope.first.date, scope.df); var newActivation = new Object(); newActivation.activationDate = reqDate; newActivation.locale = scope.optlang.code; newActivation.dateFormat = scope.df; - resourceFactory.groupResource.save({groupId : routeParams.id,command:'activate'},newActivation, function(data){ - location.path('/viewgroup/'+routeParams.id); + resourceFactory.groupResource.save({groupId: routeParams.id, command: 'activate'}, newActivation, function (data) { + location.path('/viewgroup/' + routeParams.id); }); }; } }); - mifosX.ng.application.controller('EditGroupController', ['$scope','ResourceFactory','$location','$routeParams','dateFilter', mifosX.controllers.EditGroupController]).run(function($log) { + mifosX.ng.application.controller('EditGroupController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditGroupController]).run(function ($log) { $log.info("EditGroupController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/EditMeetingController.js b/app/scripts/controllers/groups/EditMeetingController.js index 37d650c3..fceb8f48 100644 --- a/app/scripts/controllers/groups/EditMeetingController.js +++ b/app/scripts/controllers/groups/EditMeetingController.js @@ -1,25 +1,30 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditMeetingController: function(scope, resourceFactory, location, routeParams,dateFilter) { + EditMeetingController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.formData = {}; - resourceFactory.attachMeetingResource.get({groupOrCenter : routeParams.entityType, groupOrCenterId : routeParams.groupOrCenterId, - templateSource : routeParams.calendarId, template:'true'}, function(data) { + resourceFactory.attachMeetingResource.get({groupOrCenter: routeParams.entityType, groupOrCenterId: routeParams.groupOrCenterId, + templateSource: routeParams.calendarId, template: 'true'}, function (data) { scope.entityType = routeParams.entityType; scope.groupOrCenterId = routeParams.groupOrCenterId; scope.calendarData = data; scope.restrictDate = new Date(); scope.first = {date: new Date(data.startDate)}; - scope.repeatsOptions = [{id:1,value:"daily"}, {id:2,value:"weekly"}, {id:3,value:"monthly"}, {id:4,value:"yearly"}]; - scope.repeatsEveryOptions = ["1","2","3"]; + scope.repeatsOptions = [ + {id: 1, value: "daily"}, + {id: 2, value: "weekly"}, + {id: 3, value: "monthly"}, + {id: 4, value: "yearly"} + ]; + scope.repeatsEveryOptions = ["1", "2", "3"]; scope.selectedPeriod(scope.calendarData.frequency.id); //to display default in select boxes scope.formData = { - repeating :scope.calendarData.repeating, - frequency:scope.calendarData.frequency.id, - interval:scope.calendarData.interval + repeating: scope.calendarData.repeating, + frequency: scope.calendarData.frequency.id, + interval: scope.calendarData.interval } //update interval option - for(var i in scope.repeatsEveryOptions) { + for (var i in scope.repeatsEveryOptions) { if (scope.repeatsEveryOptions[i] == scope.calendarData.interval) { scope.formData.interval = scope.repeatsEveryOptions[i]; } @@ -30,61 +35,60 @@ } }); - scope.selectedPeriod = function(period) { - if(period == 1) { - scope.repeatsEveryOptions = ["1","2","3"]; + scope.selectedPeriod = function (period) { + if (period == 1) { + scope.repeatsEveryOptions = ["1", "2", "3"]; scope.periodValue = "day(s)" } - if(period == 2) { - scope.repeatsEveryOptions = ["1","2","3"]; + if (period == 2) { + scope.repeatsEveryOptions = ["1", "2", "3"]; scope.formData.repeatsOnDay = '1'; scope.periodValue = "week(s)"; - scope.repeatsOnOptions = [ - {name : "MON", value : "1"}, - {name : "TUE", value : "2"}, - {name : "WED", value : "3"}, - {name : "THU", value : "4"}, - {name : "FRI", value : "5"}, - {name : "SAT", value : "6"}, - {name : "SUN", value : "7"} + scope.repeatsOnOptions = [ + {name: "MON", value: "1"}, + {name: "TUE", value: "2"}, + {name: "WED", value: "3"}, + {name: "THU", value: "4"}, + {name: "FRI", value: "5"}, + {name: "SAT", value: "6"}, + {name: "SUN", value: "7"} ] } - if(period == 3) { + if (period == 3) { scope.periodValue = "month(s)"; - scope.repeatsEveryOptions = ["1","2","3","4", "5", "6", "7", "8", "9", "10", "11"]; + scope.repeatsEveryOptions = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"]; } - if(period == 4) { + if (period == 4) { scope.periodValue = "year(s)"; - scope.repeatsEveryOptions = ["1","2","3"]; + scope.repeatsEveryOptions = ["1", "2", "3"]; } } - scope.submit = function() { - var reqDate = dateFilter(scope.first.date,scope.df); + scope.submit = function () { + var reqDate = dateFilter(scope.first.date, scope.df); this.formData.startDate = reqDate; this.formData.title = scope.calendarData.title; this.formData.locale = "en"; this.formData.dateFormat = "dd MMMM yyyy"; this.formData.typeId = "1"; - if(this.formData.interval <0) - { + if (this.formData.interval < 0) { scope.formData.interval = Math.abs(this.formData.interval); } - resourceFactory.attachMeetingResource.update({groupOrCenter : routeParams.entityType, - groupOrCenterId : routeParams.groupOrCenterId,templateSource : routeParams.calendarId}, this.formData,function(data){ - var destURI = ""; - if(routeParams.entityType == "groups") { - destURI = "viewgroup/"+routeParams.groupOrCenterId; + resourceFactory.attachMeetingResource.update({groupOrCenter: routeParams.entityType, + groupOrCenterId: routeParams.groupOrCenterId, templateSource: routeParams.calendarId}, this.formData, function (data) { + var destURI = ""; + if (routeParams.entityType == "groups") { + destURI = "viewgroup/" + routeParams.groupOrCenterId; } - else if(routeParams.entityType == "centers") { - destURI = "viewcenter/"+routeParams.groupOrCenterId; + else if (routeParams.entityType == "centers") { + destURI = "viewcenter/" + routeParams.groupOrCenterId; } location.path(destURI); }); }; } }); - mifosX.ng.application.controller('EditMeetingController', ['$scope', 'ResourceFactory', '$location', '$routeParams','dateFilter', mifosX.controllers.EditMeetingController]).run(function($log) { + mifosX.ng.application.controller('EditMeetingController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditMeetingController]).run(function ($log) { $log.info("EditMeetingController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/groups/GroupAttendanceController.js b/app/scripts/controllers/groups/GroupAttendanceController.js index 017fc82c..5ed11cc0 100644 --- a/app/scripts/controllers/groups/GroupAttendanceController.js +++ b/app/scripts/controllers/groups/GroupAttendanceController.js @@ -1,43 +1,42 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - GroupAttendanceController: function(scope, resourceFactory , routeParams, location,dateFilter) { + GroupAttendanceController: function (scope, resourceFactory, routeParams, location, dateFilter) { scope.group = []; scope.first = {}; scope.first.date = new Date(); scope.formData = {}; - resourceFactory.groupResource.get({groupId: routeParams.groupId,associations:'all'} , function(data) { + resourceFactory.groupResource.get({groupId: routeParams.groupId, associations: 'all'}, function (data) { scope.group = data; scope.meeting = data.collectionMeetingCalendar; }); - resourceFactory.groupMeetingResource.getMeetingInfo({groupId: routeParams.groupId,templateSource: 'template',calenderId: routeParams.calendarId}, function(data) { + resourceFactory.groupMeetingResource.getMeetingInfo({groupId: routeParams.groupId, templateSource: 'template', calenderId: routeParams.calendarId}, function (data) { scope.clients = data.clients; scope.attendanceOptions = data.attendanceTypeOptions; /*the following code help to display default attendance type is 'present'*/ - for (var i=0; i 0 ? true : false; scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; scope.singleRow = []; - for(var i in data.columnHeaders) { + for (var i in data.columnHeaders) { if (scope.datatabledetails.columnHeaders[i].columnCode) { - for (var j in scope.datatabledetails.columnHeaders[i].columnValues){ - for(var k in data.data) { + for (var j in scope.datatabledetails.columnHeaders[i].columnValues) { + for (var k in data.data) { if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; } } } - } - } - if(scope.datatabledetails.isData){ - for(var i in data.columnHeaders){ - if(!scope.datatabledetails.isMultirow){ - var row = {}; - row.key = data.columnHeaders[i].columnName; - row.value = data.data[0].row[i]; - scope.singleRow.push(row); } - }} + } + if (scope.datatabledetails.isData) { + for (var i in data.columnHeaders) { + if (!scope.datatabledetails.isMultirow) { + var row = {}; + row.key = data.columnHeaders[i].columnName; + row.value = data.data[0].row[i]; + scope.singleRow.push(row); + } + } + } }); }; scope.deleteAll = function (apptableName, entityId) { - resourceFactory.DataTablesResource.delete({datatablename:apptableName, entityId:entityId, genericResultSet:'true'}, {}, function(data){ + resourceFactory.DataTablesResource.delete({datatablename: apptableName, entityId: entityId, genericResultSet: 'true'}, {}, function (data) { route.reload(); }); }; } }); - mifosX.ng.application.controller('ViewGroupController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory','dateFilter','$modal', mifosX.controllers.ViewGroupController]).run(function($log) { + mifosX.ng.application.controller('ViewGroupController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', 'dateFilter', '$modal', mifosX.controllers.ViewGroupController]).run(function ($log) { $log.info("ViewGroupController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/AddLoanChargeController.js b/app/scripts/controllers/loanAccount/AddLoanChargeController.js index 46a228d4..6ac0279a 100644 --- a/app/scripts/controllers/loanAccount/AddLoanChargeController.js +++ b/app/scripts/controllers/loanAccount/AddLoanChargeController.js @@ -1,41 +1,42 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AddLoanChargeController: function(scope, resourceFactory, routeParams, location, dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + AddLoanChargeController: function (scope, resourceFactory, routeParams, location, dateFilter) { - scope.charges = []; - scope.formData = {}; - scope.isCollapsed = true; - scope.loanId =routeParams.id; - resourceFactory.loanChargeTemplateResource.get({loanId:scope.loanId}, function(data) { - scope.charges = data.chargeOptions; - }); + scope.charges = []; + scope.formData = {}; + scope.isCollapsed = true; + scope.loanId = routeParams.id; + resourceFactory.loanChargeTemplateResource.get({loanId: scope.loanId}, function (data) { + scope.charges = data.chargeOptions; + }); - scope.selectCharge = function() { - resourceFactory.chargeResource.get({chargeId:scope.formData.chargeId, template:true}, function(data) { - scope.isCollapsed = false; - scope.chargeData = data; - scope.formData.amount = data.amount; - }); - }; + scope.selectCharge = function () { + resourceFactory.chargeResource.get({chargeId: scope.formData.chargeId, template: true}, function (data) { + scope.isCollapsed = false; + scope.chargeData = data; + scope.formData.amount = data.amount; + }); + }; - scope.cancel = function() { - location.path('/viewloanaccount/' + scope.loanId); - }; + scope.cancel = function () { + location.path('/viewloanaccount/' + scope.loanId); + }; - scope.submit = function() { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - if (this.formData.dueDate) { - this.formData.dueDate = dateFilter(this.formData.dueDate,scope.df); - }; - resourceFactory.loanResource.save({resourceType:'charges', loanId:scope.loanId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }; + scope.submit = function () { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + if (this.formData.dueDate) { + this.formData.dueDate = dateFilter(this.formData.dueDate, scope.df); + } + ; + resourceFactory.loanResource.save({resourceType: 'charges', loanId: scope.loanId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + }; - } - }); - mifosX.ng.application.controller('AddLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.AddLoanChargeController]).run(function($log) { - $log.info("AddLoanChargeController initialized"); - }); + } + }); + mifosX.ng.application.controller('AddLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.AddLoanChargeController]).run(function ($log) { + $log.info("AddLoanChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/AddLoanCollateralController.js b/app/scripts/controllers/loanAccount/AddLoanCollateralController.js index a530c567..b66ca00a 100644 --- a/app/scripts/controllers/loanAccount/AddLoanCollateralController.js +++ b/app/scripts/controllers/loanAccount/AddLoanCollateralController.js @@ -1,29 +1,29 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AddLoanCollateralController: function(scope, resourceFactory, routeParams, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + AddLoanCollateralController: function (scope, resourceFactory, routeParams, location) { - scope.collateralTypes = []; - scope.formData = {}; - scope.loanId =routeParams.id; - resourceFactory.loanCollateralTemplateResource.get({loanId:scope.loanId}, function(data) { - scope.collateralTypes = data.allowedCollateralTypes; - scope.formData.collateralTypeId = data.allowedCollateralTypes[0].id; - }); + scope.collateralTypes = []; + scope.formData = {}; + scope.loanId = routeParams.id; + resourceFactory.loanCollateralTemplateResource.get({loanId: scope.loanId}, function (data) { + scope.collateralTypes = data.allowedCollateralTypes; + scope.formData.collateralTypeId = data.allowedCollateralTypes[0].id; + }); - scope.cancel = function() { - location.path('/viewloanaccount/' + scope.loanId); - }; + scope.cancel = function () { + location.path('/viewloanaccount/' + scope.loanId); + }; - scope.submit = function() { - this.formData.locale = scope.optlang.code; - resourceFactory.loanResource.save({resourceType:'collaterals', loanId:scope.loanId}, this.formData, function(data){ - location.path('/loan/' + data.loanId +'/viewcollateral/'+data.resourceId); - }); - }; + scope.submit = function () { + this.formData.locale = scope.optlang.code; + resourceFactory.loanResource.save({resourceType: 'collaterals', loanId: scope.loanId}, this.formData, function (data) { + location.path('/loan/' + data.loanId + '/viewcollateral/' + data.resourceId); + }); + }; - } - }); - mifosX.ng.application.controller('AddLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.AddLoanCollateralController]).run(function($log) { - $log.info("AddLoanCollateralController initialized"); - }); + } + }); + mifosX.ng.application.controller('AddLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.AddLoanCollateralController]).run(function ($log) { + $log.info("AddLoanCollateralController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/AssignLoanOfficerController.js b/app/scripts/controllers/loanAccount/AssignLoanOfficerController.js index 4841e407..f5ddde04 100644 --- a/app/scripts/controllers/loanAccount/AssignLoanOfficerController.js +++ b/app/scripts/controllers/loanAccount/AssignLoanOfficerController.js @@ -1,37 +1,37 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AssignLoanOfficerController: function(scope, resourceFactory, routeParams, location, dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + AssignLoanOfficerController: function (scope, resourceFactory, routeParams, location, dateFilter) { - scope.loanOfficers = []; - scope.formData = {}; - scope.loanId =routeParams.id; - var fields = "id,loanOfficerId,loanOfficerOptions"; + scope.loanOfficers = []; + scope.formData = {}; + scope.loanId = routeParams.id; + var fields = "id,loanOfficerId,loanOfficerOptions"; - resourceFactory.loanResource.get({loanId:scope.loanId, template:true, fields:fields}, function(data) { - if (data.loanOfficerOptions) { - scope.loanOfficers = data.loanOfficerOptions; - scope.formData.toLoanOfficerId = data.loanOfficerOptions[0].id; - } - scope.data = data; - }); + resourceFactory.loanResource.get({loanId: scope.loanId, template: true, fields: fields}, function (data) { + if (data.loanOfficerOptions) { + scope.loanOfficers = data.loanOfficerOptions; + scope.formData.toLoanOfficerId = data.loanOfficerOptions[0].id; + } + scope.data = data; + }); - scope.cancel = function() { - location.path('/viewloanaccount/' + scope.loanId); - }; + scope.cancel = function () { + location.path('/viewloanaccount/' + scope.loanId); + }; - scope.submit = function() { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - this.formData.fromLoanOfficerId = scope.data.loanOfficerId || ""; - this.formData.assignmentDate = dateFilter(this.formData.assignmentDate,scope.df); - resourceFactory.loanResource.save({command:'assignloanofficer', loanId:scope.loanId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }; + scope.submit = function () { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + this.formData.fromLoanOfficerId = scope.data.loanOfficerId || ""; + this.formData.assignmentDate = dateFilter(this.formData.assignmentDate, scope.df); + resourceFactory.loanResource.save({command: 'assignloanofficer', loanId: scope.loanId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + }; - } - }); - mifosX.ng.application.controller('AssignLoanOfficerController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.AssignLoanOfficerController]).run(function($log) { - $log.info("AssignLoanOfficerController initialized"); - }); + } + }); + mifosX.ng.application.controller('AssignLoanOfficerController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.AssignLoanOfficerController]).run(function ($log) { + $log.info("AssignLoanOfficerController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/EditGuarantorController.js b/app/scripts/controllers/loanAccount/EditGuarantorController.js index 405a091f..aaf42404 100644 --- a/app/scripts/controllers/loanAccount/EditGuarantorController.js +++ b/app/scripts/controllers/loanAccount/EditGuarantorController.js @@ -1,11 +1,11 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditGuarantorController: function(scope, resourceFactory, routeParams, location,dateFilter) { + EditGuarantorController: function (scope, resourceFactory, routeParams, location, dateFilter) { scope.template = {}; scope.clientview = false; scope.date = {}; scope.restrictDate = new Date(); - resourceFactory.guarantorResource.get({ loanId: routeParams.loanId,templateResource:routeParams.id,template:true}, function(data) { + resourceFactory.guarantorResource.get({ loanId: routeParams.loanId, templateResource: routeParams.id, template: true}, function (data) { scope.template = data; scope.formData = { firstname: data.firstname, @@ -24,29 +24,29 @@ scope.date.first = new Date(dateFilter(data.dob, scope.df)); } }); - scope.submit = function(){ + scope.submit = function () { var guarantor = {}; - var reqDate = dateFilter(scope.date.first,scope.df); - guarantor.addressLine1=this.formData.addressLine1; - guarantor.addressLine2=this.formData.addressLine2; + var reqDate = dateFilter(scope.date.first, scope.df); + guarantor.addressLine1 = this.formData.addressLine1; + guarantor.addressLine2 = this.formData.addressLine2; guarantor.city = this.formData.city; - guarantor.dob=reqDate; - guarantor.zip=this.formData.zip; - guarantor.dateFormat="dd MMMM yyyy"; - guarantor.locale=scope.optlang.code; + guarantor.dob = reqDate; + guarantor.zip = this.formData.zip; + guarantor.dateFormat = "dd MMMM yyyy"; + guarantor.locale = scope.optlang.code; guarantor.firstname = this.formData.firstname; guarantor.lastname = this.formData.lastname; guarantor.mobileNumber = this.formData.mobile; guarantor.housePhoneNumber = this.formData.residence; guarantor.clientRelationshipTypeId = this.formData.relationshipType; guarantor.guarantorTypeId = 3; - resourceFactory.guarantorResource.update({ loanId:routeParams.loanId,templateResource:routeParams.id},guarantor, function(data) { - location.path('viewloanaccount/'+routeParams.loanId); + resourceFactory.guarantorResource.update({ loanId: routeParams.loanId, templateResource: routeParams.id}, guarantor, function (data) { + location.path('viewloanaccount/' + routeParams.loanId); }); }; } }); - mifosX.ng.application.controller('EditGuarantorController', ['$scope', 'ResourceFactory', '$routeParams', '$location','dateFilter', mifosX.controllers.EditGuarantorController]).run(function($log) { + mifosX.ng.application.controller('EditGuarantorController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.EditGuarantorController]).run(function ($log) { $log.info("EditGuarantorController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/EditLoanAccAppController.js b/app/scripts/controllers/loanAccount/EditLoanAccAppController.js index 034b36d8..92a56eeb 100644 --- a/app/scripts/controllers/loanAccount/EditLoanAccAppController.js +++ b/app/scripts/controllers/loanAccount/EditLoanAccAppController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditLoanAccAppController: function(scope, routeParams, resourceFactory, location, dateFilter) { + EditLoanAccAppController: function (scope, routeParams, resourceFactory, location, dateFilter) { scope.previewRepayment = false; scope.formData = {}; @@ -9,238 +9,258 @@ scope.collaterals = []; scope.restrictDate = new Date(); - resourceFactory.loanResource.get({loanId : routeParams.id, template:true, associations:'charges,collateral,meeting,multiDisburseDetails'}, function(data) { - scope.loanaccountinfo = data; + resourceFactory.loanResource.get({loanId: routeParams.id, template: true, associations: 'charges,collateral,meeting,multiDisburseDetails'}, function (data) { + scope.loanaccountinfo = data; - resourceFactory.loanResource.get({resourceType : 'template', templateType:'collateral', productId:data.loanProductId, fields:'id,loanCollateralOptions'}, function(data) { + resourceFactory.loanResource.get({resourceType: 'template', templateType: 'collateral', productId: data.loanProductId, fields: 'id,loanCollateralOptions'}, function (data) { scope.collateralOptions = data.loanCollateralOptions || []; - }); - - if (data.clientId) { + }); + + if (data.clientId) { scope.clientId = data.clientId; scope.clientName = data.clientName; scope.formData.clientId = scope.clientId; - } - - if (data.group) { + } + + if (data.group) { scope.groupId = data.group.id; scope.groupName = data.group.name; scope.formData.groupId = scope.groupId; - } + } - if (scope.clientId && scope.groupId) { scope.templateType = 'jlg'; } - else if (scope.groupId) { scope.templateType = 'group'; } - else if (scope.clientId) { scope.templateType = 'individual'; } + if (scope.clientId && scope.groupId) { + scope.templateType = 'jlg'; + } + else if (scope.groupId) { + scope.templateType = 'group'; + } + else if (scope.clientId) { + scope.templateType = 'individual'; + } - scope.formData.loanOfficerId = data.loanOfficerId; - scope.formData.loanPurposeId = data.loanPurposeId; + scope.formData.loanOfficerId = data.loanOfficerId; + scope.formData.loanPurposeId = data.loanPurposeId; - //update collaterals - if (scope.loanaccountinfo.collateral) { + //update collaterals + if (scope.loanaccountinfo.collateral) { for (var i in scope.loanaccountinfo.collateral) { - scope.collaterals.push({type:scope.loanaccountinfo.collateral[i].id, name:scope.loanaccountinfo.collateral[i].type.name, value:scope.loanaccountinfo.collateral[i].value, description:scope.loanaccountinfo.collateral[i].description}); + scope.collaterals.push({type: scope.loanaccountinfo.collateral[i].id, name: scope.loanaccountinfo.collateral[i].type.name, value: scope.loanaccountinfo.collateral[i].value, description: scope.loanaccountinfo.collateral[i].description}); } - } + } + + scope.previewClientLoanAccInfo(); - scope.previewClientLoanAccInfo(); - }); - scope.loanProductChange = function(loanProductId) { + scope.loanProductChange = function (loanProductId) { - var inparams = { resourceType:'template', productId:loanProductId, templateType:scope.templateType }; - if (scope.clientId) { inparams.clientId = scope.clientId; } - if (scope.groupId) { inparams.groupId = scope.groupId; } - - resourceFactory.loanResource.get(inparams, function(data) { - scope.loanaccountinfo = data; - scope.collaterals = []; - scope.previewClientLoanAccInfo(); - }); - - resourceFactory.loanResource.get({resourceType : 'template', templateType:'collateral', productId:loanProductId, fields:'id,loanCollateralOptions'}, function(data) { - scope.collateralOptions = data.loanCollateralOptions || []; - }); - } - - scope.previewClientLoanAccInfo = function() { - scope.previewRepayment = false; - for (var i in scope.loanaccountinfo.charges) { - if (scope.loanaccountinfo.charges[i].dueDate) { - scope.loanaccountinfo.charges[i].dueDate = new Date(scope.loanaccountinfo.charges[i].dueDate); + var inparams = { resourceType: 'template', productId: loanProductId, templateType: scope.templateType }; + if (scope.clientId) { + inparams.clientId = scope.clientId; + } + if (scope.groupId) { + inparams.groupId = scope.groupId; } - } - - scope.charges = scope.loanaccountinfo.charges || []; - scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; - if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = new Date(scope.formData.disbursementData[i].expectedDisbursementDate); - } - } - - if (scope.loanaccountinfo.timeline.submittedOnDate) { scope.formData.submittedOnDate = new Date(scope.loanaccountinfo.timeline.submittedOnDate); } - if (scope.loanaccountinfo.timeline.expectedDisbursementDate) { scope.formData.expectedDisbursementDate = new Date(scope.loanaccountinfo.timeline.expectedDisbursementDate); } - if (scope.loanaccountinfo.interestChargedFromDate) { scope.formData.interestChargedFromDate = new Date(scope.loanaccountinfo.interestChargedFromDate); } - if (scope.loanaccountinfo.expectedFirstRepaymentOnDate) { scope.formData.repaymentsStartingFromDate = new Date(scope.loanaccountinfo.expectedFirstRepaymentOnDate); } - scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan - scope.formData.productId = scope.loanaccountinfo.loanProductId; - scope.formData.fundId = scope.loanaccountinfo.fundId; - scope.formData.principal = scope.loanaccountinfo.principal; - scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; - scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; - scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; - scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; - scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; - scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; - scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; - scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; - scope.formData.interestType = scope.loanaccountinfo.interestType.id; - scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; - scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; - scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; - scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; - scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; - scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; - scope.formData.syncDisbursementWithMeeting = scope.loanaccountinfo.syncDisbursementWithMeeting; - scope.formData.fixedEmiAmount=scope.loanaccountinfo.fixedEmiAmount; - scope.formData.maxOutstandingLoanBalance=scope.loanaccountinfo.maxOutstandingLoanBalance; - - if (scope.loanaccountinfo.meeting) { - scope.formData.syncRepaymentsWithMeeting = true; - } - - if (scope.loanaccountinfo.linkedAccount) { - scope.formData.linkAccountId = scope.loanaccountinfo.linkedAccount.id; - } - - - } - - scope.addCharge = function() { - if (scope.chargeFormData.chargeId) { - resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function(data){ - data.chargeId = data.id; - data.id = null; - data.amountOrPercentage=data.amount; - scope.charges.push(data); - scope.chargeFormData.chargeId = undefined; + resourceFactory.loanResource.get(inparams, function (data) { + scope.loanaccountinfo = data; + scope.collaterals = []; + scope.previewClientLoanAccInfo(); + }); + + resourceFactory.loanResource.get({resourceType: 'template', templateType: 'collateral', productId: loanProductId, fields: 'id,loanCollateralOptions'}, function (data) { + scope.collateralOptions = data.loanCollateralOptions || []; }); - } } - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); + scope.previewClientLoanAccInfo = function () { + scope.previewRepayment = false; + for (var i in scope.loanaccountinfo.charges) { + if (scope.loanaccountinfo.charges[i].dueDate) { + scope.loanaccountinfo.charges[i].dueDate = new Date(scope.loanaccountinfo.charges[i].dueDate); + } + } + + + scope.charges = scope.loanaccountinfo.charges || []; + scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; + if (scope.formData.disbursementData.length > 0) { + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = new Date(scope.formData.disbursementData[i].expectedDisbursementDate); + } + } + + if (scope.loanaccountinfo.timeline.submittedOnDate) { + scope.formData.submittedOnDate = new Date(scope.loanaccountinfo.timeline.submittedOnDate); + } + if (scope.loanaccountinfo.timeline.expectedDisbursementDate) { + scope.formData.expectedDisbursementDate = new Date(scope.loanaccountinfo.timeline.expectedDisbursementDate); + } + if (scope.loanaccountinfo.interestChargedFromDate) { + scope.formData.interestChargedFromDate = new Date(scope.loanaccountinfo.interestChargedFromDate); + } + if (scope.loanaccountinfo.expectedFirstRepaymentOnDate) { + scope.formData.repaymentsStartingFromDate = new Date(scope.loanaccountinfo.expectedFirstRepaymentOnDate); + } + scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan + scope.formData.productId = scope.loanaccountinfo.loanProductId; + scope.formData.fundId = scope.loanaccountinfo.fundId; + scope.formData.principal = scope.loanaccountinfo.principal; + scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; + scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; + scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; + scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; + scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; + scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; + scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; + scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; + scope.formData.interestType = scope.loanaccountinfo.interestType.id; + scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; + scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; + scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; + scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; + scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; + scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; + scope.formData.syncDisbursementWithMeeting = scope.loanaccountinfo.syncDisbursementWithMeeting; + scope.formData.fixedEmiAmount = scope.loanaccountinfo.fixedEmiAmount; + scope.formData.maxOutstandingLoanBalance = scope.loanaccountinfo.maxOutstandingLoanBalance; + + if (scope.loanaccountinfo.meeting) { + scope.formData.syncRepaymentsWithMeeting = true; + } + + if (scope.loanaccountinfo.linkedAccount) { + scope.formData.linkAccountId = scope.loanaccountinfo.linkedAccount.id; + } + + } - scope.addTranches = function() { - scope.formData.disbursementData.push({ - }); + scope.addCharge = function () { + if (scope.chargeFormData.chargeId) { + resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function (data) { + data.chargeId = data.id; + data.id = null; + data.amountOrPercentage = data.amount; + scope.charges.push(data); + scope.chargeFormData.chargeId = undefined; + }); + } + } + + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + } + + scope.addTranches = function () { + scope.formData.disbursementData.push({ + }); }; - scope.deleteTranches = function(index) { - scope.formData.disbursementData.splice(index,1); + scope.deleteTranches = function (index) { + scope.formData.disbursementData.splice(index, 1); } - scope.syncRepaymentsWithMeetingchange = function() { - if (!scope.formData.syncRepaymentsWithMeeting) { - scope.formData.syncDisbursementWithMeeting=false; - } + scope.syncRepaymentsWithMeetingchange = function () { + if (!scope.formData.syncRepaymentsWithMeeting) { + scope.formData.syncDisbursementWithMeeting = false; + } }; - scope.syncDisbursementWithMeetingchange = function() { - if (scope.formData.syncDisbursementWithMeeting) { - scope.formData.syncRepaymentsWithMeeting=true; - } + scope.syncDisbursementWithMeetingchange = function () { + if (scope.formData.syncDisbursementWithMeeting) { + scope.formData.syncRepaymentsWithMeeting = true; + } }; scope.addCollateral = function () { - if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { - scope.collaterals.push({type:scope.collateralFormData.collateralIdTemplate.id, name:scope.collateralFormData.collateralIdTemplate.name, value:scope.collateralFormData.collateralValueTemplate, description:scope.collateralFormData.collateralDescriptionTemplate}); - scope.collateralFormData.collateralIdTemplate = undefined; - scope.collateralFormData.collateralValueTemplate = undefined; - scope.collateralFormData.collateralDescriptionTemplate = undefined; - } + if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { + scope.collaterals.push({type: scope.collateralFormData.collateralIdTemplate.id, name: scope.collateralFormData.collateralIdTemplate.name, value: scope.collateralFormData.collateralValueTemplate, description: scope.collateralFormData.collateralDescriptionTemplate}); + scope.collateralFormData.collateralIdTemplate = undefined; + scope.collateralFormData.collateralValueTemplate = undefined; + scope.collateralFormData.collateralDescriptionTemplate = undefined; + } }; scope.deleteCollateral = function (index) { - scope.collaterals.splice(index,1); + scope.collaterals.splice(index, 1); }; - scope.previewRepayments = function() { - // Make sure charges and collaterals are empty before initializing. + scope.previewRepayments = function () { + // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; if (scope.charges.length > 0) { - scope.formData.charges = []; - for (var i in scope.charges) { - scope.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amountOrPercentage, dueDate:dateFilter(scope.charges[i].dueDate,scope.df) }); - } + scope.formData.charges = []; + for (var i in scope.charges) { + scope.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amountOrPercentage, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate,'dd MMMM yyyy'); - } + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate, 'dd MMMM yyyy'); + } } if (scope.collaterals.length > 0) { - scope.formData.collateral = []; - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + scope.formData.collateral = []; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; - scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; } delete this.formData.syncRepaymentsWithMeeting; this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; this.formData.loanType = scope.templateType; - this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate,scope.df); - this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate,scope.df); - this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate,scope.df); + this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate, scope.df); + this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate, scope.df); + this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate, scope.df); - resourceFactory.loanResource.save({command:'calculateLoanSchedule'}, this.formData,function(data){ - scope.repaymentscheduleinfo = data; - scope.previewRepayment = true; - scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; - }); + resourceFactory.loanResource.save({command: 'calculateLoanSchedule'}, this.formData, function (data) { + scope.repaymentscheduleinfo = data; + scope.previewRepayment = true; + scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; + }); } - scope.submit = function() { + scope.submit = function () { // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate,'dd MMMM yyyy'); - } + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate, 'dd MMMM yyyy'); + } } scope.formData.charges = []; if (scope.charges.length > 0) { - for (var i in scope.charges) { - scope.formData.charges.push({id : scope.charges[i].id, chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amountOrPercentage, dueDate:dateFilter(scope.charges[i].dueDate,scope.df) }); - } + for (var i in scope.charges) { + scope.formData.charges.push({id: scope.charges[i].id, chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amountOrPercentage, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } scope.formData.collateral = []; if (scope.collaterals.length > 0) { - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; } delete this.formData.syncRepaymentsWithMeeting; delete this.formData.interestRateFrequencyType; @@ -248,22 +268,22 @@ this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; this.formData.loanType = scope.templateType; - this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate,scope.df); - this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate,scope.df); - this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate,scope.df); - this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate,scope.df); + this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate, scope.df); + this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate, scope.df); + this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate, scope.df); + this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate, scope.df); - resourceFactory.loanResource.put({loanId : routeParams.id},this.formData,function(data){ - location.path('/viewloanaccount/' + data.loanId); + resourceFactory.loanResource.put({loanId: routeParams.id}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); }); }; - scope.cancel = function() { - location.path('/viewloanaccount/' + routeParams.id); + scope.cancel = function () { + location.path('/viewloanaccount/' + routeParams.id); } } }); - mifosX.ng.application.controller('EditLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditLoanAccAppController]).run(function($log) { + mifosX.ng.application.controller('EditLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditLoanAccAppController]).run(function ($log) { $log.info("EditLoanAccAppController initialized"); }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/loanAccount/EditLoanChargeController.js b/app/scripts/controllers/loanAccount/EditLoanChargeController.js index 52a9a375..2f131014 100644 --- a/app/scripts/controllers/loanAccount/EditLoanChargeController.js +++ b/app/scripts/controllers/loanAccount/EditLoanChargeController.js @@ -1,28 +1,28 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditLoanChargeController: function(scope, resourceFactory, routeParams, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + EditLoanChargeController: function (scope, resourceFactory, routeParams, location) { - scope.loanId = routeParams.loanId; - scope.chargeId = routeParams.id; - resourceFactory.loanResource.get({ resourceType:'charges', loanId:scope.loanId, resourceId:scope.chargeId, template:true }, function(data) { - scope.formData = {amount:data.amount}; - }); + scope.loanId = routeParams.loanId; + scope.chargeId = routeParams.id; + resourceFactory.loanResource.get({ resourceType: 'charges', loanId: scope.loanId, resourceId: scope.chargeId, template: true }, function (data) { + scope.formData = {amount: data.amount}; + }); - scope.cancel = function() { - location.path('/viewloanaccount/' + scope.loanId); - }; + scope.cancel = function () { + location.path('/viewloanaccount/' + scope.loanId); + }; - scope.submit = function() { - this.formData.locale = scope.optlang.code; - resourceFactory.loanResource.put({resourceType:'charges', resourceId:scope.chargeId, loanId:scope.loanId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }; + scope.submit = function () { + this.formData.locale = scope.optlang.code; + resourceFactory.loanResource.put({resourceType: 'charges', resourceId: scope.chargeId, loanId: scope.loanId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + }; - } - }); - mifosX.ng.application.controller('EditLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.EditLoanChargeController]).run(function($log) { - $log.info("EditLoanChargeController initialized"); - }); + } + }); + mifosX.ng.application.controller('EditLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.EditLoanChargeController]).run(function ($log) { + $log.info("EditLoanChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/EditLoanCollateralController.js b/app/scripts/controllers/loanAccount/EditLoanCollateralController.js index a2e383b5..80eac1f6 100644 --- a/app/scripts/controllers/loanAccount/EditLoanCollateralController.js +++ b/app/scripts/controllers/loanAccount/EditLoanCollateralController.js @@ -1,28 +1,28 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditLoanCollateralController: function(scope, resourceFactory, routeParams, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + EditLoanCollateralController: function (scope, resourceFactory, routeParams, location) { - scope.loanId = routeParams.loanId; - scope.collateralId = routeParams.id; - resourceFactory.loanResource.get({ resourceType:'collaterals', loanId:scope.loanId, resourceId:scope.collateralId, template:true }, function(data) { - scope.formData = {collateralTypeId:data.type.id, value:data.value, description: data.description}; - scope.collateralTypes = data.allowedCollateralTypes; - }); + scope.loanId = routeParams.loanId; + scope.collateralId = routeParams.id; + resourceFactory.loanResource.get({ resourceType: 'collaterals', loanId: scope.loanId, resourceId: scope.collateralId, template: true }, function (data) { + scope.formData = {collateralTypeId: data.type.id, value: data.value, description: data.description}; + scope.collateralTypes = data.allowedCollateralTypes; + }); - scope.cancel = function() { - location.path('/viewloanaccount/' + scope.loanId); - }; + scope.cancel = function () { + location.path('/viewloanaccount/' + scope.loanId); + }; - scope.submit = function() { - this.formData.locale = scope.optlang.code; - resourceFactory.loanResource.put({resourceType:'collaterals', resourceId:scope.collateralId, loanId:scope.loanId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }; + scope.submit = function () { + this.formData.locale = scope.optlang.code; + resourceFactory.loanResource.put({resourceType: 'collaterals', resourceId: scope.collateralId, loanId: scope.loanId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + }; - } - }); - mifosX.ng.application.controller('EditLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.EditLoanCollateralController]).run(function($log) { - $log.info("EditLoanCollateralController initialized"); - }); + } + }); + mifosX.ng.application.controller('EditLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.EditLoanCollateralController]).run(function ($log) { + $log.info("EditLoanCollateralController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/GuarantorController.js b/app/scripts/controllers/loanAccount/GuarantorController.js index 4586d273..575104e7 100644 --- a/app/scripts/controllers/loanAccount/GuarantorController.js +++ b/app/scripts/controllers/loanAccount/GuarantorController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - GuarantorController: function(scope, resourceFactory, routeParams, location,dateFilter) { + GuarantorController: function (scope, resourceFactory, routeParams, location, dateFilter) { scope.template = {}; scope.clientview = false; scope.temp = true; @@ -8,28 +8,27 @@ scope.formData = {}; scope.restrictDate = new Date(); - resourceFactory.guarantorResource.get({ loanId:routeParams.id,templateResource:'template'}, function(data) { + resourceFactory.guarantorResource.get({ loanId: routeParams.id, templateResource: 'template'}, function (data) { scope.template = data; scope.loanId = routeParams.id; }); - resourceFactory.clientResource.getAllClients(function(data) { + resourceFactory.clientResource.getAllClients(function (data) { scope.clients = data.pageItems; }); - scope.viewClient = function(item){ + scope.viewClient = function (item) { scope.clientview = true; scope.client = item; }; - scope.checkClient = function(){ - if(!scope.temp){ + scope.checkClient = function () { + if (!scope.temp) { scope.clientview = false; } }; - scope.submit = function(){ + scope.submit = function () { var guarantor = {}; - var reqDate = dateFilter(scope.date.first,scope.df); - if(scope.temp==true) - { + var reqDate = dateFilter(scope.date.first, scope.df); + if (scope.temp == true) { guarantor.guarantorTypeId = scope.template.guarantorTypeOptions[0].id; guarantor.locale = scope.optlang.code; if (this.formData) { @@ -40,13 +39,13 @@ } } else if (this.formData) { - guarantor.addressLine1=this.formData.addressLine1; - guarantor.addressLine2=this.formData.addressLine2; + guarantor.addressLine1 = this.formData.addressLine1; + guarantor.addressLine2 = this.formData.addressLine2; guarantor.city = this.formData.city; - guarantor.dob=reqDate; - guarantor.zip=this.formData.zip; - guarantor.dateFormat="dd MMMM yyyy"; - guarantor.locale=scope.optlang.code; + guarantor.dob = reqDate; + guarantor.zip = this.formData.zip; + guarantor.dateFormat = "dd MMMM yyyy"; + guarantor.locale = scope.optlang.code; guarantor.firstname = this.formData.firstname; guarantor.lastname = this.formData.lastname; guarantor.mobileNumber = this.formData.mobile; @@ -54,13 +53,13 @@ guarantor.guarantorTypeId = scope.template.guarantorTypeOptions[2].id; guarantor.clientRelationshipTypeId = this.formData.relationshipType; } - resourceFactory.guarantorResource.save({ loanId:routeParams.id},guarantor, function(data) { - location.path('viewloanaccount/'+routeParams.id); + resourceFactory.guarantorResource.save({ loanId: routeParams.id}, guarantor, function (data) { + location.path('viewloanaccount/' + routeParams.id); }); }; } }); - mifosX.ng.application.controller('GuarantorController', ['$scope', 'ResourceFactory', '$routeParams', '$location','dateFilter', mifosX.controllers.GuarantorController]).run(function($log) { + mifosX.ng.application.controller('GuarantorController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.GuarantorController]).run(function ($log) { $log.info("GuarantorController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/LoanAccountActionsController.js b/app/scripts/controllers/loanAccount/LoanAccountActionsController.js index 622c8566..f2c0026b 100644 --- a/app/scripts/controllers/loanAccount/LoanAccountActionsController.js +++ b/app/scripts/controllers/loanAccount/LoanAccountActionsController.js @@ -1,268 +1,268 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - LoanAccountActionsController: function(scope, resourceFactory, location, routeParams, dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + LoanAccountActionsController: function (scope, resourceFactory, location, routeParams, dateFilter) { - scope.action = routeParams.action || ""; - scope.accountId = routeParams.id; - scope.formData = {}; - scope.showDateField = true; - scope.showNoteField = true; - scope.showAmountField = false; - scope.restrictDate = new Date(); - // Transaction UI Related - scope.isTransaction = false; - scope.showPaymentDetails =false; - scope.paymentTypes = []; - - switch (scope.action) { - case "approve": - scope.title = 'label.heading.approveloanaccount'; - scope.labelName = 'label.input.approvedondate'; - scope.modelName = 'approvedOnDate'; - scope.formData[scope.modelName] = new Date(); - break; - case "reject": - scope.title = 'label.heading.rejectloanaccount'; - scope.labelName = 'label.input.rejectedondate'; - scope.modelName = 'rejectedOnDate'; - scope.formData[scope.modelName] = new Date(); - break; - case "withdrawnByApplicant": - scope.title = 'label.heading.withdrawloanaccount'; - scope.labelName = 'label.input.withdrawnondate'; - scope.modelName = 'withdrawnOnDate'; - scope.formData[scope.modelName] = new Date(); - break; - case "undoapproval": - scope.title = 'label.heading.undoapproveloanaccount'; - scope.showDateField = false; - break; - case "undodisbursal": - scope.title = 'label.heading.undodisburseloanaccount'; - scope.showDateField = false; - break; - case "disburse": - scope.modelName = 'actualDisbursementDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'disburse'}, function(data){ - scope.paymentTypes=data.paymentTypeOptions; - if (data.paymentTypeOptions.length > 0) { - scope.formData.paymentTypeId = data.paymentTypeOptions[0].id; - } - scope.formData.transactionAmount = data.amount; - scope.formData[scope.modelName] = new Date(); - if(data.fixedEmiAmount){ - scope.formData.fixedEmiAmount = data.fixedEmiAmount; - scope.showEMIAmountField=true; - } - }); - scope.title = 'label.heading.disburseloanaccount'; - scope.labelName = 'label.input.disbursedondate'; - scope.isTransaction = true; - scope.showAmountField = true; - break; - case "repayment": - scope.modelName = 'transactionDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'repayment'}, function(data){ - scope.paymentTypes=data.paymentTypeOptions; - if (data.paymentTypeOptions.length > 0) { - scope.formData.paymentTypeId = data.paymentTypeOptions[0].id; - } - scope.formData.transactionAmount = data.amount; - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - }); - scope.title = 'label.heading.loanrepayments'; - scope.labelName = 'label.input.transactiondate'; - scope.isTransaction = true; - scope.showAmountField = true; - break; - case "waiveinterest": - scope.modelName = 'transactionDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'waiveinterest'}, function(data){ - scope.paymentTypes=data.paymentTypeOptions; - scope.formData.transactionAmount = data.amount; - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - }); - scope.title = 'label.heading.loanwaiveinterest'; - scope.labelName = 'label.input.interestwaivedon'; - scope.showAmountField = true; - break; - case "writeoff": - scope.modelName = 'transactionDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'writeoff'}, function(data){ - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - }); - scope.title = 'label.heading.writeoffloanaccount'; - scope.labelName = 'label.input.writeoffondate'; - break; - case "close-rescheduled": - scope.modelName = 'transactionDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'close-rescheduled'}, function(data){ - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - }); - scope.title = 'label.heading.closeloanaccountasrescheduled'; - scope.labelName = 'label.input.closedondate'; - break; - case "close": - scope.modelName = 'transactionDate'; - resourceFactory.loanTrxnsTemplateResource.get({loanId:scope.accountId, command:'close'}, function(data){ - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - }); - scope.title = 'label.heading.closeloanaccount'; - scope.labelName = 'label.input.closedondate'; - break; - case "unassignloanofficer": - scope.title = 'label.heading.unassignloanofficer'; - scope.labelName = 'label.input.loanofficerunassigneddate'; - scope.modelName = 'unassignedDate'; - scope.showNoteField = false; - scope.formData[scope.modelName] = new Date(); - break; - case "modifytransaction": - resourceFactory.loanTrxnsResource.get({loanId:scope.accountId, transactionId:routeParams.transactionId, template:'true'}, - function (data) { - scope.title = 'label.heading.editloanaccounttransaction'; - scope.labelName = 'label.input.transactiondate'; - scope.modelName = 'transactionDate'; - scope.paymentTypes=data.paymentTypeOptions || []; - scope.formData.transactionAmount = data.amount; - scope.formData[scope.modelName] = new Date(data.date) || new Date(); - if (data.paymentDetailData) { - if (data.paymentDetailData.paymentType) { - scope.formData.paymentTypeId = data.paymentDetailData.paymentType.id; - } - scope.formData.accountNumber = data.paymentDetailData.accountNumber; - scope.formData.checkNumber = data.paymentDetailData.checkNumber; - scope.formData.routingCode = data.paymentDetailData.routingCode; - scope.formData.receiptNumber = data.paymentDetailData.receiptNumber; - scope.formData.bankNumber = data.paymentDetailData.bankNumber; - } - }); + scope.action = routeParams.action || ""; + scope.accountId = routeParams.id; + scope.formData = {}; scope.showDateField = true; - scope.showNoteField = false; - scope.showAmountField = true; - scope.isTransaction = true; + scope.showNoteField = true; + scope.showAmountField = false; + scope.restrictDate = new Date(); + // Transaction UI Related + scope.isTransaction = false; scope.showPaymentDetails = false; - break; - case "deleteloancharge": - scope.showDelete = true; - scope.showNoteField = false; - scope.showDateField = false; - break; - case "waivecharge": - resourceFactory.LoanAccountResource.get({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, function(data){ - if (data.chargeTimeType.value !== "Specified due date" && data.installmentChargeData) { - scope.installmentCharges = data.installmentChargeData; - scope.formData.installmentNumber = data.installmentChargeData[0].installmentNumber; - scope.installmentchargeField = true; - } else { - scope.installmentchargeField = false; - scope.showwaiveforspecicficduedate = true; - } - }); - - scope.title = 'label.heading.waiveloancharge'; - scope.labelName = 'label.input.installment'; - scope.showNoteField = false; - scope.showDateField = false; - break; - case "paycharge": - resourceFactory.LoanAccountResource.get({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, command : 'pay'}, function(data){ - if (data.dueDate) { - scope.formData.transactionDate = new Date(data.dueDate); - } - if (data.chargeTimeType.value === "Instalment Fee" && data.installmentChargeData) { - scope.installmentCharges = data.installmentChargeData; - scope.formData.installmentNumber = data.installmentChargeData[0].installmentNumber; - scope.installmentchargeField = true; - } - }); - scope.title = 'label.heading.payloancharge'; - scope.showNoteField = false; - scope.showDateField = false; - scope.paymentDatefield = true; - break; - case "editcharge": - resourceFactory.LoanAccountResource.get({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, function(data){ - if (data.amountOrPercentage) { - scope.showEditChargeAmount = true; - scope.formData.amount = data.amountOrPercentage; - if (data.dueDate) { - scope.formData.dueDate = new Date(data.dueDate); - scope.showEditChargeDueDate = true; - } - } + scope.paymentTypes = []; - }); - scope.title = 'label.heading.editcharge'; - scope.showNoteField = false; - scope.showDateField = false; - break; - case "editdisbursedate": - resourceFactory.LoanEditDisburseResource.get({loanId : routeParams.id, disbursementId : routeParams.disbursementId}, function(data){ - scope.formData.expectedDisbursementDate = new Date(data.expectedDisbursementDate); - scope.showEditDisburseDate = true; - }); - scope.title = 'label.heading.editdisbursedate'; - scope.showNoteField = false; - scope.showDateField = false; - break; - } + switch (scope.action) { + case "approve": + scope.title = 'label.heading.approveloanaccount'; + scope.labelName = 'label.input.approvedondate'; + scope.modelName = 'approvedOnDate'; + scope.formData[scope.modelName] = new Date(); + break; + case "reject": + scope.title = 'label.heading.rejectloanaccount'; + scope.labelName = 'label.input.rejectedondate'; + scope.modelName = 'rejectedOnDate'; + scope.formData[scope.modelName] = new Date(); + break; + case "withdrawnByApplicant": + scope.title = 'label.heading.withdrawloanaccount'; + scope.labelName = 'label.input.withdrawnondate'; + scope.modelName = 'withdrawnOnDate'; + scope.formData[scope.modelName] = new Date(); + break; + case "undoapproval": + scope.title = 'label.heading.undoapproveloanaccount'; + scope.showDateField = false; + break; + case "undodisbursal": + scope.title = 'label.heading.undodisburseloanaccount'; + scope.showDateField = false; + break; + case "disburse": + scope.modelName = 'actualDisbursementDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'disburse'}, function (data) { + scope.paymentTypes = data.paymentTypeOptions; + if (data.paymentTypeOptions.length > 0) { + scope.formData.paymentTypeId = data.paymentTypeOptions[0].id; + } + scope.formData.transactionAmount = data.amount; + scope.formData[scope.modelName] = new Date(); + if (data.fixedEmiAmount) { + scope.formData.fixedEmiAmount = data.fixedEmiAmount; + scope.showEMIAmountField = true; + } + }); + scope.title = 'label.heading.disburseloanaccount'; + scope.labelName = 'label.input.disbursedondate'; + scope.isTransaction = true; + scope.showAmountField = true; + break; + case "repayment": + scope.modelName = 'transactionDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'repayment'}, function (data) { + scope.paymentTypes = data.paymentTypeOptions; + if (data.paymentTypeOptions.length > 0) { + scope.formData.paymentTypeId = data.paymentTypeOptions[0].id; + } + scope.formData.transactionAmount = data.amount; + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + }); + scope.title = 'label.heading.loanrepayments'; + scope.labelName = 'label.input.transactiondate'; + scope.isTransaction = true; + scope.showAmountField = true; + break; + case "waiveinterest": + scope.modelName = 'transactionDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'waiveinterest'}, function (data) { + scope.paymentTypes = data.paymentTypeOptions; + scope.formData.transactionAmount = data.amount; + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + }); + scope.title = 'label.heading.loanwaiveinterest'; + scope.labelName = 'label.input.interestwaivedon'; + scope.showAmountField = true; + break; + case "writeoff": + scope.modelName = 'transactionDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'writeoff'}, function (data) { + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + }); + scope.title = 'label.heading.writeoffloanaccount'; + scope.labelName = 'label.input.writeoffondate'; + break; + case "close-rescheduled": + scope.modelName = 'transactionDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'close-rescheduled'}, function (data) { + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + }); + scope.title = 'label.heading.closeloanaccountasrescheduled'; + scope.labelName = 'label.input.closedondate'; + break; + case "close": + scope.modelName = 'transactionDate'; + resourceFactory.loanTrxnsTemplateResource.get({loanId: scope.accountId, command: 'close'}, function (data) { + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + }); + scope.title = 'label.heading.closeloanaccount'; + scope.labelName = 'label.input.closedondate'; + break; + case "unassignloanofficer": + scope.title = 'label.heading.unassignloanofficer'; + scope.labelName = 'label.input.loanofficerunassigneddate'; + scope.modelName = 'unassignedDate'; + scope.showNoteField = false; + scope.formData[scope.modelName] = new Date(); + break; + case "modifytransaction": + resourceFactory.loanTrxnsResource.get({loanId: scope.accountId, transactionId: routeParams.transactionId, template: 'true'}, + function (data) { + scope.title = 'label.heading.editloanaccounttransaction'; + scope.labelName = 'label.input.transactiondate'; + scope.modelName = 'transactionDate'; + scope.paymentTypes = data.paymentTypeOptions || []; + scope.formData.transactionAmount = data.amount; + scope.formData[scope.modelName] = new Date(data.date) || new Date(); + if (data.paymentDetailData) { + if (data.paymentDetailData.paymentType) { + scope.formData.paymentTypeId = data.paymentDetailData.paymentType.id; + } + scope.formData.accountNumber = data.paymentDetailData.accountNumber; + scope.formData.checkNumber = data.paymentDetailData.checkNumber; + scope.formData.routingCode = data.paymentDetailData.routingCode; + scope.formData.receiptNumber = data.paymentDetailData.receiptNumber; + scope.formData.bankNumber = data.paymentDetailData.bankNumber; + } + }); + scope.showDateField = true; + scope.showNoteField = false; + scope.showAmountField = true; + scope.isTransaction = true; + scope.showPaymentDetails = false; + break; + case "deleteloancharge": + scope.showDelete = true; + scope.showNoteField = false; + scope.showDateField = false; + break; + case "waivecharge": + resourceFactory.LoanAccountResource.get({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, function (data) { + if (data.chargeTimeType.value !== "Specified due date" && data.installmentChargeData) { + scope.installmentCharges = data.installmentChargeData; + scope.formData.installmentNumber = data.installmentChargeData[0].installmentNumber; + scope.installmentchargeField = true; + } else { + scope.installmentchargeField = false; + scope.showwaiveforspecicficduedate = true; + } + }); - scope.cancel = function() { - location.path('/viewloanaccount/' + routeParams.id); - }; + scope.title = 'label.heading.waiveloancharge'; + scope.labelName = 'label.input.installment'; + scope.showNoteField = false; + scope.showDateField = false; + break; + case "paycharge": + resourceFactory.LoanAccountResource.get({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, command: 'pay'}, function (data) { + if (data.dueDate) { + scope.formData.transactionDate = new Date(data.dueDate); + } + if (data.chargeTimeType.value === "Instalment Fee" && data.installmentChargeData) { + scope.installmentCharges = data.installmentChargeData; + scope.formData.installmentNumber = data.installmentChargeData[0].installmentNumber; + scope.installmentchargeField = true; + } + }); + scope.title = 'label.heading.payloancharge'; + scope.showNoteField = false; + scope.showDateField = false; + scope.paymentDatefield = true; + break; + case "editcharge": + resourceFactory.LoanAccountResource.get({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, function (data) { + if (data.amountOrPercentage) { + scope.showEditChargeAmount = true; + scope.formData.amount = data.amountOrPercentage; + if (data.dueDate) { + scope.formData.dueDate = new Date(data.dueDate); + scope.showEditChargeDueDate = true; + } + } - scope.submit = function() { - var params = {command:scope.action}; - if (this.formData[scope.modelName]) { - this.formData[scope.modelName] = dateFilter(this.formData[scope.modelName],scope.df); - } - if (scope.action != "undoapproval" && scope.action != "undodisbursal" || scope.action === "paycharge") { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - } - if (scope.action == "repayment" || scope.action == "waiveinterest" || scope.action == "writeoff" || scope.action == "close-rescheduled" || scope.action == "close" || scope.action == "modifytransaction") { - if(scope.action == "modifytransaction") { - params.command = 'modify'; - params.transactionId = routeParams.transactionId; + }); + scope.title = 'label.heading.editcharge'; + scope.showNoteField = false; + scope.showDateField = false; + break; + case "editdisbursedate": + resourceFactory.LoanEditDisburseResource.get({loanId: routeParams.id, disbursementId: routeParams.disbursementId}, function (data) { + scope.formData.expectedDisbursementDate = new Date(data.expectedDisbursementDate); + scope.showEditDisburseDate = true; + }); + scope.title = 'label.heading.editdisbursedate'; + scope.showNoteField = false; + scope.showDateField = false; + break; } - params.loanId = scope.accountId; - resourceFactory.loanTrxnsResource.save(params, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - } else if(scope.action == "deleteloancharge") { - resourceFactory.LoanAccountResource.delete({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, this.formData, function(data) { - location.path('/viewloanaccount/' + data.loanId); - }); - }else if (scope.action === "waivecharge") { - resourceFactory.LoanAccountResource.save({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, 'command' :'waive'}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }else if (scope.action === "paycharge") { - this.formData.transactionDate = dateFilter(this.formData.transactionDate,scope.df); - resourceFactory.LoanAccountResource.save({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, 'command' :'pay'}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }else if (scope.action === "editcharge") { - this.formData.dueDate = dateFilter(this.formData.dueDate,scope.df); - resourceFactory.LoanAccountResource.update({loanId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }else if (scope.action === "editdisbursedate") { - this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate,scope.df); - resourceFactory.LoanEditDisburseResource.update({loanId : routeParams.id, disbursementId : routeParams.disbursementId}, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - } else { - params.loanId=scope.accountId; - resourceFactory.LoanAccountResource.save(params, this.formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - } - }; - } - }); - mifosX.ng.application.controller('LoanAccountActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.LoanAccountActionsController]).run(function($log) { - $log.info("LoanAccountActionsController initialized"); - }); + + scope.cancel = function () { + location.path('/viewloanaccount/' + routeParams.id); + }; + + scope.submit = function () { + var params = {command: scope.action}; + if (this.formData[scope.modelName]) { + this.formData[scope.modelName] = dateFilter(this.formData[scope.modelName], scope.df); + } + if (scope.action != "undoapproval" && scope.action != "undodisbursal" || scope.action === "paycharge") { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + } + if (scope.action == "repayment" || scope.action == "waiveinterest" || scope.action == "writeoff" || scope.action == "close-rescheduled" || scope.action == "close" || scope.action == "modifytransaction") { + if (scope.action == "modifytransaction") { + params.command = 'modify'; + params.transactionId = routeParams.transactionId; + } + params.loanId = scope.accountId; + resourceFactory.loanTrxnsResource.save(params, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else if (scope.action == "deleteloancharge") { + resourceFactory.LoanAccountResource.delete({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else if (scope.action === "waivecharge") { + resourceFactory.LoanAccountResource.save({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, 'command': 'waive'}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else if (scope.action === "paycharge") { + this.formData.transactionDate = dateFilter(this.formData.transactionDate, scope.df); + resourceFactory.LoanAccountResource.save({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, 'command': 'pay'}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else if (scope.action === "editcharge") { + this.formData.dueDate = dateFilter(this.formData.dueDate, scope.df); + resourceFactory.LoanAccountResource.update({loanId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else if (scope.action === "editdisbursedate") { + this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate, scope.df); + resourceFactory.LoanEditDisburseResource.update({loanId: routeParams.id, disbursementId: routeParams.disbursementId}, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } else { + params.loanId = scope.accountId; + resourceFactory.LoanAccountResource.save(params, this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + } + }; + } + }); + mifosX.ng.application.controller('LoanAccountActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.LoanAccountActionsController]).run(function ($log) { + $log.info("LoanAccountActionsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/LoanDocumentController.js b/app/scripts/controllers/loanAccount/LoanDocumentController.js index 9c41d3eb..ff968ede 100644 --- a/app/scripts/controllers/loanAccount/LoanDocumentController.js +++ b/app/scripts/controllers/loanAccount/LoanDocumentController.js @@ -1,27 +1,27 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - LoanDocumentController: function(scope, location, http, routeParams, API_VERSION,$upload,$rootScope) { - scope.loanId = routeParams.loanId; - scope.onFileSelect = function($files) { - scope.file = $files[0]; - }; +(function (module) { + mifosX.controllers = _.extend(module, { + LoanDocumentController: function (scope, location, http, routeParams, API_VERSION, $upload, $rootScope) { + scope.loanId = routeParams.loanId; + scope.onFileSelect = function ($files) { + scope.file = $files[0]; + }; - scope.submit = function () { - $upload.upload({ - url: $rootScope.hostUrl + API_VERSION + '/loans/'+scope.loanId+'/documents', - data: scope.formData, - file: scope.file - }).then(function(data) { - // to fix IE not refreshing the model - if (!scope.$$phase) { - scope.$apply(); - } - location.path('/viewloanaccount/'+scope.loanId); - }); - }; - } - }); - mifosX.ng.application.controller('LoanDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION','$upload','$rootScope', mifosX.controllers.LoanDocumentController]).run(function($log) { - $log.info("LoanDocumentController initialized"); - }); + scope.submit = function () { + $upload.upload({ + url: $rootScope.hostUrl + API_VERSION + '/loans/' + scope.loanId + '/documents', + data: scope.formData, + file: scope.file + }).then(function (data) { + // to fix IE not refreshing the model + if (!scope.$$phase) { + scope.$apply(); + } + location.path('/viewloanaccount/' + scope.loanId); + }); + }; + } + }); + mifosX.ng.application.controller('LoanDocumentController', ['$scope', '$location', '$http', '$routeParams', 'API_VERSION', '$upload', '$rootScope', mifosX.controllers.LoanDocumentController]).run(function ($log) { + $log.info("LoanDocumentController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/loanAccount/LoanScreenReportController.js b/app/scripts/controllers/loanAccount/LoanScreenReportController.js index 6973e420..457e6a8e 100644 --- a/app/scripts/controllers/loanAccount/LoanScreenReportController.js +++ b/app/scripts/controllers/loanAccount/LoanScreenReportController.js @@ -1,31 +1,31 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - LoanScreenReportController: function(scope, resourceFactory, location, http, API_VERSION, routeParams,$rootScope) { - resourceFactory.templateResource.get({entityId : 1, typeId : 0}, function(data) { - scope.loanTemplateData = data; - }); - scope.print = function(template){ - var templateWindow = window.open('', 'Screen Report', 'height=400,width=600'); - templateWindow.document.write(''); - templateWindow.document.write(''); - templateWindow.document.write(template); - templateWindow.document.write(''); - templateWindow.print(); - templateWindow.close(); - }; - scope.getLoanTemplate = function(templateId) { - scope.selectedTemplate = templateId; - http({ - method:'POST', - url: $rootScope.hostUrl + API_VERSION + '/templates/'+templateId+'?loanId='+routeParams.loanId, - data: {} - }).then(function(data) { - scope.template = data.data; - }); - }; - } - }); - mifosX.ng.application.controller('LoanScreenReportController', ['$scope', 'ResourceFactory', '$location','$http', 'API_VERSION', '$routeParams','$rootScope', mifosX.controllers.LoanScreenReportController]).run(function($log) { - $log.info("LoanScreenReportController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + LoanScreenReportController: function (scope, resourceFactory, location, http, API_VERSION, routeParams, $rootScope) { + resourceFactory.templateResource.get({entityId: 1, typeId: 0}, function (data) { + scope.loanTemplateData = data; + }); + scope.print = function (template) { + var templateWindow = window.open('', 'Screen Report', 'height=400,width=600'); + templateWindow.document.write(''); + templateWindow.document.write(''); + templateWindow.document.write(template); + templateWindow.document.write(''); + templateWindow.print(); + templateWindow.close(); + }; + scope.getLoanTemplate = function (templateId) { + scope.selectedTemplate = templateId; + http({ + method: 'POST', + url: $rootScope.hostUrl + API_VERSION + '/templates/' + templateId + '?loanId=' + routeParams.loanId, + data: {} + }).then(function (data) { + scope.template = data.data; + }); + }; + } + }); + mifosX.ng.application.controller('LoanScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', mifosX.controllers.LoanScreenReportController]).run(function ($log) { + $log.info("LoanScreenReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/NewJLGLoanAccAppController.js b/app/scripts/controllers/loanAccount/NewJLGLoanAccAppController.js index 516b45f8..1b970d0d 100644 --- a/app/scripts/controllers/loanAccount/NewJLGLoanAccAppController.js +++ b/app/scripts/controllers/loanAccount/NewJLGLoanAccAppController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - NewJLGLoanAccAppController: function(scope, routeParams, resourceFactory, location, dateFilter) { + NewJLGLoanAccAppController: function (scope, routeParams, resourceFactory, location, dateFilter) { scope.previewRepayment = false; scope.groupId = routeParams.groupId; @@ -8,200 +8,212 @@ scope.restrictDate = new Date(); scope.chargeFormData = {}; //For charges scope.collateralFormData = {}; //For collaterals - scope.inparams = { resourceType:'template', templateType:'jlgbulk', lendingStrategy:300 }; + scope.inparams = { resourceType: 'template', templateType: 'jlgbulk', lendingStrategy: 300 }; if (scope.groupId) { - scope.inparams.groupId = scope.groupId; - scope.formData.groupId = scope.groupId; + scope.inparams.groupId = scope.groupId; + scope.formData.groupId = scope.groupId; } - resourceFactory.loanResource.get(scope.inparams, function(data) { - scope.products = data.productOptions; - if (data.group) {scope.groupName = data.group.name;} + resourceFactory.loanResource.get(scope.inparams, function (data) { + scope.products = data.productOptions; + if (data.group) { + scope.groupName = data.group.name; + } }); - scope.loanProductChange = function(loanProductId) { - scope.clients = []; - scope.inparams.productId = loanProductId; - resourceFactory.loanResource.get(scope.inparams, function(data) { - scope.loanaccountinfo = data; - if(data.group.clientMembers) { - for (var i in data.group.clientMembers) { - scope.clients.push({selected:true, clientId:data.group.clientMembers[i].id, name:data.group.clientMembers[i].displayName, amount:data.memberVariations[data.group.clientMembers[i].id]['principal'], - interest:data.memberVariations[data.group.clientMembers[i].id]['interestRatePerPeriod'],repayments:data.memberVariations[data.group.clientMembers[i].id]['numberOfRepayments'], - frequency:data.memberVariations[data.group.clientMembers[i].id]['termFrequency'],frequencyType:data.repaymentFrequencyType.id}); - } - } - scope.previewClientLoanAccInfo(); - }); + scope.loanProductChange = function (loanProductId) { + scope.clients = []; + scope.inparams.productId = loanProductId; + resourceFactory.loanResource.get(scope.inparams, function (data) { + scope.loanaccountinfo = data; + if (data.group.clientMembers) { + for (var i in data.group.clientMembers) { + scope.clients.push({selected: true, clientId: data.group.clientMembers[i].id, name: data.group.clientMembers[i].displayName, amount: data.memberVariations[data.group.clientMembers[i].id]['principal'], + interest: data.memberVariations[data.group.clientMembers[i].id]['interestRatePerPeriod'], repayments: data.memberVariations[data.group.clientMembers[i].id]['numberOfRepayments'], + frequency: data.memberVariations[data.group.clientMembers[i].id]['termFrequency'], frequencyType: data.repaymentFrequencyType.id}); + } + } + scope.previewClientLoanAccInfo(); + }); - resourceFactory.loanResource.get({resourceType : 'template', templateType:'collateral', productId:loanProductId, fields:'id,loanCollateralOptions'}, function(data) { - scope.collateralOptions = data.loanCollateralOptions || []; - }); + resourceFactory.loanResource.get({resourceType: 'template', templateType: 'collateral', productId: loanProductId, fields: 'id,loanCollateralOptions'}, function (data) { + scope.collateralOptions = data.loanCollateralOptions || []; + }); } - scope.previewClientLoanAccInfo = function() { - scope.previewRepayment = false; - scope.charges = scope.loanaccountinfo.charges || []; - scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; - scope.collaterals = []; + scope.previewClientLoanAccInfo = function () { + scope.previewRepayment = false; + scope.charges = scope.loanaccountinfo.charges || []; + scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; + scope.collaterals = []; - if (scope.loanaccountinfo.calendarOptions) { - scope.formData.syncRepaymentsWithMeeting = true; - scope.formData.syncDisbursementWithMeeting = true; - } + if (scope.loanaccountinfo.calendarOptions) { + scope.formData.syncRepaymentsWithMeeting = true; + scope.formData.syncDisbursementWithMeeting = true; + } + + scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan + scope.formData.productId = scope.loanaccountinfo.loanProductId; + scope.formData.fundId = scope.loanaccountinfo.fundId; + scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; + scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; + scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; + scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; + scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; + scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; + scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; + scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; + scope.formData.interestType = scope.loanaccountinfo.interestType.id; + scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; + scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; + scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; + scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; + scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; + scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; + scope.formData.maxOutstandingLoanBalance = scope.loanaccountinfo.maxOutstandingLoanBalance; - scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan - scope.formData.productId = scope.loanaccountinfo.loanProductId; - scope.formData.fundId = scope.loanaccountinfo.fundId; - scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; - scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; - scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; - scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; - scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; - scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; - scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; - scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; - scope.formData.interestType = scope.loanaccountinfo.interestType.id; - scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; - scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; - scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; - scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; - scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; - scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; - scope.formData.maxOutstandingLoanBalance=scope.loanaccountinfo.maxOutstandingLoanBalance; - } scope.viewLoanSchedule = function (index) { - scope.formData.clientId= scope.clients[index].clientId; - scope.formData.principal = scope.clients[index].amount; - scope.formData.interestRatePerPeriod = scope.clients[index].interest; - scope.formData.numberOfRepayments = scope.clients[index].repayments; - scope.formData.loanTermFrequencyType = scope.clients[index].frequencyType; - scope.formData.loanTermFrequency = scope.clients[index].frequency; - scope.previewRepayments(); + scope.formData.clientId = scope.clients[index].clientId; + scope.formData.principal = scope.clients[index].amount; + scope.formData.interestRatePerPeriod = scope.clients[index].interest; + scope.formData.numberOfRepayments = scope.clients[index].repayments; + scope.formData.loanTermFrequencyType = scope.clients[index].frequencyType; + scope.formData.loanTermFrequency = scope.clients[index].frequency; + scope.previewRepayments(); } - - scope.addCharge = function() { - if (scope.chargeFormData.chargeId) { - resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function(data){ - data.chargeId = data.id; - scope.charges.push(data); - scope.chargeFormData.chargeId = undefined; + + scope.addCharge = function () { + if (scope.chargeFormData.chargeId) { + resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + scope.chargeFormData.chargeId = undefined; + }); + } + } + + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + } + + scope.addTranches = function () { + scope.formData.disbursementData.push({ }); - } - } - - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - } - - scope.addTranches = function() { - scope.formData.disbursementData.push({ - }); }; - scope.deleteTranches = function(index) { - scope.formData.disbursementData.splice(index,1); + scope.deleteTranches = function (index) { + scope.formData.disbursementData.splice(index, 1); } - scope.syncRepaymentsWithMeetingchange = function() { - if (!scope.formData.syncRepaymentsWithMeeting) { - scope.formData.syncDisbursementWithMeeting=false; - } + scope.syncRepaymentsWithMeetingchange = function () { + if (!scope.formData.syncRepaymentsWithMeeting) { + scope.formData.syncDisbursementWithMeeting = false; + } }; - scope.syncDisbursementWithMeetingchange = function() { - if (scope.formData.syncDisbursementWithMeeting) { - scope.formData.syncRepaymentsWithMeeting=true; - } + scope.syncDisbursementWithMeetingchange = function () { + if (scope.formData.syncDisbursementWithMeeting) { + scope.formData.syncRepaymentsWithMeeting = true; + } }; scope.addCollateral = function () { - if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { - scope.collaterals.push({type:scope.collateralFormData.collateralIdTemplate.id, name:scope.collateralFormData.collateralIdTemplate.name, value:scope.collateralFormData.collateralValueTemplate, description:scope.collateralFormData.collateralDescriptionTemplate}); - scope.collateralFormData.collateralIdTemplate = undefined; - scope.collateralFormData.collateralValueTemplate = undefined; - scope.collateralFormData.collateralDescriptionTemplate = undefined; - } + if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { + scope.collaterals.push({type: scope.collateralFormData.collateralIdTemplate.id, name: scope.collateralFormData.collateralIdTemplate.name, value: scope.collateralFormData.collateralValueTemplate, description: scope.collateralFormData.collateralDescriptionTemplate}); + scope.collateralFormData.collateralIdTemplate = undefined; + scope.collateralFormData.collateralValueTemplate = undefined; + scope.collateralFormData.collateralDescriptionTemplate = undefined; + } }; scope.deleteCollateral = function (index) { - scope.collaterals.splice(index,1); + scope.collaterals.splice(index, 1); }; - scope.previewRepayments = function() { + scope.previewRepayments = function () { // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; if (scope.charges.length > 0) { - scope.formData.charges = []; - for (var i in scope.charges) { - scope.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, dueDate:dateFilter(scope.charges[i].dueDate,scope.df) }); - } + scope.formData.charges = []; + for (var i in scope.charges) { + scope.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } if (scope.collaterals.length > 0) { - scope.formData.collateral = []; - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + scope.formData.collateral = []; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; - scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; } delete this.formData.syncRepaymentsWithMeeting; - if (this.formData.submittedOnDate){this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate,scope.df);} - if (this.formData.expectedDisbursementDate){this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate,scope.df);} - if (this.formData.interestChargedFromDate){this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate,scope.df);} - if (this.formData.repaymentsStartingFromDate){this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate,scope.df);} + if (this.formData.submittedOnDate) { + this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate, scope.df); + } + if (this.formData.expectedDisbursementDate) { + this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate, scope.df); + } + if (this.formData.interestChargedFromDate) { + this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate, scope.df); + } + if (this.formData.repaymentsStartingFromDate) { + this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate, scope.df); + } this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; this.formData.loanType = 'jlg'; - resourceFactory.loanResource.save({command:'calculateLoanSchedule'}, this.formData,function(data){ - scope.repaymentscheduleinfo = data; - scope.previewRepayment = true; - scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; - scope.formData.clientId= undefined; - scope.formData.principal = undefined; - }); + resourceFactory.loanResource.save({command: 'calculateLoanSchedule'}, this.formData, function (data) { + scope.repaymentscheduleinfo = data; + scope.previewRepayment = true; + scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; + scope.formData.clientId = undefined; + scope.formData.principal = undefined; + }); } - scope.submit = function() { + scope.submit = function () { // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; if (scope.charges.length > 0) { - scope.formData.charges = []; - for (var i in scope.charges) { - scope.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, dueDate:dateFilter(scope.charges[i].dueDate,scope.df) }); - } + scope.formData.charges = []; + for (var i in scope.charges) { + scope.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } if (scope.collaterals.length > 0) { - scope.formData.collateral = []; - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + scope.formData.collateral = []; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate,'dd MMMM yyyy'); - } + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate, 'dd MMMM yyyy'); + } } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; } delete this.formData.syncRepaymentsWithMeeting; delete this.formData.interestRateFrequencyType; @@ -209,53 +221,61 @@ this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; this.formData.loanType = 'jlg'; - if (this.formData.submittedOnDate){this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate,scope.df);} - if (this.formData.expectedDisbursementDate){this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate,scope.df);} - if (this.formData.interestChargedFromDate){this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate,scope.df);} - if (this.formData.repaymentsStartingFromDate){this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate,scope.df);} + if (this.formData.submittedOnDate) { + this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate, scope.df); + } + if (this.formData.expectedDisbursementDate) { + this.formData.expectedDisbursementDate = dateFilter(this.formData.expectedDisbursementDate, scope.df); + } + if (this.formData.interestChargedFromDate) { + this.formData.interestChargedFromDate = dateFilter(this.formData.interestChargedFromDate, scope.df); + } + if (this.formData.repaymentsStartingFromDate) { + this.formData.repaymentsStartingFromDate = dateFilter(this.formData.repaymentsStartingFromDate, scope.df); + } //logic for proper redirecting var selectedClients = 0; var successfullyCreated = 0; for (var i in scope.clients) { - if (scope.clients[i].selected) { - selectedClients = selectedClients + 1; - } + if (scope.clients[i].selected) { + selectedClients = selectedClients + 1; + } } for (var i in scope.clients) { - if (scope.clients[i].selected) { - this.formData.clientId= scope.clients[i].clientId; - this.formData.principal = scope.clients[i].amount; - this.formData.interestRatePerPeriod = scope.clients[i].interest; - this.formData.numberOfRepayments = scope.clients[i].repayments; - this.formData.loanTermFrequencyType = scope.clients[i].frequencyType; - this.formData.loanTermFrequency = scope.clients[i].frequency; - resourceFactory.loanResource.save({_:new Date().getTime()},this.formData,function(data){ - successfullyCreated = successfullyCreated + 1; - if (successfullyCreated == selectedClients) { - location.path('/viewgroup/' + scope.groupId); - }else { - for (var x in scope.clients) { - if(scope.clients[x].clientId == data.clientId){ - scope.clients[x]['status'] = 'Created'; - } - } - } - }); - } + if (scope.clients[i].selected) { + this.formData.clientId = scope.clients[i].clientId; + this.formData.principal = scope.clients[i].amount; + this.formData.interestRatePerPeriod = scope.clients[i].interest; + this.formData.numberOfRepayments = scope.clients[i].repayments; + this.formData.loanTermFrequencyType = scope.clients[i].frequencyType; + this.formData.loanTermFrequency = scope.clients[i].frequency; + resourceFactory.loanResource.save({_: new Date().getTime()}, this.formData, function (data) { + successfullyCreated = successfullyCreated + 1; + if (successfullyCreated == selectedClients) { + location.path('/viewgroup/' + scope.groupId); + } else { + for (var x in scope.clients) { + if (scope.clients[x].clientId == data.clientId) { + scope.clients[x]['status'] = 'Created'; + } + } + } + }); + } } }; - scope.cancel = function() { - if (scope.groupId) { - location.path('/viewgroup/' + scope.groupId); - } + scope.cancel = function () { + if (scope.groupId) { + location.path('/viewgroup/' + scope.groupId); + } }; } }); - mifosX.ng.application.controller('NewJLGLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.NewJLGLoanAccAppController]).run(function($log) { + mifosX.ng.application.controller('NewJLGLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.NewJLGLoanAccAppController]).run(function ($log) { $log.info("NewJLGLoanAccAppController initialized"); }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/loanAccount/NewLoanAccAppController.js b/app/scripts/controllers/loanAccount/NewLoanAccAppController.js index 80dbba7a..c2e7c2eb 100644 --- a/app/scripts/controllers/loanAccount/NewLoanAccAppController.js +++ b/app/scripts/controllers/loanAccount/NewLoanAccAppController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - NewLoanAccAppController: function(scope, routeParams, resourceFactory, location,dateFilter) { + NewLoanAccAppController: function (scope, routeParams, resourceFactory, location, dateFilter) { scope.previewRepayment = false; scope.clientId = routeParams.clientId; @@ -9,206 +9,218 @@ scope.formData = {}; scope.chargeFormData = {}; //For charges scope.collateralFormData = {}; //For collaterals - scope.inparams = {resourceType : 'template'}; + scope.inparams = {resourceType: 'template'}; scope.date = {}; - if (scope.clientId) { - scope.inparams.clientId = scope.clientId; - scope.formData.clientId = scope.clientId; + if (scope.clientId) { + scope.inparams.clientId = scope.clientId; + scope.formData.clientId = scope.clientId; } if (scope.groupId) { - scope.inparams.groupId = scope.groupId; - scope.formData.groupId = scope.groupId; + scope.inparams.groupId = scope.groupId; + scope.formData.groupId = scope.groupId; } - if (scope.clientId && scope.groupId) { scope.inparams.templateType = 'jlg'; } - else if (scope.groupId) { scope.inparams.templateType = 'group'; } - else if (scope.clientId) { scope.inparams.templateType = 'individual'; } + if (scope.clientId && scope.groupId) { + scope.inparams.templateType = 'jlg'; + } + else if (scope.groupId) { + scope.inparams.templateType = 'group'; + } + else if (scope.clientId) { + scope.inparams.templateType = 'individual'; + } - resourceFactory.loanResource.get(scope.inparams, function(data) { - scope.products = data.productOptions; - if (data.clientName) {scope.clientName = data.clientName;} - if (data.group) {scope.groupName = data.group.name;} + resourceFactory.loanResource.get(scope.inparams, function (data) { + scope.products = data.productOptions; + if (data.clientName) { + scope.clientName = data.clientName; + } + if (data.group) { + scope.groupName = data.group.name; + } }); - scope.loanProductChange = function(loanProductId) { - scope.inparams.productId = loanProductId; - resourceFactory.loanResource.get(scope.inparams, function(data) { - scope.loanaccountinfo = data; - scope.previewClientLoanAccInfo(); - }); - - resourceFactory.loanResource.get({resourceType : 'template', templateType:'collateral', productId:loanProductId, fields:'id,loanCollateralOptions'}, function(data) { - scope.collateralOptions = data.loanCollateralOptions || []; - }); - } - - scope.previewClientLoanAccInfo = function() { - scope.previewRepayment = false; - scope.charges = scope.loanaccountinfo.charges || []; - scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; - scope.collaterals = []; - - if (scope.loanaccountinfo.calendarOptions) { - scope.formData.syncRepaymentsWithMeeting = true; - scope.formData.syncDisbursementWithMeeting = true; - } - scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan - scope.formData.productId = scope.loanaccountinfo.loanProductId; - scope.formData.fundId = scope.loanaccountinfo.fundId; - scope.formData.principal = scope.loanaccountinfo.principal; - scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; - scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; - scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; - scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; - scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; - scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; - scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; - scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; - scope.formData.interestType = scope.loanaccountinfo.interestType.id; - scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; - scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; - scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; - scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; - scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; - scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; - scope.formData.fixedEmiAmount=scope.loanaccountinfo.fixedEmiAmount; - scope.formData.maxOutstandingLoanBalance=scope.loanaccountinfo.maxOutstandingLoanBalance; - - } - - scope.addCharge = function() { - if (scope.chargeFormData.chargeId) { - resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function(data){ - data.chargeId = data.id; - scope.charges.push(data); - scope.chargeFormData.chargeId = undefined; + scope.loanProductChange = function (loanProductId) { + scope.inparams.productId = loanProductId; + resourceFactory.loanResource.get(scope.inparams, function (data) { + scope.loanaccountinfo = data; + scope.previewClientLoanAccInfo(); + }); + + resourceFactory.loanResource.get({resourceType: 'template', templateType: 'collateral', productId: loanProductId, fields: 'id,loanCollateralOptions'}, function (data) { + scope.collateralOptions = data.loanCollateralOptions || []; }); - } } - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); + scope.previewClientLoanAccInfo = function () { + scope.previewRepayment = false; + scope.charges = scope.loanaccountinfo.charges || []; + scope.formData.disbursementData = scope.loanaccountinfo.disbursementDetails || []; + scope.collaterals = []; + + if (scope.loanaccountinfo.calendarOptions) { + scope.formData.syncRepaymentsWithMeeting = true; + scope.formData.syncDisbursementWithMeeting = true; + } + scope.multiDisburseLoan = scope.loanaccountinfo.multiDisburseLoan + scope.formData.productId = scope.loanaccountinfo.loanProductId; + scope.formData.fundId = scope.loanaccountinfo.fundId; + scope.formData.principal = scope.loanaccountinfo.principal; + scope.formData.loanTermFrequency = scope.loanaccountinfo.termFrequency; + scope.formData.loanTermFrequencyType = scope.loanaccountinfo.termPeriodFrequencyType.id; + scope.formData.numberOfRepayments = scope.loanaccountinfo.numberOfRepayments; + scope.formData.repaymentEvery = scope.loanaccountinfo.repaymentEvery; + scope.formData.repaymentFrequencyType = scope.loanaccountinfo.repaymentFrequencyType.id; + scope.formData.interestRatePerPeriod = scope.loanaccountinfo.interestRatePerPeriod; + scope.formData.interestRateFrequencyType = scope.loanaccountinfo.interestRateFrequencyType.id; + scope.formData.amortizationType = scope.loanaccountinfo.amortizationType.id; + scope.formData.interestType = scope.loanaccountinfo.interestType.id; + scope.formData.interestCalculationPeriodType = scope.loanaccountinfo.interestCalculationPeriodType.id; + scope.formData.inArrearsTolerance = scope.loanaccountinfo.inArrearsTolerance; + scope.formData.graceOnPrincipalPayment = scope.loanaccountinfo.graceOnPrincipalPayment; + scope.formData.graceOnInterestPayment = scope.loanaccountinfo.graceOnInterestPayment; + scope.formData.transactionProcessingStrategyId = scope.loanaccountinfo.transactionProcessingStrategyId; + scope.formData.graceOnInterestCharged = scope.loanaccountinfo.graceOnInterestCharged; + scope.formData.fixedEmiAmount = scope.loanaccountinfo.fixedEmiAmount; + scope.formData.maxOutstandingLoanBalance = scope.loanaccountinfo.maxOutstandingLoanBalance; + + } + + scope.addCharge = function () { + if (scope.chargeFormData.chargeId) { + resourceFactory.chargeResource.get({chargeId: this.chargeFormData.chargeId, template: 'true'}, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + scope.chargeFormData.chargeId = undefined; + }); + } + } + + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); } - scope.addTranches = function() { - scope.formData.disbursementData.push({ - }); + scope.addTranches = function () { + scope.formData.disbursementData.push({ + }); }; - scope.deleteTranches = function(index) { - scope.formData.disbursementData.splice(index,1); + scope.deleteTranches = function (index) { + scope.formData.disbursementData.splice(index, 1); } - scope.syncRepaymentsWithMeetingchange = function() { - if (!scope.formData.syncRepaymentsWithMeeting) { - scope.formData.syncDisbursementWithMeeting=false; - } + scope.syncRepaymentsWithMeetingchange = function () { + if (!scope.formData.syncRepaymentsWithMeeting) { + scope.formData.syncDisbursementWithMeeting = false; + } }; - scope.syncDisbursementWithMeetingchange = function() { - if (scope.formData.syncDisbursementWithMeeting) { - scope.formData.syncRepaymentsWithMeeting=true; - } + scope.syncDisbursementWithMeetingchange = function () { + if (scope.formData.syncDisbursementWithMeeting) { + scope.formData.syncRepaymentsWithMeeting = true; + } }; scope.addCollateral = function () { - if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { - scope.collaterals.push({type:scope.collateralFormData.collateralIdTemplate.id, name:scope.collateralFormData.collateralIdTemplate.name, value:scope.collateralFormData.collateralValueTemplate, description:scope.collateralFormData.collateralDescriptionTemplate}); - scope.collateralFormData.collateralIdTemplate = undefined; - scope.collateralFormData.collateralValueTemplate = undefined; - scope.collateralFormData.collateralDescriptionTemplate = undefined; - } + if (scope.collateralFormData.collateralIdTemplate && scope.collateralFormData.collateralValueTemplate) { + scope.collaterals.push({type: scope.collateralFormData.collateralIdTemplate.id, name: scope.collateralFormData.collateralIdTemplate.name, value: scope.collateralFormData.collateralValueTemplate, description: scope.collateralFormData.collateralDescriptionTemplate}); + scope.collateralFormData.collateralIdTemplate = undefined; + scope.collateralFormData.collateralValueTemplate = undefined; + scope.collateralFormData.collateralDescriptionTemplate = undefined; + } }; scope.deleteCollateral = function (index) { - scope.collaterals.splice(index,1); + scope.collaterals.splice(index, 1); }; - scope.previewRepayments = function() { + scope.previewRepayments = function () { // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var reqThirdDate = dateFilter(scope.date.third,scope.df); - var reqFourthDate = dateFilter(scope.date.fourth,scope.df); + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var reqThirdDate = dateFilter(scope.date.third, scope.df); + var reqFourthDate = dateFilter(scope.date.fourth, scope.df); if (scope.charges.length > 0) { - scope.formData.charges = []; - for (var i in scope.charges) { - scope.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, dueDate:dateFilter(scope.charges[i].dueDate,scope.df) }); - } + scope.formData.charges = []; + for (var i in scope.charges) { + scope.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate,'dd MMMM yyyy'); - } + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate, 'dd MMMM yyyy'); + } } if (scope.collaterals.length > 0) { - scope.formData.collateral = []; - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + scope.formData.collateral = []; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; - scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + scope.syncRepaymentsWithMeeting = this.formData.syncRepaymentsWithMeeting; } delete this.formData.syncRepaymentsWithMeeting; - this.formData.interestChargedFromDate = reqThirdDate ; + this.formData.interestChargedFromDate = reqThirdDate; this.formData.repaymentsStartingFromDate = reqFourthDate; this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; this.formData.loanType = scope.inparams.templateType; this.formData.expectedDisbursementDate = reqSecondDate; this.formData.submittedOnDate = reqFirstDate; - resourceFactory.loanResource.save({command:'calculateLoanSchedule'}, this.formData,function(data){ - scope.repaymentscheduleinfo = data; - scope.previewRepayment = true; - scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; - }); + resourceFactory.loanResource.save({command: 'calculateLoanSchedule'}, this.formData, function (data) { + scope.repaymentscheduleinfo = data; + scope.previewRepayment = true; + scope.formData.syncRepaymentsWithMeeting = scope.syncRepaymentsWithMeeting; + }); } - scope.submit = function() { + scope.submit = function () { // Make sure charges and collaterals are empty before initializing. delete scope.formData.charges; delete scope.formData.collateral; - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var reqThirdDate = dateFilter(scope.date.third,scope.df); - var reqFourthDate = dateFilter(scope.date.fourth,scope.df); - var reqFifthDate = dateFilter(scope.date.fifth,scope.df); + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var reqThirdDate = dateFilter(scope.date.third, scope.df); + var reqFourthDate = dateFilter(scope.date.fourth, scope.df); + var reqFifthDate = dateFilter(scope.date.fifth, scope.df); if (scope.charges.length > 0) { - scope.formData.charges = []; - for (var i in scope.charges) { - scope.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, dueDate: dateFilter(scope.charges[i].dueDate,scope.df) }); - } + scope.formData.charges = []; + for (var i in scope.charges) { + scope.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, dueDate: dateFilter(scope.charges[i].dueDate, scope.df) }); + } } if (scope.formData.disbursementData.length > 0) { - for (var i in scope.formData.disbursementData) { - scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate,'dd MMMM yyyy'); - } + for (var i in scope.formData.disbursementData) { + scope.formData.disbursementData[i].expectedDisbursementDate = dateFilter(scope.formData.disbursementData[i].expectedDisbursementDate, 'dd MMMM yyyy'); + } } if (scope.collaterals.length > 0) { - scope.formData.collateral = []; - for (var i in scope.collaterals) { - scope.formData.collateral.push({type:scope.collaterals[i].type,value:scope.collaterals[i].value, description:scope.collaterals[i].description}); - }; + scope.formData.collateral = []; + for (var i in scope.collaterals) { + scope.formData.collateral.push({type: scope.collaterals[i].type, value: scope.collaterals[i].value, description: scope.collaterals[i].description}); + } + ; } if (this.formData.syncRepaymentsWithMeeting) { - this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; + this.formData.calendarId = scope.loanaccountinfo.calendarOptions[0].id; } delete this.formData.syncRepaymentsWithMeeting; delete this.formData.interestRateFrequencyType; - this.formData.interestChargedFromDate = reqThirdDate ; + this.formData.interestChargedFromDate = reqThirdDate; this.formData.repaymentsStartingFromDate = reqFourthDate; this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; @@ -216,21 +228,21 @@ this.formData.expectedDisbursementDate = reqSecondDate; this.formData.submittedOnDate = reqFirstDate; - resourceFactory.loanResource.save(this.formData,function(data){ - location.path('/viewloanaccount/' + data.loanId); + resourceFactory.loanResource.save(this.formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); }); }; - scope.cancel = function() { - if (scope.groupId) { - location.path('/viewgroup/' + scope.groupId); - } else if (scope.clientId) { - location.path('/viewclient/' + scope.clientId); - } + scope.cancel = function () { + if (scope.groupId) { + location.path('/viewgroup/' + scope.groupId); + } else if (scope.clientId) { + location.path('/viewclient/' + scope.clientId); + } } } }); - mifosX.ng.application.controller('NewLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.NewLoanAccAppController]).run(function($log) { + mifosX.ng.application.controller('NewLoanAccAppController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.NewLoanAccAppController]).run(function ($log) { $log.info("NewLoanAccAppController initialized"); }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/loanAccount/ViewLoanChargeController.js b/app/scripts/controllers/loanAccount/ViewLoanChargeController.js index 07b6ccce..b240018d 100644 --- a/app/scripts/controllers/loanAccount/ViewLoanChargeController.js +++ b/app/scripts/controllers/loanAccount/ViewLoanChargeController.js @@ -1,44 +1,44 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewLoanChargeController: function(scope, resourceFactory, routeParams, location,$modal) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewLoanChargeController: function (scope, resourceFactory, routeParams, location, $modal) { - scope.loanId =routeParams.loanId; - scope.chargeId =routeParams.id; - if (routeParams.loanstatus == 'Submitted and pending approval') { - scope.showEditButtons = true; - } - if (routeParams.loanstatus == 'Active') { - scope.showWaiveButton = true; - } - resourceFactory.loanResource.get({ resourceType:'charges', loanId:scope.loanId, resourceId:scope.chargeId}, function(data) { - scope.charge = data; - }); - scope.deleteCharge = function () { - $modal.open({ - templateUrl: 'deletecharge.html', - controller: ChargeDeleteCtrl + scope.loanId = routeParams.loanId; + scope.chargeId = routeParams.id; + if (routeParams.loanstatus == 'Submitted and pending approval') { + scope.showEditButtons = true; + } + if (routeParams.loanstatus == 'Active') { + scope.showWaiveButton = true; + } + resourceFactory.loanResource.get({ resourceType: 'charges', loanId: scope.loanId, resourceId: scope.chargeId}, function (data) { + scope.charge = data; }); - }; - var ChargeDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.loanResource.delete({ resourceType:'charges', loanId:scope.loanId, resourceId:scope.chargeId}, {}, function(data) { - location.path('/viewloanaccount/'+scope.loanId); + scope.deleteCharge = function () { + $modal.open({ + templateUrl: 'deletecharge.html', + controller: ChargeDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var ChargeDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.loanResource.delete({ resourceType: 'charges', loanId: scope.loanId, resourceId: scope.chargeId}, {}, function (data) { + location.path('/viewloanaccount/' + scope.loanId); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + scope.waiveCharge = function () { + resourceFactory.loanResource.save({ resourceType: 'charges', loanId: scope.loanId, resourceId: scope.chargeId}, {}, function (data) { + location.path('/viewloanaccount/' + scope.loanId); + }); }; - }; - scope.waiveCharge = function () { - resourceFactory.loanResource.save({ resourceType:'charges', loanId:scope.loanId, resourceId:scope.chargeId}, {}, function(data) { - location.path('/viewloanaccount/'+scope.loanId); - }); - }; - } - }); - mifosX.ng.application.controller('ViewLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location','$modal', mifosX.controllers.ViewLoanChargeController]).run(function($log) { - $log.info("ViewLoanChargeController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewLoanChargeController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewLoanChargeController]).run(function ($log) { + $log.info("ViewLoanChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/ViewLoanCollateralController.js b/app/scripts/controllers/loanAccount/ViewLoanCollateralController.js index c35a3695..624f6fcb 100644 --- a/app/scripts/controllers/loanAccount/ViewLoanCollateralController.js +++ b/app/scripts/controllers/loanAccount/ViewLoanCollateralController.js @@ -1,32 +1,32 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewLoanCollateralController: function(scope, resourceFactory, routeParams, location,$modal) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewLoanCollateralController: function (scope, resourceFactory, routeParams, location, $modal) { - scope.loanId = routeParams.loanId; - scope.collateralId = routeParams.id; - resourceFactory.loanResource.get({ resourceType:'collaterals', loanId:scope.loanId, resourceId:scope.collateralId}, function(data) { - scope.collateral = data; - }); - scope.deleteCollateral = function () { - $modal.open({ - templateUrl: 'deletecollateral.html', - controller: CollateralDeleteCtrl + scope.loanId = routeParams.loanId; + scope.collateralId = routeParams.id; + resourceFactory.loanResource.get({ resourceType: 'collaterals', loanId: scope.loanId, resourceId: scope.collateralId}, function (data) { + scope.collateral = data; }); - }; - var CollateralDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.loanResource.delete({ resourceType:'collaterals', loanId:scope.loanId, resourceId:scope.collateralId}, {}, function(data) { - location.path('/viewloanaccount/'+scope.loanId); + scope.deleteCollateral = function () { + $modal.open({ + templateUrl: 'deletecollateral.html', + controller: CollateralDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var CollateralDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.loanResource.delete({ resourceType: 'collaterals', loanId: scope.loanId, resourceId: scope.collateralId}, {}, function (data) { + location.path('/viewloanaccount/' + scope.loanId); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location','$modal', mifosX.controllers.ViewLoanCollateralController]).run(function($log) { - $log.info("ViewLoanCollateralController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewLoanCollateralController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewLoanCollateralController]).run(function ($log) { + $log.info("ViewLoanCollateralController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/ViewLoanDetailsController.js b/app/scripts/controllers/loanAccount/ViewLoanDetailsController.js index 89f73d92..a7f651fc 100644 --- a/app/scripts/controllers/loanAccount/ViewLoanDetailsController.js +++ b/app/scripts/controllers/loanAccount/ViewLoanDetailsController.js @@ -1,363 +1,368 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewLoanDetailsController: function(scope, routeParams, resourceFactory, location, route, http,$modal,dateFilter,API_VERSION) { - scope.loandocuments = []; - scope.date = {}; - scope.date.payDate = new Date(); - scope.routeTo = function(loanId, transactionId, transactionTypeId){ - if (transactionTypeId == 2 || transactionTypeId == 4) { - location.path('/viewloantrxn/'+loanId+'/trxnId/'+transactionId); - }; - }; - scope.clickEvent = function(eventName, accountId) { - eventName = eventName || ""; - switch (eventName) { - case "addloancharge": - location.path('/addloancharge/' + accountId); - break; - case "addcollateral": - location.path('/addcollateral/' + accountId); - break; - case "assignloanofficer": - location.path('/assignloanofficer/' + accountId); - break; - case "modifyapplication": - location.path('/editloanaccount/' + accountId); - break; - case "approve": - location.path('/loanaccount/' + accountId + '/approve'); - break; - case "reject": - location.path('/loanaccount/' + accountId + '/reject'); - break; - case "withdrawnbyclient": - location.path('/loanaccount/' + accountId + '/withdrawnByApplicant'); - break; - case "delete": - resourceFactory.LoanAccountResource.delete({loanId:accountId}, {}, function(data){ - var destination = '/viewgroup/' + data.groupId; - if (data.clientId) destination = '/viewclient/' + data.clientId; - location.path(destination); - }); - break; - case "undoapproval": - location.path('/loanaccount/' + accountId + '/undoapproval'); - break; - case "disburse": - location.path('/loanaccount/' + accountId + '/disburse'); - break; - case "undodisbursal": - location.path('/loanaccount/' + accountId + '/undodisbursal'); - break; - case "makerepayment": - location.path('/loanaccount/' + accountId + '/repayment'); - break; - case "waiveinterest": - location.path('/loanaccount/' + accountId + '/waiveinterest'); - break; - case "writeoff": - location.path('/loanaccount/' + accountId + '/writeoff'); - break; - case "close-rescheduled": - location.path('/loanaccount/' + accountId + '/close-rescheduled'); - break; - case "transferFunds": - if (scope.loandetails.clientId) { - location.path('/accounttransfers/fromloans/'+accountId); - } - break; - case "close": - location.path('/loanaccount/' + accountId + '/close'); - break; - case "guarantor": - location.path('/guarantor/' + accountId); - break; - case "unassignloanofficer": - location.path('/loanaccount/' + accountId + '/unassignloanofficer'); - break; - case "loanscreenreport": - location.path('/loanscreenreport/' + accountId); - break; - } - }; +(function (module) { + mifosX.controllers = _.extend(module, { + ViewLoanDetailsController: function (scope, routeParams, resourceFactory, location, route, http, $modal, dateFilter, API_VERSION) { + scope.loandocuments = []; + scope.date = {}; + scope.date.payDate = new Date(); + scope.routeTo = function (loanId, transactionId, transactionTypeId) { + if (transactionTypeId == 2 || transactionTypeId == 4) { + location.path('/viewloantrxn/' + loanId + '/trxnId/' + transactionId); + } + ; + }; + scope.clickEvent = function (eventName, accountId) { + eventName = eventName || ""; + switch (eventName) { + case "addloancharge": + location.path('/addloancharge/' + accountId); + break; + case "addcollateral": + location.path('/addcollateral/' + accountId); + break; + case "assignloanofficer": + location.path('/assignloanofficer/' + accountId); + break; + case "modifyapplication": + location.path('/editloanaccount/' + accountId); + break; + case "approve": + location.path('/loanaccount/' + accountId + '/approve'); + break; + case "reject": + location.path('/loanaccount/' + accountId + '/reject'); + break; + case "withdrawnbyclient": + location.path('/loanaccount/' + accountId + '/withdrawnByApplicant'); + break; + case "delete": + resourceFactory.LoanAccountResource.delete({loanId: accountId}, {}, function (data) { + var destination = '/viewgroup/' + data.groupId; + if (data.clientId) destination = '/viewclient/' + data.clientId; + location.path(destination); + }); + break; + case "undoapproval": + location.path('/loanaccount/' + accountId + '/undoapproval'); + break; + case "disburse": + location.path('/loanaccount/' + accountId + '/disburse'); + break; + case "undodisbursal": + location.path('/loanaccount/' + accountId + '/undodisbursal'); + break; + case "makerepayment": + location.path('/loanaccount/' + accountId + '/repayment'); + break; + case "waiveinterest": + location.path('/loanaccount/' + accountId + '/waiveinterest'); + break; + case "writeoff": + location.path('/loanaccount/' + accountId + '/writeoff'); + break; + case "close-rescheduled": + location.path('/loanaccount/' + accountId + '/close-rescheduled'); + break; + case "transferFunds": + if (scope.loandetails.clientId) { + location.path('/accounttransfers/fromloans/' + accountId); + } + break; + case "close": + location.path('/loanaccount/' + accountId + '/close'); + break; + case "guarantor": + location.path('/guarantor/' + accountId); + break; + case "unassignloanofficer": + location.path('/loanaccount/' + accountId + '/unassignloanofficer'); + break; + case "loanscreenreport": + location.path('/loanscreenreport/' + accountId); + break; + } + }; - scope.delCharge = function (id) { - $modal.open({ - templateUrl: 'delcharge.html', - controller: DelChargeCtrl, - resolve:{ - ids: function () { - return id; + scope.delCharge = function (id) { + $modal.open({ + templateUrl: 'delcharge.html', + controller: DelChargeCtrl, + resolve: { + ids: function () { + return id; + } + } + }); + }; + + var DelChargeCtrl = function ($scope, $modalInstance, ids) { + $scope.delete = function () { + resourceFactory.LoanAccountResource.delete({loanId: routeParams.id, resourceType: 'charges', chargeId: ids}, {}, function (data) { + route.reload(); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + resourceFactory.LoanAccountResource.getLoanAccountDetails({loanId: routeParams.id, associations: 'all'}, function (data) { + scope.loandetails = data; + scope.guarantorDetails = data.guarantors; + scope.status = data.status.value; + scope.chargeAction = data.status.value == "Submitted and pending approval" ? true : false; + scope.decimals = data.currency.decimalPlaces; + if (scope.loandetails.charges) { + scope.charges = scope.loandetails.charges; + for (var i in scope.charges) { + if (scope.charges[i].paid || scope.charges[i].waived || scope.charges[i].chargeTimeType.value == 'Disbursement' || scope.loandetails.status.value != 'Active') { + var actionFlag = true; + } + else { + var actionFlag = false; + } + scope.charges[i].actionFlag = actionFlag; + } + + scope.chargeTableShow = true; + } + else { + scope.chargeTableShow = false; + } + + if (scope.status == "Submitted and pending approval" || scope.status == "Active" || scope.status == "Approved") { + scope.choice = true; + } + if (data.status.value == "Submitted and pending approval") { + scope.buttons = { singlebuttons: [ + { + name: "button.addloancharge", + icon: "icon-plus-sign" + }, + { + name: "button.approve", + icon: "icon-ok" + }, + { + name: "button.modifyapplication", + icon: "icon-edit" + }, + { + name: "button.reject", + icon: "icon-remove" + } + ], + options: [ + { + name: "button.assignloanofficer" + }, + { + name: "button.withdrawnbyclient" + }, + { + name: "button.delete" + }, + { + name: "button.addcollateral" + }, + { + name: "button.guarantor" + }, + { + name: "button.loanscreenreport" + } + ] + + }; + } + + if (data.status.value == "Approved") { + scope.buttons = { singlebuttons: [ + { + name: "button.assignloanofficer", + icon: "icon-user" + }, + { + name: "button.disburse", + icon: "icon-flag" + }, + { + name: "button.undoapproval", + icon: "icon-undo" + } + ], + options: [ + { + name: "button.addloancharge" + }, + { + name: "button.guarantor" + }, + { + name: "button.loanscreenreport" + } + ] + + }; + } + + if (data.status.value == "Active") { + scope.buttons = { singlebuttons: [ + { + name: "button.addloancharge", + icon: "icon-plus-sign" + }, + { + name: "button.makerepayment", + icon: "icon-dollar" + }, + { + name: "button.undodisbursal", + icon: "icon-undo" + } + ], + options: [ + { + name: "button.waiveinterest" + }, + { + name: "button.writeoff" + }, + { + name: "button.close-rescheduled" + }, + { + name: "button.close" + }, + { + name: "button.loanscreenreport" + } + ] + + }; + + if (data.canDisburse) { + scope.buttons.singlebuttons.splice(1, 0, { + name: "button.disburse", + icon: "icon-flag" + }); + } + //loan officer not assigned to loan, below logic + //helps to display otherwise not + if (!data.loanOfficerName) { + scope.buttons.singlebuttons.splice(1, 0, { + name: "button.assignloanofficer", + icon: "icon-user" + }); } } + if (data.status.value == "Overpaid") { + scope.buttons = { singlebuttons: [ + { + name: "button.transferFunds", + icon: "icon-exchange" + } + ] + }; + } }); - }; + scope.showDetails = function (id) { + resourceFactory.guarantorResource.get({loanId: routeParams.id, templateResource: id}, {}, function (data) { + scope.guarantorData = data; + }); - var DelChargeCtrl = function ($scope, $modalInstance,ids) { - $scope.delete = function () { - resourceFactory.LoanAccountResource.delete({loanId : routeParams.id, resourceType : 'charges', chargeId : ids}, {}, function(data) { + }; + scope.deleteGroup = function (id) { + scope.guarantorId = id; + $modal.open({ + templateUrl: 'deleteguarantor.html', + controller: GuarantorDeleteCtrl, + resolve: { + id: function () { + return scope.guarantorId; + } + } + }); + }; + var GuarantorDeleteCtrl = function ($scope, $modalInstance, id) { + $scope.delete = function () { + resourceFactory.guarantorResource.delete({loanId: routeParams.id, templateResource: id}, {}, function (data) { + route.reload(); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + scope.getLoanDocuments = function () { + resourceFactory.LoanDocumentResource.getLoanDocuments({loanId: routeParams.id}, function (data) { + for (var i in data) { + var loandocs = {}; + loandocs = API_VERSION + '/loans/' + data[i].parentEntityId + '/documents/' + data[i].id + '/attachment?tenantIdentifier=default'; + data[i].docUrl = loandocs; + } + scope.loandocuments = data; + }); + + }; + + resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_loan'}, function (data) { + scope.loandatatables = data; + }); + + scope.dataTableChange = function (datatable) { + resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, + entityId: routeParams.id, genericResultSet: 'true'}, function (data) { + scope.datatabledetails = data; + scope.datatabledetails.isData = data.data.length > 0 ? true : false; + scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; + scope.singleRow = []; + for (var i in data.columnHeaders) { + if (scope.datatabledetails.columnHeaders[i].columnCode) { + for (var j in scope.datatabledetails.columnHeaders[i].columnValues) { + for (var k in data.data) { + if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { + data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; + } + } + } + } + } + if (scope.datatabledetails.isData) { + for (var i in data.columnHeaders) { + if (!scope.datatabledetails.isMultirow) { + var row = {}; + row.key = data.columnHeaders[i].columnName; + row.value = data.data[0].row[i]; + scope.singleRow.push(row); + } + } + } + + }); + }; + + scope.deleteAll = function (apptableName, entityId) { + resourceFactory.DataTablesResource.delete({datatablename: apptableName, entityId: entityId, genericResultSet: 'true'}, {}, function (data) { route.reload(); }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + + scope.deleteDocument = function (documentId, index) { + resourceFactory.LoanDocumentResource.delete({loanId: scope.loandetails.id, documentId: documentId}, '', function (data) { + scope.loandocuments.splice(index, 1); + }); }; - }; - resourceFactory.LoanAccountResource.getLoanAccountDetails({loanId: routeParams.id, associations: 'all'}, function(data) { - scope.loandetails = data; - scope.guarantorDetails = data.guarantors; - scope.status = data.status.value; - scope.chargeAction = data.status.value == "Submitted and pending approval" ? true : false; - scope.decimals = data.currency.decimalPlaces; - if(scope.loandetails.charges) { - scope.charges = scope.loandetails.charges; - for(var i in scope.charges){ - if(scope.charges[i].paid || scope.charges[i].waived ||scope.charges[i].chargeTimeType.value=='Disbursement' || scope.loandetails.status.value!='Active') - { - var actionFlag = true; - } - else - { - var actionFlag = false; - } - scope.charges[i].actionFlag = actionFlag; - } + scope.downloadDocument = function (documentId) { + + }; - scope.chargeTableShow = true; - } - else { - scope.chargeTableShow = false; - } - - if(scope.status=="Submitted and pending approval" || scope.status=="Active" || scope.status=="Approved" ){ - scope.choice = true; - } - if (data.status.value == "Submitted and pending approval") { - scope.buttons = { singlebuttons : [ - { - name:"button.addloancharge", - icon :"icon-plus-sign" - }, - { - name:"button.approve", - icon :"icon-ok" - }, - { - name:"button.modifyapplication", - icon :"icon-edit" - }, - { - name:"button.reject", - icon :"icon-remove" - } - ], - options: [ - { - name:"button.assignloanofficer" - }, - { - name:"button.withdrawnbyclient" - }, - { - name:"button.delete" - }, - { - name:"button.addcollateral" - }, - { - name:"button.guarantor" - }, - { - name:"button.loanscreenreport" - }] - - }; } - - if (data.status.value == "Approved") { - scope.buttons = { singlebuttons : [ - { - name:"button.assignloanofficer", - icon :"icon-user" - }, - { - name:"button.disburse", - icon :"icon-flag" - }, - { - name:"button.undoapproval", - icon :"icon-undo" - } - ], - options: [{ - name:"button.addloancharge" - }, - { - name:"button.guarantor" - }, - { - name:"button.loanscreenreport" - }] - - }; - } - - if (data.status.value == "Active") { - scope.buttons = { singlebuttons : [{ - name:"button.addloancharge", - icon :"icon-plus-sign" - }, - { - name:"button.makerepayment", - icon:"icon-dollar" - }, - { - name:"button.undodisbursal", - icon :"icon-undo" - } - ], - options: [ - { - name:"button.waiveinterest" - }, - { - name:"button.writeoff" - }, - { - name:"button.close-rescheduled" - }, - { - name:"button.close" - }, - { - name:"button.loanscreenreport" - }] - - }; - - if (data.canDisburse) { - scope.buttons.singlebuttons.splice(1,0,{ - name:"button.disburse", - icon :"icon-flag" - }); - } - //loan officer not assigned to loan, below logic - //helps to display otherwise not - if (!data.loanOfficerName) { - scope.buttons.singlebuttons.splice(1,0,{ - name:"button.assignloanofficer", - icon :"icon-user" - }); - } - } - if (data.status.value == "Overpaid") { - scope.buttons = { singlebuttons : [{ - name:"button.transferFunds", - icon :"icon-exchange" - } - ] - }; - } - }); - scope.showDetails = function(id){ - resourceFactory.guarantorResource.get({loanId: routeParams.id,templateResource:id}, {}, function(data) { - scope.guarantorData = data; - }); - - }; - scope.deleteGroup = function (id) { - scope.guarantorId = id; - $modal.open({ - templateUrl: 'deleteguarantor.html', - controller: GuarantorDeleteCtrl, - resolve: { - id: function(){ - return scope.guarantorId; - } - } - }); - }; - var GuarantorDeleteCtrl = function ($scope, $modalInstance,id) { - $scope.delete = function () { - resourceFactory.guarantorResource.delete({loanId: routeParams.id,templateResource:id}, {}, function(data) { - route.reload(); - }); - $modalInstance.close('delete'); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - - scope.getLoanDocuments = function (){ - resourceFactory.LoanDocumentResource.getLoanDocuments({loanId: routeParams.id}, function(data) { - for(var i in data){ - var loandocs = {}; - loandocs = API_VERSION + '/loans/' + data[i].parentEntityId + '/documents/' + data[i].id + '/attachment?tenantIdentifier=default'; - data[i].docUrl = loandocs; - } - scope.loandocuments = data; - }); - - }; - - resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_loan'} , function(data) { - scope.loandatatables = data; - }); - - scope.dataTableChange = function(datatable) { - resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, - entityId: routeParams.id, genericResultSet: 'true'} , function(data) { - scope.datatabledetails = data; - scope.datatabledetails.isData = data.data.length > 0 ? true : false; - scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; - scope.singleRow = []; - for(var i in data.columnHeaders) { - if (scope.datatabledetails.columnHeaders[i].columnCode) { - for (var j in scope.datatabledetails.columnHeaders[i].columnValues){ - for(var k in data.data) { - if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { - data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; - } - } - } - } - } - if(scope.datatabledetails.isData){ - for(var i in data.columnHeaders){ - if(!scope.datatabledetails.isMultirow){ - var row = {}; - row.key = data.columnHeaders[i].columnName; - row.value = data.data[0].row[i]; - scope.singleRow.push(row); - } - } - } - - }); - }; - - scope.deleteAll = function (apptableName, entityId) { - resourceFactory.DataTablesResource.delete({datatablename:apptableName, entityId:entityId, genericResultSet:'true'}, {}, function(data){ - route.reload(); - }); - }; - - scope.deleteDocument = function (documentId, index) { - resourceFactory.LoanDocumentResource.delete({loanId: scope.loandetails.id, documentId: documentId}, '', function(data) { - scope.loandocuments.splice(index,1); - }); - }; - - scope.downloadDocument = function(documentId) { - - }; - - } - }); - mifosX.ng.application.controller('ViewLoanDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', '$http','$modal','dateFilter','API_VERSION', mifosX.controllers.ViewLoanDetailsController]).run(function($log) { - $log.info("ViewLoanDetailsController initialized"); - }); + }); + mifosX.ng.application.controller('ViewLoanDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', '$http', '$modal', 'dateFilter', 'API_VERSION', mifosX.controllers.ViewLoanDetailsController]).run(function ($log) { + $log.info("ViewLoanDetailsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/ViewLoanTransactionController.js b/app/scripts/controllers/loanAccount/ViewLoanTransactionController.js index b4dcd0b7..18b686ee 100644 --- a/app/scripts/controllers/loanAccount/ViewLoanTransactionController.js +++ b/app/scripts/controllers/loanAccount/ViewLoanTransactionController.js @@ -1,23 +1,23 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewLoanTransactionController: function(scope, resourceFactory, location, routeParams, dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewLoanTransactionController: function (scope, resourceFactory, location, routeParams, dateFilter) { - resourceFactory.loanTrxnsResource.get({loanId:routeParams.accountId, transactionId:routeParams.id}, function(data){ - scope.transaction = data; - scope.transaction.accountId = routeParams.accountId; - }); + resourceFactory.loanTrxnsResource.get({loanId: routeParams.accountId, transactionId: routeParams.id}, function (data) { + scope.transaction = data; + scope.transaction.accountId = routeParams.accountId; + }); - scope.undoTransaction = function(accountId, transactionId) { - var params = {loanId:accountId, transactionId:transactionId, command:'undo'}; - var formData = {dateFormat:scope.df, locale:scope.optlang.code, transactionAmount:0}; - formData.transactionDate = dateFilter(new Date(),scope.df); - resourceFactory.loanTrxnsResource.save(params, formData, function(data){ - location.path('/viewloanaccount/' + data.loanId); - }); - }; - } - }); - mifosX.ng.application.controller('ViewLoanTransactionController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ViewLoanTransactionController]).run(function($log) { - $log.info("ViewLoanTransactionController initialized"); - }); + scope.undoTransaction = function (accountId, transactionId) { + var params = {loanId: accountId, transactionId: transactionId, command: 'undo'}; + var formData = {dateFormat: scope.df, locale: scope.optlang.code, transactionAmount: 0}; + formData.transactionDate = dateFilter(new Date(), scope.df); + resourceFactory.loanTrxnsResource.save(params, formData, function (data) { + location.path('/viewloanaccount/' + data.loanId); + }); + }; + } + }); + mifosX.ng.application.controller('ViewLoanTransactionController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ViewLoanTransactionController]).run(function ($log) { + $log.info("ViewLoanTransactionController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/AdHocQuerySearchController.js b/app/scripts/controllers/main/AdHocQuerySearchController.js index b9890f4e..9a915795 100644 --- a/app/scripts/controllers/main/AdHocQuerySearchController.js +++ b/app/scripts/controllers/main/AdHocQuerySearchController.js @@ -1,122 +1,138 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AdHocQuerySearchController: function(scope, routeParams, dateFilter, resourceFactory) { - scope.formData = {}; - scope.showResults = false; +(function (module) { + mifosX.controllers = _.extend(module, { + AdHocQuerySearchController: function (scope, routeParams, dateFilter, resourceFactory) { + scope.formData = {}; + scope.showResults = false; - resourceFactory.globalSearchTemplateResource.get(function(data){ - scope.searchTemplate = data; - scope.formData.loanfromdate = new Date(); - scope.formData.loantodate = new Date(); - scope.formData.loandatetype = "approvalDate"; - scope.showDateFields = true; - scope.formData.loans = "loans"; - scope.formData.includeOutStandingAmountPercentage = true; - scope.formData.outStandingAmountPercentageCondition = 'between'; - scope.formData.includeOutstandingAmount = true; - scope.formData.outstandingAmountCondition = 'between'; - }); + resourceFactory.globalSearchTemplateResource.get(function (data) { + scope.searchTemplate = data; + scope.formData.loanfromdate = new Date(); + scope.formData.loantodate = new Date(); + scope.formData.loandatetype = "approvalDate"; + scope.showDateFields = true; + scope.formData.loans = "loans"; + scope.formData.includeOutStandingAmountPercentage = true; + scope.formData.outStandingAmountPercentageCondition = 'between'; + scope.formData.includeOutstandingAmount = true; + scope.formData.outstandingAmountCondition = 'between'; + }); - scope.updatePercentageType = function() { - if (scope.formData.percentagetype == 'between') { - scope.formData.percentage = undefined; - } else { - scope.formData.minpercentage = undefined; - scope.formData.maxpercentage = undefined; - } - }; - - scope.updateOutstandingType = function() { - if (scope.formData.outstandingType == 'between') { - scope.formData.outstandingamt = undefined; - } else { - scope.formData.minoutstandingamt = undefined; - scope.formData.maxoutstandingamt = undefined; - } - }; - - scope.updateLoanDateType = function () { - if (scope.formData.loandatetype=="approvalDate" || scope.formData.loandatetype=="createdDate" || scope.formData.loandatetype=="disbursalDate") { - scope.showDateFields = true; - } else{ - scope.showDateFields = false; - } - }; - - scope.submit = function (){ - var adHocQuery = { "locale":scope.optlang.code, "dateFormat":"yyyy-MM-dd"}; - if (scope.formData.loans) { - adHocQuery.entities = adHocQuery.entities || []; - adHocQuery.entities.push(scope.formData.loans); - }; - if (scope.formData.allloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.allloans); - }; - if (scope.formData.activeloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.activeloans); - }; - if (scope.formData.overpaidloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.overpaidloans); - }; - if (scope.formData.arrearloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.arrearloans); - }; - if (scope.formData.closedloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.closedloans); - }; - if (scope.formData.writeoffloans) { - adHocQuery.loanStatus = adHocQuery.loanStatus || []; - adHocQuery.loanStatus.push(scope.formData.writeoffloans); - }; - if (scope.formData.loanProducts) { - adHocQuery.loanProducts = scope.formData.loanProducts; - }; - if (scope.formData.offices) { - adHocQuery.offices = scope.formData.offices; - }; - if (scope.formData.loandatetype) { - adHocQuery.loanDateOption = scope.formData.loandatetype; - adHocQuery.loanFromDate = dateFilter(scope.formData.loanfromdate,adHocQuery.dateFormat); - adHocQuery.loanToDate = dateFilter(scope.formData.loantodate,adHocQuery.dateFormat); - }; - if (scope.formData.includeOutStandingAmountPercentage) { - adHocQuery.includeOutStandingAmountPercentage = scope.formData.includeOutStandingAmountPercentage; - if (scope.formData.outStandingAmountPercentageCondition) { - adHocQuery.outStandingAmountPercentageCondition = scope.formData.outStandingAmountPercentageCondition; - if (adHocQuery.outStandingAmountPercentageCondition == 'between') { - adHocQuery.minOutStandingAmountPercentage = scope.formData.minOutStandingAmountPercentage; - adHocQuery.maxOutStandingAmountPercentage = scope.formData.maxOutStandingAmountPercentage; - } else{ - adHocQuery.outStandingAmountPercentage = scope.formData.outStandingAmountPercentage; + scope.updatePercentageType = function () { + if (scope.formData.percentagetype == 'between') { + scope.formData.percentage = undefined; + } else { + scope.formData.minpercentage = undefined; + scope.formData.maxpercentage = undefined; + } }; - }; - }; - if (scope.formData.includeOutstandingAmount) { - adHocQuery.includeOutstandingAmount = scope.formData.includeOutstandingAmount; - if (scope.formData.outstandingAmountCondition) { - adHocQuery.outstandingAmountCondition = scope.formData.outstandingAmountCondition; - if (adHocQuery.outstandingAmountCondition == 'between') { - adHocQuery.minOutstandingAmount = scope.formData.minOutstandingAmount; - adHocQuery.maxOutstandingAmount = scope.formData.maxOutstandingAmount; - } else{ - adHocQuery.outstandingAmount = scope.formData.outstandingAmount; + scope.updateOutstandingType = function () { + if (scope.formData.outstandingType == 'between') { + scope.formData.outstandingamt = undefined; + } else { + scope.formData.minoutstandingamt = undefined; + scope.formData.maxoutstandingamt = undefined; + } }; - }; - }; - resourceFactory.globalAdHocSearchResource.search(adHocQuery,function(data){ - scope.searchResults = data; - scope.showResults = true; - }); - }; - } - }); - mifosX.ng.application.controller('AdHocQuerySearchController', ['$scope','$routeParams', 'dateFilter', 'ResourceFactory', mifosX.controllers.AdHocQuerySearchController]).run(function($log) { - $log.info("AdHocQuerySearchController initialized"); - }); + + scope.updateLoanDateType = function () { + if (scope.formData.loandatetype == "approvalDate" || scope.formData.loandatetype == "createdDate" || scope.formData.loandatetype == "disbursalDate") { + scope.showDateFields = true; + } else { + scope.showDateFields = false; + } + }; + + scope.submit = function () { + var adHocQuery = { "locale": scope.optlang.code, "dateFormat": "yyyy-MM-dd"}; + if (scope.formData.loans) { + adHocQuery.entities = adHocQuery.entities || []; + adHocQuery.entities.push(scope.formData.loans); + } + ; + if (scope.formData.allloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.allloans); + } + ; + if (scope.formData.activeloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.activeloans); + } + ; + if (scope.formData.overpaidloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.overpaidloans); + } + ; + if (scope.formData.arrearloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.arrearloans); + } + ; + if (scope.formData.closedloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.closedloans); + } + ; + if (scope.formData.writeoffloans) { + adHocQuery.loanStatus = adHocQuery.loanStatus || []; + adHocQuery.loanStatus.push(scope.formData.writeoffloans); + } + ; + if (scope.formData.loanProducts) { + adHocQuery.loanProducts = scope.formData.loanProducts; + } + ; + if (scope.formData.offices) { + adHocQuery.offices = scope.formData.offices; + } + ; + if (scope.formData.loandatetype) { + adHocQuery.loanDateOption = scope.formData.loandatetype; + adHocQuery.loanFromDate = dateFilter(scope.formData.loanfromdate, adHocQuery.dateFormat); + adHocQuery.loanToDate = dateFilter(scope.formData.loantodate, adHocQuery.dateFormat); + } + ; + if (scope.formData.includeOutStandingAmountPercentage) { + adHocQuery.includeOutStandingAmountPercentage = scope.formData.includeOutStandingAmountPercentage; + if (scope.formData.outStandingAmountPercentageCondition) { + adHocQuery.outStandingAmountPercentageCondition = scope.formData.outStandingAmountPercentageCondition; + if (adHocQuery.outStandingAmountPercentageCondition == 'between') { + adHocQuery.minOutStandingAmountPercentage = scope.formData.minOutStandingAmountPercentage; + adHocQuery.maxOutStandingAmountPercentage = scope.formData.maxOutStandingAmountPercentage; + } else { + adHocQuery.outStandingAmountPercentage = scope.formData.outStandingAmountPercentage; + } + ; + } + ; + } + ; + + if (scope.formData.includeOutstandingAmount) { + adHocQuery.includeOutstandingAmount = scope.formData.includeOutstandingAmount; + if (scope.formData.outstandingAmountCondition) { + adHocQuery.outstandingAmountCondition = scope.formData.outstandingAmountCondition; + if (adHocQuery.outstandingAmountCondition == 'between') { + adHocQuery.minOutstandingAmount = scope.formData.minOutstandingAmount; + adHocQuery.maxOutstandingAmount = scope.formData.maxOutstandingAmount; + } else { + adHocQuery.outstandingAmount = scope.formData.outstandingAmount; + } + ; + } + ; + } + ; + resourceFactory.globalAdHocSearchResource.search(adHocQuery, function (data) { + scope.searchResults = data; + scope.showResults = true; + }); + }; + } + }); + mifosX.ng.application.controller('AdHocQuerySearchController', ['$scope', '$routeParams', 'dateFilter', 'ResourceFactory', mifosX.controllers.AdHocQuerySearchController]).run(function ($log) { + $log.info("AdHocQuerySearchController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/ExpertSearchController.js b/app/scripts/controllers/main/ExpertSearchController.js index 90718113..8676fbcd 100644 --- a/app/scripts/controllers/main/ExpertSearchController.js +++ b/app/scripts/controllers/main/ExpertSearchController.js @@ -1,9 +1,9 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ExpertSearchController: function(scope, resourceFactory , localStorageService,$rootScope,location) { + ExpertSearchController: function (scope, resourceFactory, localStorageService, $rootScope, location) { scope.recent = []; - scope.recent=localStorageService.get('Location'); + scope.recent = localStorageService.get('Location'); scope.recentEight = []; scope.frequent = []; scope.recentArray = []; @@ -12,10 +12,10 @@ scope.recents = []; //to retrieve last 8 recent activities - for(var rev= scope.recent.length-1;rev>0;rev--){ - scope.recentArray.push(scope.recent[rev]); + for (var rev = scope.recent.length - 1; rev > 0; rev--) { + scope.recentArray.push(scope.recent[rev]); } - scope.unique = function(array) { + scope.unique = function (array) { array.forEach(function (value) { if (scope.uniqueArray.indexOf(value) === -1) { scope.uniqueArray.push(value); @@ -26,174 +26,234 @@ //recent activities retrieved //retrieve last 8 recent activities - for(var l=0; l<11;l++){ - if(scope.uniqueArray[l]){ - if(scope.uniqueArray[l]!='/'){ if(scope.uniqueArray[l]!='/home'){ - scope.recents.push(scope.uniqueArray[l]); - }} + for (var l = 0; l < 11; l++) { + if (scope.uniqueArray[l]) { + if (scope.uniqueArray[l] != '/') { + if (scope.uniqueArray[l] != '/home') { + scope.recents.push(scope.uniqueArray[l]); + } + } } } // 8 recent activities retrieved //count duplicates var i = scope.recent.length; - var obj ={}; - while (i) - { + var obj = {}; + while (i) { obj[scope.recent[--i]] = (obj[scope.recent[i]] || 0) + 1; } //count ends here - //to sort based on counts + //to sort based on counts var sortable = []; - for (var i in obj){ + for (var i in obj) { sortable.push([i, obj[i]]); } - sortable.sort(function(a, b) {return a[1] - b[1]}); + sortable.sort(function (a, b) { + return a[1] - b[1] + }); //sort end here //to retrieve the locations from sorted array - var sortedArray =[]; - for(var key in sortable) { + var sortedArray = []; + for (var key in sortable) { sortedArray.push(sortable[key][0]); } //retrieving ends here //retrieve last 8 frequent actions - for(var freq = sortedArray.length-1; freq>sortedArray.length-11;freq--){ - if(sortedArray[freq]){ - if(sortedArray[freq]!='/'){ if(sortedArray[freq]!='/home'){ - scope.frequent.push(sortedArray[freq]); - }} + for (var freq = sortedArray.length - 1; freq > sortedArray.length - 11; freq--) { + if (sortedArray[freq]) { + if (sortedArray[freq] != '/') { + if (sortedArray[freq] != '/home') { + scope.frequent.push(sortedArray[freq]); + } + } } } // retrieved 8 frequent actions - scope.searchParams = ['create client','clients','create group','groups','centers','create center','configuration','tasks','templates','system users', - 'create template', 'create loan product', 'create saving product', 'roles', 'add role', 'configure maker checker tasks', - 'users', 'loan products', 'charges', 'saving products', 'offices', 'create office', 'currency configurations', 'user settings', - 'create user', 'employees', 'create employee', 'manage funds', 'offices', 'chart of accounts', 'frequent postings', 'Journal entry', - 'search transaction', 'account closure', 'accounting rules', 'add accounting rule', 'data tables', 'create data table', 'add code', - 'jobs', 'codes', 'reports', 'create report', 'holidays', 'create holiday', 'create charge', 'product mix', 'add member', 'add product mix', - 'bulk loan reassignment', 'audit', 'create accounting closure', 'enter collection sheet','navigation','accounting','organization','system' - ]; - scope.search = function(){ - switch(this.formData.search){ - case 'create client': location.path('/createclient'); - break; - case 'clients': location.path('/clients'); - break; - case 'create group': location.path('/creategroup'); - break; - case 'groups': location.path('/groups'); - break; - case 'create center': location.path('/createcenter'); - break; - case 'centers': location.path('/centers'); - break; - case 'configuration': location.path('/global'); - break; - case 'tasks': location.path('/tasks'); - break; - case 'templates': location.path('/templates'); - break; - case 'create template': location.path('/createtemplate'); - break; - case 'create loan product': location.path('/createloanproduct'); - break; - case 'create saving product': location.path('/createsavingproduct'); - break; - case 'roles': location.path('/admin/roles'); - break; - case 'add role': location.path('/admin/addrole'); - break; - case 'configure maker checker tasks': location.path('/admin/viewmctasks'); - break; - case 'loan products': location.path('/loanproducts'); - break; - case 'charges': location.path('/charges'); - break; - case 'saving products': location.path('/savingproducts'); - break; - case 'offices': location.path('/offices'); - break; - case 'create office': location.path('/createoffice'); - break; - case 'currency configurations': location.path('/currconfig'); - break; - case 'user settings': location.path('/usersetting'); - break; - case 'employees': location.path('/employees'); - break; - case 'create employee': location.path('/createemployee'); - break; - case 'manage funds': location.path('/managefunds'); - break; - case 'chart of accounts': location.path('/accounting_coa'); - break; - case 'frequent postings': location.path('/freqposting'); - break; - case 'journal entry': location.path('/journalentry'); - break; - case 'search transaction': location.path('/searchtransaction'); - break; - case 'account closure': location.path('/accounts_closure'); - break; - case 'accounting rules': location.path('/accounting_rules'); - break; - case 'add accounting rule': location.path('/add_accrule'); - break; - case 'data tables': location.path('/datatables'); - break; - case 'create data table': location.path('/createdatatable'); - break; - case 'add code': location.path('/addcode'); - break; - case 'jobs': location.path('/jobs'); - break; - case 'codes': location.path('/codes'); - break; - case 'reports': location.path('/reports'); - break; - case 'create report': location.path('/createreport'); - break; - case 'holidays': location.path('/holidays'); - break; - case 'create holiday': location.path('/createholiday'); - break; - case 'add member': location.path('/addmember'); - break; - case 'create charge': location.path('/createcharge'); - break; - case 'enter collection sheet': location.path('/entercollectionsheet'); - break; - case 'product mix': location.path('/productmix'); - break; - case 'add product mix': location.path('/addproductmix'); - break; - case 'bulk loan reassignment': location.path('/bulkloan'); - break; - case 'audit': location.path('/audit'); - break; - case 'create accounting closure': location.path('/createclosure'); - break; - case 'navigation': location.path('/nav/offices'); - break; - case 'accounting': location.path('/accounting'); - break; - case 'organization': location.path('/organization'); - break; - case 'system': location.path('/system'); - break; - case 'system users': location.path('/admin/users'); - break; - default: location.path('/home'); - } - } + scope.searchParams = ['create client', 'clients', 'create group', 'groups', 'centers', 'create center', 'configuration', 'tasks', 'templates', 'system users', + 'create template', 'create loan product', 'create saving product', 'roles', 'add role', 'configure maker checker tasks', + 'users', 'loan products', 'charges', 'saving products', 'offices', 'create office', 'currency configurations', 'user settings', + 'create user', 'employees', 'create employee', 'manage funds', 'offices', 'chart of accounts', 'frequent postings', 'Journal entry', + 'search transaction', 'account closure', 'accounting rules', 'add accounting rule', 'data tables', 'create data table', 'add code', + 'jobs', 'codes', 'reports', 'create report', 'holidays', 'create holiday', 'create charge', 'product mix', 'add member', 'add product mix', + 'bulk loan reassignment', 'audit', 'create accounting closure', 'enter collection sheet', 'navigation', 'accounting', 'organization', 'system' + ]; + scope.search = function () { + switch (this.formData.search) { + case 'create client': + location.path('/createclient'); + break; + case 'clients': + location.path('/clients'); + break; + case 'create group': + location.path('/creategroup'); + break; + case 'groups': + location.path('/groups'); + break; + case 'create center': + location.path('/createcenter'); + break; + case 'centers': + location.path('/centers'); + break; + case 'configuration': + location.path('/global'); + break; + case 'tasks': + location.path('/tasks'); + break; + case 'templates': + location.path('/templates'); + break; + case 'create template': + location.path('/createtemplate'); + break; + case 'create loan product': + location.path('/createloanproduct'); + break; + case 'create saving product': + location.path('/createsavingproduct'); + break; + case 'roles': + location.path('/admin/roles'); + break; + case 'add role': + location.path('/admin/addrole'); + break; + case 'configure maker checker tasks': + location.path('/admin/viewmctasks'); + break; + case 'loan products': + location.path('/loanproducts'); + break; + case 'charges': + location.path('/charges'); + break; + case 'saving products': + location.path('/savingproducts'); + break; + case 'offices': + location.path('/offices'); + break; + case 'create office': + location.path('/createoffice'); + break; + case 'currency configurations': + location.path('/currconfig'); + break; + case 'user settings': + location.path('/usersetting'); + break; + case 'employees': + location.path('/employees'); + break; + case 'create employee': + location.path('/createemployee'); + break; + case 'manage funds': + location.path('/managefunds'); + break; + case 'chart of accounts': + location.path('/accounting_coa'); + break; + case 'frequent postings': + location.path('/freqposting'); + break; + case 'journal entry': + location.path('/journalentry'); + break; + case 'search transaction': + location.path('/searchtransaction'); + break; + case 'account closure': + location.path('/accounts_closure'); + break; + case 'accounting rules': + location.path('/accounting_rules'); + break; + case 'add accounting rule': + location.path('/add_accrule'); + break; + case 'data tables': + location.path('/datatables'); + break; + case 'create data table': + location.path('/createdatatable'); + break; + case 'add code': + location.path('/addcode'); + break; + case 'jobs': + location.path('/jobs'); + break; + case 'codes': + location.path('/codes'); + break; + case 'reports': + location.path('/reports'); + break; + case 'create report': + location.path('/createreport'); + break; + case 'holidays': + location.path('/holidays'); + break; + case 'create holiday': + location.path('/createholiday'); + break; + case 'add member': + location.path('/addmember'); + break; + case 'create charge': + location.path('/createcharge'); + break; + case 'enter collection sheet': + location.path('/entercollectionsheet'); + break; + case 'product mix': + location.path('/productmix'); + break; + case 'add product mix': + location.path('/addproductmix'); + break; + case 'bulk loan reassignment': + location.path('/bulkloan'); + break; + case 'audit': + location.path('/audit'); + break; + case 'create accounting closure': + location.path('/createclosure'); + break; + case 'navigation': + location.path('/nav/offices'); + break; + case 'accounting': + location.path('/accounting'); + break; + case 'organization': + location.path('/organization'); + break; + case 'system': + location.path('/system'); + break; + case 'system users': + location.path('/admin/users'); + break; + default: + location.path('/home'); + } + } } }); - mifosX.ng.application.controller('ExpertSearchController', ['$scope', 'ResourceFactory', 'localStorageService','$rootScope','$location', mifosX.controllers.ExpertSearchController]).run(function($log) { + mifosX.ng.application.controller('ExpertSearchController', ['$scope', 'ResourceFactory', 'localStorageService', '$rootScope', '$location', mifosX.controllers.ExpertSearchController]).run(function ($log) { $log.info("ExpertSearchController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/LoginFormController.js b/app/scripts/controllers/main/LoginFormController.js index 144adadf..a0dd06af 100644 --- a/app/scripts/controllers/main/LoginFormController.js +++ b/app/scripts/controllers/main/LoginFormController.js @@ -1,24 +1,24 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - LoginFormController: function(scope, authenticationService) { - scope.loginCredentials = {}; - scope.authenticationFailed = false; +(function (module) { + mifosX.controllers = _.extend(module, { + LoginFormController: function (scope, authenticationService) { + scope.loginCredentials = {}; + scope.authenticationFailed = false; + + scope.login = function () { + authenticationService.authenticateWithUsernamePassword(scope.loginCredentials); + }; + $('#pwd').keypress(function (e) { + if (e.which == 13) { + scope.login(); + } + }); + scope.$on("UserAuthenticationFailureEvent", function (data) { + scope.authenticationFailed = true; + }); - scope.login = function() { - authenticationService.authenticateWithUsernamePassword(scope.loginCredentials); - }; - $('#pwd').keypress(function(e) { - if(e.which == 13) { - scope.login(); } - }); - scope.$on("UserAuthenticationFailureEvent", function(data) { - scope.authenticationFailed = true; - }); - - } - }); - mifosX.ng.application.controller('LoginFormController', ['$scope', 'AuthenticationService', mifosX.controllers.LoginFormController]).run(function($log) { - $log.info("LoginFormController initialized"); - }); + }); + mifosX.ng.application.controller('LoginFormController', ['$scope', 'AuthenticationService', mifosX.controllers.LoginFormController]).run(function ($log) { + $log.info("LoginFormController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/MainController.js b/app/scripts/controllers/main/MainController.js index 037da0b0..459104f4 100644 --- a/app/scripts/controllers/main/MainController.js +++ b/app/scripts/controllers/main/MainController.js @@ -1,231 +1,232 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - MainController: function(scope, location, sessionManager, translate,$rootScope,localStorageService,keyboardManager,$idle) { - scope.activity = {}; - scope.activityQueue = []; - if(localStorageService.get('Location')){ - scope.activityQueue = localStorageService.get('Location'); - } - scope.setDf = function(){ - if(localStorageService.get('dateformat')){ - scope.dateformat = localStorageService.get('dateformat'); - }else{ - localStorageService.add('dateformat','dd MMMM yyyy'); - scope.dateformat = 'dd MMMM yyyy'; +(function (module) { + mifosX.controllers = _.extend(module, { + MainController: function (scope, location, sessionManager, translate, $rootScope, localStorageService, keyboardManager, $idle) { + scope.activity = {}; + scope.activityQueue = []; + if (localStorageService.get('Location')) { + scope.activityQueue = localStorageService.get('Location'); } - scope.df = scope.dateformat; - }; - scope.setDf(); - $rootScope.setPermissions = function(permissions) { - $rootScope.permissionList = permissions; - localStorageService.add('userPermissions',permissions); - $rootScope.$broadcast('permissionsChanged') - }; - - $rootScope.hasPermission = function (permission) { - permission = permission.trim(); - //FYI: getting all permissions from localstorage, because if scope changes permissions array will become undefined - $rootScope.permissionList = localStorageService.get('userPermissions'); - //If user is a Super user return true - if ($rootScope.permissionList && _.contains($rootScope.permissionList,"ALL_FUNCTIONS")) { - return true; - } else if ($rootScope.permissionList && permission && permission != "") { - //If user have all read permission return true - if (permission.substring(0,5) == "READ_" && _.contains($rootScope.permissionList,"ALL_FUNCTIONS_READ")) { - return true; - } else if (_.contains($rootScope.permissionList, permission)) { - //check for the permission if user doesn't have any special permissions - return true; - } else { - //return false if user doesn't have permission - return false; - } - } else { - //return false if no value assigned to has-permission directive - return false; - }; - }; - - scope.$watch(function() { - return location.path(); - }, function() { - scope.activity= location.path(); - scope.activityQueue.push(scope.activity); - localStorageService.add('Location',scope.activityQueue); - }); - - //Logout the user if Idle - scope.started = false; - scope.$on('$idleTimeout', function() { - scope.logout(); - $idle.unwatch(); - scope.started = false; - }); - - scope.start = function(session) { - if(session){ - $idle.watch(); - scope.started = true; - } - }; - - scope.leftnav = false; - scope.$on("UserAuthenticationSuccessEvent", function(event, data) { - scope.currentSession = sessionManager.get(data); - scope.start(scope.currentSession); - if(scope.currentSession.user && scope.currentSession.user.userPermissions) { - $rootScope.setPermissions(scope.currentSession.user.userPermissions); - } - location.path('/home').replace(); - }); - - scope.search = function(){ - location.path('/search/' + scope.search.query ); - }; - scope.text = 'Mifos X is designed by the Mifos Initiative.'+ - ' A global community thats aims to speed the elimination of poverty by enabling Organizations to more effectively and efficiently deliver responsible financial services to the world’s poor and unbanked
'+ - 'Sounds interesting? Get involved!'; - - scope.logout = function() { - scope.currentSession = sessionManager.clear(); - location.path('/').replace(); - }; - - scope.langs = mifosX.models.Langs; - if(localStorageService.get('Language')){ - var temp=localStorageService.get('Language'); - for(var i in mifosX.models.Langs){ - if(mifosX.models.Langs[i].code == temp.code){ - scope.optlang = mifosX.models.Langs[i]; + scope.setDf = function () { + if (localStorageService.get('dateformat')) { + scope.dateformat = localStorageService.get('dateformat'); + } else { + localStorageService.add('dateformat', 'dd MMMM yyyy'); + scope.dateformat = 'dd MMMM yyyy'; } + scope.df = scope.dateformat; + }; + scope.setDf(); + $rootScope.setPermissions = function (permissions) { + $rootScope.permissionList = permissions; + localStorageService.add('userPermissions', permissions); + $rootScope.$broadcast('permissionsChanged') + }; + + $rootScope.hasPermission = function (permission) { + permission = permission.trim(); + //FYI: getting all permissions from localstorage, because if scope changes permissions array will become undefined + $rootScope.permissionList = localStorageService.get('userPermissions'); + //If user is a Super user return true + if ($rootScope.permissionList && _.contains($rootScope.permissionList, "ALL_FUNCTIONS")) { + return true; + } else if ($rootScope.permissionList && permission && permission != "") { + //If user have all read permission return true + if (permission.substring(0, 5) == "READ_" && _.contains($rootScope.permissionList, "ALL_FUNCTIONS_READ")) { + return true; + } else if (_.contains($rootScope.permissionList, permission)) { + //check for the permission if user doesn't have any special permissions + return true; + } else { + //return false if user doesn't have permission + return false; + } + } else { + //return false if no value assigned to has-permission directive + return false; + } + ; + }; + + scope.$watch(function () { + return location.path(); + }, function () { + scope.activity = location.path(); + scope.activityQueue.push(scope.activity); + localStorageService.add('Location', scope.activityQueue); + }); + + //Logout the user if Idle + scope.started = false; + scope.$on('$idleTimeout', function () { + scope.logout(); + $idle.unwatch(); + scope.started = false; + }); + + scope.start = function (session) { + if (session) { + $idle.watch(); + scope.started = true; + } + }; + + scope.leftnav = false; + scope.$on("UserAuthenticationSuccessEvent", function (event, data) { + scope.currentSession = sessionManager.get(data); + scope.start(scope.currentSession); + if (scope.currentSession.user && scope.currentSession.user.userPermissions) { + $rootScope.setPermissions(scope.currentSession.user.userPermissions); + } + location.path('/home').replace(); + }); + + scope.search = function () { + location.path('/search/' + scope.search.query); + }; + scope.text = 'Mifos X is designed by the Mifos Initiative.' + + ' A global community thats aims to speed the elimination of poverty by enabling Organizations to more effectively and efficiently deliver responsible financial services to the world’s poor and unbanked
' + + 'Sounds interesting? Get involved!'; + + scope.logout = function () { + scope.currentSession = sessionManager.clear(); + location.path('/').replace(); + }; + + scope.langs = mifosX.models.Langs; + if (localStorageService.get('Language')) { + var temp = localStorageService.get('Language'); + for (var i in mifosX.models.Langs) { + if (mifosX.models.Langs[i].code == temp.code) { + scope.optlang = mifosX.models.Langs[i]; + } + } + } else { + scope.optlang = scope.langs[0]; } - } else{ - scope.optlang = scope.langs[0]; + translate.uses(scope.optlang.code); + + scope.isActive = function (route) { + if (route == 'clients') { + var temp = ['/clients', '/groups', '/centers']; + for (var i in temp) { + if (temp[i] == location.path()) { + return true; + } + } + } + else if (route == 'acc') { + var temp1 = ['/accounting', '/freqposting', '/accounting_coa', '/journalentry', '/accounts_closure', '/Searchtransaction', '/accounting_rules']; + for (var i in temp1) { + if (temp1[i] == location.path()) { + return true; + } + } + } + else if (route == 'rep') { + var temp2 = ['/reports/all', '/reports/clients', '/reports/loans', '/reports/funds', '/reports/accounting']; + for (var i in temp2) { + if (temp2[i] == location.path()) { + return true; + } + } + } + else if (route == 'admin') { + var temp3 = ['/users/', '/organization', '/system', '/products', '/global']; + for (var i in temp3) { + if (temp3[i] == location.path()) { + return true; + } + } + } + else { + var active = route === location.path(); + return active; + } + }; + + keyboardManager.bind('ctrl+shift+n', function () { + location.path('/nav/offices'); + }); + keyboardManager.bind('ctrl+shift+i', function () { + location.path('/tasks'); + }); + keyboardManager.bind('ctrl+shift+o', function () { + location.path('/entercollectionsheet'); + }); + keyboardManager.bind('ctrl+shift+c', function () { + location.path('/createclient'); + }); + keyboardManager.bind('ctrl+shift+g', function () { + location.path('/creategroup'); + }); + keyboardManager.bind('ctrl+shift+q', function () { + location.path('/createcenter'); + }); + keyboardManager.bind('ctrl+shift+f', function () { + location.path('/freqposting'); + }); + keyboardManager.bind('ctrl+shift+e', function () { + location.path('/accounts_closure'); + }); + keyboardManager.bind('ctrl+shift+j', function () { + location.path('/journalentry'); + }); + keyboardManager.bind('ctrl+shift+a', function () { + location.path('/accounting'); + }); + keyboardManager.bind('ctrl+shift+r', function () { + location.path('/reports/all'); + }); + keyboardManager.bind('ctrl+s', function () { + document.getElementById('save').click(); + }); + keyboardManager.bind('ctrl+r', function () { + document.getElementById('run').click(); + }); + keyboardManager.bind('ctrl+shift+x', function () { + document.getElementById('cancel').click(); + }); + keyboardManager.bind('ctrl+shift+l', function () { + document.getElementById('logout').click(); + }); + keyboardManager.bind('alt+x', function () { + document.getElementById('search').focus(); + }); + keyboardManager.bind('ctrl+shift+h', function () { + document.getElementById('help').click(); + }); + keyboardManager.bind('ctrl+n', function () { + document.getElementById('next').click(); + }); + keyboardManager.bind('ctrl+p', function () { + document.getElementById('prev').click(); + }); + scope.changeLang = function (lang) { + translate.uses(lang.code); + localStorageService.add('Language', lang); + }; + + sessionManager.restore(function (session) { + scope.currentSession = session; + scope.start(scope.currentSession); + if (session.user != null && session.user.userPermissions) { + $rootScope.setPermissions(session.user.userPermissions); + localStorageService.add('userPermissions', session.user.userPermissions); + } + ; + }); } - translate.uses(scope.optlang.code); - - scope.isActive = function (route) { - if(route == 'clients'){ - var temp = ['/clients','/groups','/centers']; - for(var i in temp){ - if(temp[i]==location.path()){ - return true; - } - } - } - else if(route == 'acc'){ - var temp1 = ['/accounting','/freqposting','/accounting_coa','/journalentry','/accounts_closure','/Searchtransaction','/accounting_rules']; - for(var i in temp1){ - if(temp1[i]==location.path()){ - return true; - } - } - } - else if(route == 'rep'){ - var temp2 = ['/reports/all','/reports/clients','/reports/loans','/reports/funds','/reports/accounting']; - for(var i in temp2){ - if(temp2[i]==location.path()){ - return true; - } - } - } - else if(route == 'admin'){ - var temp3 = ['/users/','/organization','/system','/products','/global']; - for(var i in temp3){ - if(temp3[i]==location.path()){ - return true; - } - } - } - else - { - var active = route === location.path(); - return active; - } - }; - - keyboardManager.bind('ctrl+shift+n', function() { - location.path('/nav/offices'); + }); + mifosX.ng.application.controller('MainController', [ + '$scope', + '$location', + 'SessionManager', + '$translate', + '$rootScope', + 'localStorageService', + 'keyboardManager', '$idle', + mifosX.controllers.MainController + ]).run(function ($log) { + $log.info("MainController initialized"); }); - keyboardManager.bind('ctrl+shift+i', function() { - location.path('/tasks'); - }); - keyboardManager.bind('ctrl+shift+o', function() { - location.path('/entercollectionsheet'); - }); - keyboardManager.bind('ctrl+shift+c', function() { - location.path('/createclient'); - }); - keyboardManager.bind('ctrl+shift+g', function() { - location.path('/creategroup'); - }); - keyboardManager.bind('ctrl+shift+q', function() { - location.path('/createcenter'); - }); - keyboardManager.bind('ctrl+shift+f', function() { - location.path('/freqposting'); - }); - keyboardManager.bind('ctrl+shift+e', function() { - location.path('/accounts_closure'); - }); - keyboardManager.bind('ctrl+shift+j', function() { - location.path('/journalentry'); - }); - keyboardManager.bind('ctrl+shift+a', function() { - location.path('/accounting'); - }); - keyboardManager.bind('ctrl+shift+r', function() { - location.path('/reports/all'); - }); - keyboardManager.bind('ctrl+s', function() { - document.getElementById('save').click(); - }); - keyboardManager.bind('ctrl+r', function() { - document.getElementById('run').click(); - }); - keyboardManager.bind('ctrl+shift+x', function() { - document.getElementById('cancel').click(); - }); - keyboardManager.bind('ctrl+shift+l', function() { - document.getElementById('logout').click(); - }); - keyboardManager.bind('alt+x', function() { - document.getElementById('search').focus(); - }); - keyboardManager.bind('ctrl+shift+h', function() { - document.getElementById('help').click(); - }); - keyboardManager.bind('ctrl+n', function() { - document.getElementById('next').click(); - }); - keyboardManager.bind('ctrl+p', function() { - document.getElementById('prev').click(); - }); - scope.changeLang = function (lang) { - translate.uses(lang.code); - localStorageService.add('Language',lang); - }; - - sessionManager.restore(function(session) { - scope.currentSession = session; - scope.start(scope.currentSession); - if (session.user != null && session.user.userPermissions) { - $rootScope.setPermissions(session.user.userPermissions); - localStorageService.add('userPermissions',session.user.userPermissions); - }; - }); - } - }); - mifosX.ng.application.controller('MainController', [ - '$scope', - '$location', - 'SessionManager', - '$translate', - '$rootScope', - 'localStorageService', - 'keyboardManager', '$idle', - mifosX.controllers.MainController - ]).run(function($log) { - $log.info("MainController initialized"); - }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/NavigationController.js b/app/scripts/controllers/main/NavigationController.js index 7c9a33e7..362de058 100644 --- a/app/scripts/controllers/main/NavigationController.js +++ b/app/scripts/controllers/main/NavigationController.js @@ -1,203 +1,203 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - NavigationController: function(scope, resourceFactory) { +(function (module) { + mifosX.controllers = _.extend(module, { + NavigationController: function (scope, resourceFactory) { - scope.offices = []; - scope.isCollapsed = false; - scope.officerCollapsed = true; - scope.groupCollapsed = true; - scope.centerCollapsed = true; - scope.clientCollapsed = true; - resourceFactory.officeResource.get({officeId: 1} , function(data) { - scope.office = data; - scope.officeName = data.name; - }); - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = data; - }); - - scope.collapseOthers = function(){ - scope.filterText = ''; - scope.isCollapsed = !scope.isCollapsed; - if(scope.isCollapsed==false){ + scope.offices = []; + scope.isCollapsed = false; scope.officerCollapsed = true; scope.groupCollapsed = true; scope.centerCollapsed = true; scope.clientCollapsed = true; - } - }; - scope.collapseOfficerOthers = function(){ - scope.filterText = ''; - scope.officerCollapsed = !scope.officerCollapsed; - if(scope.officerCollapsed==false){ + resourceFactory.officeResource.get({officeId: 1}, function (data) { + scope.office = data; + scope.officeName = data.name; + }); + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + }); + + scope.collapseOthers = function () { + scope.filterText = ''; + scope.isCollapsed = !scope.isCollapsed; + if (scope.isCollapsed == false) { + scope.officerCollapsed = true; + scope.groupCollapsed = true; + scope.centerCollapsed = true; + scope.clientCollapsed = true; + } + }; + scope.collapseOfficerOthers = function () { + scope.filterText = ''; + scope.officerCollapsed = !scope.officerCollapsed; + if (scope.officerCollapsed == false) { + scope.isCollapsed = true; + scope.groupCollapsed = true; + scope.centerCollapsed = true; + scope.clientCollapsed = true; + } + }; + scope.collapseCenterOthers = function () { + scope.filterText = ''; + scope.centerCollapsed = !scope.centerCollapsed; + if (scope.centerCollapsed == false) { + scope.isCollapsed = true; + scope.groupCollapsed = true; + scope.officerCollapsed = true; + scope.clientCollapsed = true; + } + }; + scope.collapseGroupOthers = function () { + scope.filterText = ''; + scope.groupCollapsed = !scope.groupCollapsed; + if (scope.groupCollapsed == false) { + scope.isCollapsed = true; + scope.centerCollapsed = true; + scope.officerCollapsed = true; + scope.clientCollapsed = true; + } + }; + scope.collapseClientOthers = function () { + scope.filterText = ''; + scope.clientCollapsed = !scope.clientCollapsed; + if (scope.clientCollapsed == false) { + scope.isCollapsed = true; + scope.groupCollapsed = true; + scope.officerCollapsed = true; + scope.centerCollapsed = true; + } + }; + + scope.officeSelected = function (officeId, office) { + scope.officeName = office; + scope.selectedOffice = officeId; + scope.filterText = ''; + scope.staffs = ''; + scope.staff = ''; + scope.group = ''; + scope.center = ''; + scope.client = ''; + scope.centers = ''; + scope.clients = ''; + scope.groups = ''; + scope.groupsOrCenters = ''; scope.isCollapsed = true; - scope.groupCollapsed = true; + scope.officerCollapsed = false; scope.centerCollapsed = true; scope.clientCollapsed = true; - } - }; - scope.collapseCenterOthers = function(){ - scope.filterText = ''; - scope.centerCollapsed = !scope.centerCollapsed; - if(scope.centerCollapsed==false){ - scope.isCollapsed = true; scope.groupCollapsed = true; - scope.officerCollapsed = true; - scope.clientCollapsed = true; - } - }; - scope.collapseGroupOthers = function(){ - scope.filterText = ''; - scope.groupCollapsed = !scope.groupCollapsed; - if(scope.groupCollapsed==false){ + scope.loanOfficer = ''; + scope.centerName = ''; + scope.groupName = ''; + scope.clientName = ''; + if (scope.staff == '' && scope.group == '' && scope.center == '' && scope.client == '') { + resourceFactory.officeResource.get({officeId: officeId}, function (data) { + scope.office = data; + }); + resourceFactory.employeeResource.getAllEmployees({'officeId': officeId}, function (data) { + scope.staffs = data; + }); + } + }; + + scope.staffSelected = function (staffId, staffName) { + scope.office = ''; + scope.group = ''; + scope.client = ''; + scope.filterText = ''; + scope.center = ''; + scope.centerName = ''; + scope.groupName = ''; + scope.clientName = ''; scope.isCollapsed = true; - scope.centerCollapsed = true; scope.officerCollapsed = true; + scope.centerCollapsed = false; scope.clientCollapsed = true; - } - }; - scope.collapseClientOthers = function(){ - scope.filterText = ''; - scope.clientCollapsed = !scope.clientCollapsed; - if(scope.clientCollapsed==false){ - scope.isCollapsed = true; scope.groupCollapsed = true; + scope.clients = ''; + scope.groups = ''; + if (scope.office == '' && scope.group == '' && scope.center == '' && scope.client == '') { + resourceFactory.employeeResource.get({staffId: staffId}, function (data) { + scope.staff = data; + }); + scope.loanOfficer = staffName; + scope.selectedStaff = staffId; + resourceFactory.runReportsResource.get({reportSource: 'GroupNamesByStaff', 'R_staffId': staffId, genericResultSet: 'false'}, function (data) { + scope.centers = data; + }); + } + }; + scope.centerSelected = function (centerId, centerName) { + scope.office = ''; + scope.staff = ''; + scope.client = ''; + scope.group = ''; + scope.filterText = ''; + scope.groupName = ''; + scope.clientName = ''; + scope.clients = ''; + scope.centerName = centerName; + scope.isCollapsed = true; scope.officerCollapsed = true; scope.centerCollapsed = true; - } - }; - - scope.officeSelected= function(officeId,office) { - scope.officeName = office; - scope.selectedOffice = officeId; - scope.filterText = ''; - scope.staffs = ''; - scope.staff = ''; - scope.group = ''; - scope.center = ''; - scope.client = ''; - scope.centers=''; - scope.clients= ''; - scope.groups=''; - scope.groupsOrCenters = ''; - scope.isCollapsed = true; - scope.officerCollapsed = false; - scope.centerCollapsed = true; - scope.clientCollapsed = true; - scope.groupCollapsed = true; - scope.loanOfficer = ''; - scope.centerName = ''; - scope.groupName = ''; - scope.clientName = ''; - if(scope.staff=='' && scope.group=='' && scope.center=='' && scope.client==''){ - resourceFactory.officeResource.get({officeId: officeId} , function(data) { - scope.office = data; - }); - resourceFactory.employeeResource.getAllEmployees({'officeId' : officeId}, function(data){ - scope.staffs = data; - }); - } - }; - - scope.staffSelected= function(staffId,staffName) { - scope.office = ''; - scope.group = ''; - scope.client = ''; - scope.filterText = ''; - scope.center = ''; - scope.centerName = ''; - scope.groupName = ''; - scope.clientName = ''; - scope.isCollapsed = true; - scope.officerCollapsed = true; - scope.centerCollapsed = false; - scope.clientCollapsed = true; - scope.groupCollapsed = true; - scope.clients= ''; - scope.groups=''; - if(scope.office=='' && scope.group=='' && scope.center=='' && scope.client==''){ - resourceFactory.employeeResource.get({staffId: staffId} , function(data) { - scope.staff = data; - }); - scope.loanOfficer = staffName; - scope.selectedStaff = staffId; - resourceFactory.runReportsResource.get({reportSource : 'GroupNamesByStaff', 'R_staffId' : staffId, genericResultSet : 'false'}, function(data){ - scope.centers = data; - }); - } - }; - scope.centerSelected= function(centerId,centerName) { - scope.office = ''; - scope.staff = ''; - scope.client = ''; - scope.group=''; - scope.filterText = ''; - scope.groupName = ''; - scope.clientName = ''; - scope.clients= ''; - scope.centerName = centerName; - scope.isCollapsed = true; - scope.officerCollapsed = true; - scope.centerCollapsed = true; - scope.clientCollapsed = true; - scope.groupCollapsed = false; - if(scope.office=='' && scope.group=='' && scope.staff=='' && scope.client==''){ - resourceFactory.centerResource.get({centerId: centerId,associations:'groupMembers'} , function(data) { - scope.groups = data.groupMembers; - scope.center = data; - }); - resourceFactory.centerAccountResource.get({centerId: centerId} , function(data) { - scope.centerAccounts = data; - }); - } - }; - scope.groupSelected= function(groupId,groupName) { - scope.office = ''; - scope.filterText = ''; - scope.staff = ''; - scope.center = ''; - scope.client = ''; - scope.clientName = ''; - scope.groupName = groupName; - scope.isCollapsed = true; - scope.officerCollapsed = true; - scope.centerCollapsed = true; - scope.clientCollapsed = false; - scope.groupCollapsed = true; - if(scope.office=='' && scope.center=='' && scope.staff=='' && scope.client==''){ - resourceFactory.groupResource.get({groupId: groupId,associations:'all'} , function(data) { - scope.group = data; - scope.clients = data.clientMembers; - }); - resourceFactory.groupAccountResource.get({groupId: groupId} , function(data) { - scope.groupAccounts = data; - }); - } - }; - scope.clientSelected= function(clientId,clientName) { - scope.office = ''; - scope.filterText = ''; - scope.staff = ''; - scope.center = ''; - scope.group = ''; - scope.clientName = clientName; - scope.isCollapsed = true; - scope.officerCollapsed = true; - scope.centerCollapsed = true; - scope.clientCollapsed = false; - scope.groupCollapsed = true; - if(scope.office=='' && scope.center=='' && scope.staff=='' && scope.group==''){ - resourceFactory.clientResource.get({clientId: clientId} , function(data) { - scope.client = data; - }); - resourceFactory.clientAccountResource.get({clientId: clientId} , function(data) { - scope.clientAccounts = data; - }); - } - }; - } - }); - mifosX.ng.application.controller('NavigationController', ['$scope', 'ResourceFactory', mifosX.controllers.NavigationController]).run(function($log) { - $log.info("NavigationController initialized"); - }); + scope.clientCollapsed = true; + scope.groupCollapsed = false; + if (scope.office == '' && scope.group == '' && scope.staff == '' && scope.client == '') { + resourceFactory.centerResource.get({centerId: centerId, associations: 'groupMembers'}, function (data) { + scope.groups = data.groupMembers; + scope.center = data; + }); + resourceFactory.centerAccountResource.get({centerId: centerId}, function (data) { + scope.centerAccounts = data; + }); + } + }; + scope.groupSelected = function (groupId, groupName) { + scope.office = ''; + scope.filterText = ''; + scope.staff = ''; + scope.center = ''; + scope.client = ''; + scope.clientName = ''; + scope.groupName = groupName; + scope.isCollapsed = true; + scope.officerCollapsed = true; + scope.centerCollapsed = true; + scope.clientCollapsed = false; + scope.groupCollapsed = true; + if (scope.office == '' && scope.center == '' && scope.staff == '' && scope.client == '') { + resourceFactory.groupResource.get({groupId: groupId, associations: 'all'}, function (data) { + scope.group = data; + scope.clients = data.clientMembers; + }); + resourceFactory.groupAccountResource.get({groupId: groupId}, function (data) { + scope.groupAccounts = data; + }); + } + }; + scope.clientSelected = function (clientId, clientName) { + scope.office = ''; + scope.filterText = ''; + scope.staff = ''; + scope.center = ''; + scope.group = ''; + scope.clientName = clientName; + scope.isCollapsed = true; + scope.officerCollapsed = true; + scope.centerCollapsed = true; + scope.clientCollapsed = false; + scope.groupCollapsed = true; + if (scope.office == '' && scope.center == '' && scope.staff == '' && scope.group == '') { + resourceFactory.clientResource.get({clientId: clientId}, function (data) { + scope.client = data; + }); + resourceFactory.clientAccountResource.get({clientId: clientId}, function (data) { + scope.clientAccounts = data; + }); + } + }; + } + }); + mifosX.ng.application.controller('NavigationController', ['$scope', 'ResourceFactory', mifosX.controllers.NavigationController]).run(function ($log) { + $log.info("NavigationController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/ProfileController.js b/app/scripts/controllers/main/ProfileController.js index dd395044..f42de8e1 100644 --- a/app/scripts/controllers/main/ProfileController.js +++ b/app/scripts/controllers/main/ProfileController.js @@ -1,14 +1,14 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ProfileController: function(scope,localStorageService) { - scope.userDetails = localStorageService.get('userData'); + ProfileController: function (scope, localStorageService) { + scope.userDetails = localStorageService.get('userData'); scope.status = 'Not Authenticated'; - if(scope.userDetails.authenticated==true){ + if (scope.userDetails.authenticated == true) { scope.status = 'Authenticated'; } } }); - mifosX.ng.application.controller('ProfileController', ['$scope', 'localStorageService', mifosX.controllers.ProfileController]).run(function($log) { + mifosX.ng.application.controller('ProfileController', ['$scope', 'localStorageService', mifosX.controllers.ProfileController]).run(function ($log) { $log.info("ProfileController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/SearchController.js b/app/scripts/controllers/main/SearchController.js index 83f05496..97461d35 100644 --- a/app/scripts/controllers/main/SearchController.js +++ b/app/scripts/controllers/main/SearchController.js @@ -1,67 +1,68 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - SearchController: function(scope, routeParams , resourceFactory) { - - scope.searchResults = []; - if(routeParams.query=='undefined'){ - routeParams.query = ''; - } - resourceFactory.globalSearch.search( {query: routeParams.query} , function(data){ - if (data.length > 200) { - scope.searchResults = data.slice(0,201); - scope.showMsg = true; - } else { - scope.searchResults = data; - }; - - if(scope.searchResults.length<=0){ - scope.flag = true; +(function (module) { + mifosX.controllers = _.extend(module, { + SearchController: function (scope, routeParams, resourceFactory) { + + scope.searchResults = []; + if (routeParams.query == 'undefined') { + routeParams.query = ''; } - }); - scope.getClientDetails = function(clientId) { + resourceFactory.globalSearch.search({query: routeParams.query}, function (data) { + if (data.length > 200) { + scope.searchResults = data.slice(0, 201); + scope.showMsg = true; + } else { + scope.searchResults = data; + } + ; - scope.selected = clientId; - resourceFactory.clientResource.get({clientId:clientId} , function(data) { - scope.group = ''; - scope.client = data; - scope.center = ''; + if (scope.searchResults.length <= 0) { + scope.flag = true; + } }); - resourceFactory.clientAccountResource.get({clientId: clientId} , function(data) { - scope.clientAccounts = data; - }); - }; + scope.getClientDetails = function (clientId) { - scope.getGroupDetails = function(groupId) { + scope.selected = clientId; + resourceFactory.clientResource.get({clientId: clientId}, function (data) { + scope.group = ''; + scope.client = data; + scope.center = ''; + }); + resourceFactory.clientAccountResource.get({clientId: clientId}, function (data) { + scope.clientAccounts = data; + }); + }; - scope.selected = groupId; + scope.getGroupDetails = function (groupId) { - resourceFactory.groupResource.get({groupId:groupId} , function(data) { - scope.client = ''; - scope.center = ''; - scope.group = data; - }); - resourceFactory.groupAccountResource.get({groupId: groupId} , function(data) { - scope.groupAccounts = data; - }); - }; + scope.selected = groupId; - scope.getCenterDetails = function(centerId) { + resourceFactory.groupResource.get({groupId: groupId}, function (data) { + scope.client = ''; + scope.center = ''; + scope.group = data; + }); + resourceFactory.groupAccountResource.get({groupId: groupId}, function (data) { + scope.groupAccounts = data; + }); + }; - scope.selected = centerId; + scope.getCenterDetails = function (centerId) { - resourceFactory.centerResource.get({centerId: centerId,associations:'groupMembers'} , function(data) { - scope.client = ''; - scope.group =''; - scope.center = data; - }); - resourceFactory.centerAccountResource.get({centerId: centerId} , function(data) { - scope.centerAccounts = data; - }); - }; + scope.selected = centerId; - } - }); - mifosX.ng.application.controller('SearchController', ['$scope','$routeParams','ResourceFactory', mifosX.controllers.SearchController]).run(function($log) { - $log.info("SearchController initialized"); - }); + resourceFactory.centerResource.get({centerId: centerId, associations: 'groupMembers'}, function (data) { + scope.client = ''; + scope.group = ''; + scope.center = data; + }); + resourceFactory.centerAccountResource.get({centerId: centerId}, function (data) { + scope.centerAccounts = data; + }); + }; + + } + }); + mifosX.ng.application.controller('SearchController', ['$scope', '$routeParams', 'ResourceFactory', mifosX.controllers.SearchController]).run(function ($log) { + $log.info("SearchController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/TaskController.js b/app/scripts/controllers/main/TaskController.js index 32a9a023..b71e47b1 100644 --- a/app/scripts/controllers/main/TaskController.js +++ b/app/scripts/controllers/main/TaskController.js @@ -1,320 +1,326 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - TaskController: function(scope, resourceFactory, route, dateFilter,$modal,location) { - scope.clients = []; - scope.loans = []; - scope.offices = []; - var idToNodeMap = {}; - scope.formData = {}; - scope.loanTemplate = {}; - scope.date = {}; - scope.checkData = []; - scope.isCollapsed = true; - scope.approveData = {}; - scope.restrictDate = new Date(); - - resourceFactory.checkerInboxResource.get({templateResource:'searchtemplate'},function(data){ - scope.checkerTemplate = data; - }); - resourceFactory.checkerInboxResource.search(function(data) { - scope.searchData = data; - }); - scope.viewUser = function(item){ - scope.userTypeahead = true; - scope.formData.user = item.id; - }; - scope.approveChecker = function () { - if(scope.checkData){ - $modal.open({ - templateUrl: 'approvechecker.html', - controller: CheckerApproveCtrl - }); - } - }; - var CheckerApproveCtrl = function ($scope, $modalInstance) { - - $scope.approve = function () { - var totalApprove = 0; - var approveCount = 0; - _.each(scope.checkData,function(value,key) - { - if(value==true) - { - totalApprove++; - } - }); - _.each(scope.checkData,function(value,key) - { - if(value==true) - { - - resourceFactory.checkerInboxResource.save({templateResource: key,command:'approve'},{}, function(data){ - approveCount++; - if(approveCount==totalApprove){ - scope.search(); - } - },function(data){ - approveCount++; - if(approveCount==totalApprove){ - scope.search(); - } - }); - } - }); - scope.checkData = {}; - $modalInstance.close('approve'); - - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - - scope.deleteChecker = function () { - if(scope.checkData){ - $modal.open({ - templateUrl: 'deletechecker.html', - controller: CheckerDeleteCtrl - }); - } - }; - var CheckerDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - var totalDelete = 0; - var deleteCount = 0 - _.each(scope.checkData,function(value,key) - { - if(value==true) - { - totalDelete++; - } - }); - _.each(scope.checkData,function(value,key) - { - if(value==true) - { - - resourceFactory.checkerInboxResource.delete({templateResource: key}, {}, function(data){ - deleteCount++; - if(deleteCount==totalDelete){ - scope.search(); - } - }, function(data){ - deleteCount++; - if(deleteCount==totalDelete){ - scope.search(); - } - }); - } - }); - scope.checkData = {}; - $modalInstance.close('delete'); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - - scope.approveClient = function () { - if(scope.approveData){ - $modal.open({ - templateUrl: 'approveclient.html', - controller: ApproveClientCtrl, - resolve:{ - items: function () { - return scope.approveData; - } - } - }); - } - }; - - $(window).scroll(function() { - if( $(this).scrollTop() > 100 ) { - $('.head-affix').css({ - "position": "fixed", - "top":"50px" - }); - - } else { - $('.head-affix').css({ - position: 'static' - }); - } - }); - - var ApproveClientCtrl = function ($scope, $modalInstance,items) { - $scope.restrictDate = new Date(); - $scope.date = {}; - $scope.date.actDate = new Date(); - $scope.approve = function (act) { - var activate = {} - activate.activationDate = dateFilter(act,scope.df); - activate.dateFormat = scope.df; - activate.locale = scope.optlang.code; - var totalClient = 0; - var clientCount = 0 - _.each(items,function(value,key) - { - if(value==true) - { - totalClient++; - } - }); - _.each(items,function(value,key) - { - if(value==true) - { - - resourceFactory.clientResource.save({clientId: key, command : 'activate'}, activate,function(data){ - clientCount++; - if(clientCount==totalClient){ - route.reload(); - } - }, function(data){ - clientCount++; - if(clientCount==totalClient){ - route.reload(); - } - }); - } - }); - scope.approveData = {}; - $modalInstance.close('delete'); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - - scope.routeTo = function(id){ - location.path('viewcheckerinbox/'+id); - }; - - scope.routeToClient = function(id){ - location.path('viewclient/'+id); - }; - - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = data; - for(var i in data){ - data[i].loans = []; - idToNodeMap[data[i].id] = data[i]; - } - scope.loanResource = function(){ - resourceFactory.loanResource.getAllLoans(function(loanData) { - scope.loans = loanData.pageItems; - for(var i in scope.loans) { - if (scope.loans[i].status.pendingApproval) { - var tempOffice = undefined; - if (scope.loans[i].clientOfficeId) { - tempOffice = idToNodeMap[scope.loans[i].clientOfficeId]; - tempOffice.loans.push(scope.loans[i]); - } else { - if (scope.loans[i].group) { - tempOffice = idToNodeMap[scope.loans[i].group.officeId]; - tempOffice.loans.push(scope.loans[i]); - } - } - } - } - - var finalArray = []; - for(var i in scope.offices){ - if (scope.offices[i].loans.length > 0) { - finalArray.push(scope.offices[i]); - } - } - scope.offices = finalArray; - }); - }; - scope.loanResource(); - }); - - - resourceFactory.clientResource.getAllClients(function(data) { - scope.groupedClients = _.groupBy(data.pageItems, "officeName"); - }); - - scope.search = function(){ +(function (module) { + mifosX.controllers = _.extend(module, { + TaskController: function (scope, resourceFactory, route, dateFilter, $modal, location) { + scope.clients = []; + scope.loans = []; + scope.offices = []; + var idToNodeMap = {}; + scope.formData = {}; + scope.loanTemplate = {}; + scope.date = {}; + scope.checkData = []; scope.isCollapsed = true; - var reqFromDate = dateFilter(scope.date.from,'yyyy-MM-dd'); - var reqToDate = dateFilter(scope.date.to,'yyyy-MM-dd'); - var params = {}; - if (scope.formData.action) { params.actionName = scope.formData.action; }; + scope.approveData = {}; + scope.restrictDate = new Date(); - if (scope.formData.entity) { params.entityName = scope.formData.entity; }; - - if (scope.formData.resourceId) { params.resourceId = scope.formData.resourceId; }; - - if (scope.formData.user) { params.makerId = scope.formData.user; }; - - if (scope.date.from) { params.makerDateTimeFrom = reqFromDate; }; - - if (scope.date.to) { params.makerDateTimeto = reqToDate; }; - resourceFactory.checkerInboxResource.search(params , function(data) { + resourceFactory.checkerInboxResource.get({templateResource: 'searchtemplate'}, function (data) { + scope.checkerTemplate = data; + }); + resourceFactory.checkerInboxResource.search(function (data) { scope.searchData = data; - if(scope.userTypeahead){ - scope.formData.user = ''; - scope.userTypeahead = false; - scope.user = ''; + }); + scope.viewUser = function (item) { + scope.userTypeahead = true; + scope.formData.user = item.id; + }; + scope.approveChecker = function () { + if (scope.checkData) { + $modal.open({ + templateUrl: 'approvechecker.html', + controller: CheckerApproveCtrl + }); + } + }; + var CheckerApproveCtrl = function ($scope, $modalInstance) { + + $scope.approve = function () { + var totalApprove = 0; + var approveCount = 0; + _.each(scope.checkData, function (value, key) { + if (value == true) { + totalApprove++; + } + }); + _.each(scope.checkData, function (value, key) { + if (value == true) { + + resourceFactory.checkerInboxResource.save({templateResource: key, command: 'approve'}, {}, function (data) { + approveCount++; + if (approveCount == totalApprove) { + scope.search(); + } + }, function (data) { + approveCount++; + if (approveCount == totalApprove) { + scope.search(); + } + }); + } + }); + scope.checkData = {}; + $modalInstance.close('approve'); + + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + scope.deleteChecker = function () { + if (scope.checkData) { + $modal.open({ + templateUrl: 'deletechecker.html', + controller: CheckerDeleteCtrl + }); + } + }; + var CheckerDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + var totalDelete = 0; + var deleteCount = 0 + _.each(scope.checkData, function (value, key) { + if (value == true) { + totalDelete++; + } + }); + _.each(scope.checkData, function (value, key) { + if (value == true) { + + resourceFactory.checkerInboxResource.delete({templateResource: key}, {}, function (data) { + deleteCount++; + if (deleteCount == totalDelete) { + scope.search(); + } + }, function (data) { + deleteCount++; + if (deleteCount == totalDelete) { + scope.search(); + } + }); + } + }); + scope.checkData = {}; + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + scope.approveClient = function () { + if (scope.approveData) { + $modal.open({ + templateUrl: 'approveclient.html', + controller: ApproveClientCtrl, + resolve: { + items: function () { + return scope.approveData; + } + } + }); + } + }; + + $(window).scroll(function () { + if ($(this).scrollTop() > 100) { + $('.head-affix').css({ + "position": "fixed", + "top": "50px" + }); + + } else { + $('.head-affix').css({ + position: 'static' + }); } }); - }; - scope.approveLoan = function () { - if(scope.loanTemplate){ - $modal.open({ - templateUrl: 'approveloan.html', - controller: ApproveLoanCtrl - }); - } - }; - - var ApproveLoanCtrl = function ($scope, $modalInstance) { - $scope.approve = function(){ - scope.bulkApproval(); - route.reload(); - $modalInstance.close('approve'); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - } - - scope.bulkApproval = function (){ - scope.formData.approvedOnDate = dateFilter(new Date(),scope.df); - scope.formData.dateFormat = "dd MMMM yyyy"; - scope.formData.locale = "en"; - var selectedAccounts = 0; - var approvedAccounts = 0; - _.each(scope.loanTemplate,function(value,key){ - if(value==true) { - selectedAccounts++; - } - }); - _.each(scope.loanTemplate,function(value,key){ - if(value==true) { - resourceFactory.LoanAccountResource.save({command:'approve', loanId:key}, scope.formData, function(data){ - approvedAccounts++; - scope.loanTemplate[key] = false; - if (selectedAccounts == approvedAccounts) { - scope.loanResource(); - } - }, function(data){ - approvedAccounts++; - scope.loanTemplate[key] = false; - if (selectedAccounts == approvedAccounts) { - scope.loanResource(); + var ApproveClientCtrl = function ($scope, $modalInstance, items) { + $scope.restrictDate = new Date(); + $scope.date = {}; + $scope.date.actDate = new Date(); + $scope.approve = function (act) { + var activate = {} + activate.activationDate = dateFilter(act, scope.df); + activate.dateFormat = scope.df; + activate.locale = scope.optlang.code; + var totalClient = 0; + var clientCount = 0 + _.each(items, function (value, key) { + if (value == true) { + totalClient++; } - }); - } - }); - }; + }); + _.each(items, function (value, key) { + if (value == true) { - } - }); - mifosX.ng.application.controller('TaskController', ['$scope', 'ResourceFactory', '$route', 'dateFilter','$modal','$location', mifosX.controllers.TaskController]).run(function($log) { - $log.info("TaskController initialized"); - }); + resourceFactory.clientResource.save({clientId: key, command: 'activate'}, activate, function (data) { + clientCount++; + if (clientCount == totalClient) { + route.reload(); + } + }, function (data) { + clientCount++; + if (clientCount == totalClient) { + route.reload(); + } + }); + } + }); + scope.approveData = {}; + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + scope.routeTo = function (id) { + location.path('viewcheckerinbox/' + id); + }; + + scope.routeToClient = function (id) { + location.path('viewclient/' + id); + }; + + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + for (var i in data) { + data[i].loans = []; + idToNodeMap[data[i].id] = data[i]; + } + scope.loanResource = function () { + resourceFactory.loanResource.getAllLoans(function (loanData) { + scope.loans = loanData.pageItems; + for (var i in scope.loans) { + if (scope.loans[i].status.pendingApproval) { + var tempOffice = undefined; + if (scope.loans[i].clientOfficeId) { + tempOffice = idToNodeMap[scope.loans[i].clientOfficeId]; + tempOffice.loans.push(scope.loans[i]); + } else { + if (scope.loans[i].group) { + tempOffice = idToNodeMap[scope.loans[i].group.officeId]; + tempOffice.loans.push(scope.loans[i]); + } + } + } + } + + var finalArray = []; + for (var i in scope.offices) { + if (scope.offices[i].loans.length > 0) { + finalArray.push(scope.offices[i]); + } + } + scope.offices = finalArray; + }); + }; + scope.loanResource(); + }); + + + resourceFactory.clientResource.getAllClients(function (data) { + scope.groupedClients = _.groupBy(data.pageItems, "officeName"); + }); + + scope.search = function () { + scope.isCollapsed = true; + var reqFromDate = dateFilter(scope.date.from, 'yyyy-MM-dd'); + var reqToDate = dateFilter(scope.date.to, 'yyyy-MM-dd'); + var params = {}; + if (scope.formData.action) { + params.actionName = scope.formData.action; + } + ; + + if (scope.formData.entity) { + params.entityName = scope.formData.entity; + } + ; + + if (scope.formData.resourceId) { + params.resourceId = scope.formData.resourceId; + } + ; + + if (scope.formData.user) { + params.makerId = scope.formData.user; + } + ; + + if (scope.date.from) { + params.makerDateTimeFrom = reqFromDate; + } + ; + + if (scope.date.to) { + params.makerDateTimeto = reqToDate; + } + ; + resourceFactory.checkerInboxResource.search(params, function (data) { + scope.searchData = data; + if (scope.userTypeahead) { + scope.formData.user = ''; + scope.userTypeahead = false; + scope.user = ''; + } + }); + }; + + scope.approveLoan = function () { + if (scope.loanTemplate) { + $modal.open({ + templateUrl: 'approveloan.html', + controller: ApproveLoanCtrl + }); + } + }; + + var ApproveLoanCtrl = function ($scope, $modalInstance) { + $scope.approve = function () { + scope.bulkApproval(); + route.reload(); + $modalInstance.close('approve'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + } + + scope.bulkApproval = function () { + scope.formData.approvedOnDate = dateFilter(new Date(), scope.df); + scope.formData.dateFormat = "dd MMMM yyyy"; + scope.formData.locale = "en"; + var selectedAccounts = 0; + var approvedAccounts = 0; + _.each(scope.loanTemplate, function (value, key) { + if (value == true) { + selectedAccounts++; + } + }); + _.each(scope.loanTemplate, function (value, key) { + if (value == true) { + resourceFactory.LoanAccountResource.save({command: 'approve', loanId: key}, scope.formData, function (data) { + approvedAccounts++; + scope.loanTemplate[key] = false; + if (selectedAccounts == approvedAccounts) { + scope.loanResource(); + } + }, function (data) { + approvedAccounts++; + scope.loanTemplate[key] = false; + if (selectedAccounts == approvedAccounts) { + scope.loanResource(); + } + }); + } + }); + }; + + } + }); + mifosX.ng.application.controller('TaskController', ['$scope', 'ResourceFactory', '$route', 'dateFilter', '$modal', '$location', mifosX.controllers.TaskController]).run(function ($log) { + $log.info("TaskController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/ViewCheckerinboxController.js b/app/scripts/controllers/main/ViewCheckerinboxController.js index 5beb683f..bc9d8b04 100644 --- a/app/scripts/controllers/main/ViewCheckerinboxController.js +++ b/app/scripts/controllers/main/ViewCheckerinboxController.js @@ -1,14 +1,14 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewCheckerinboxController: function(scope, resourceFactory, routeParams,location,$modal) { + ViewCheckerinboxController: function (scope, resourceFactory, routeParams, location, $modal) { scope.details = {}; - resourceFactory.auditResource.get({templateResource: routeParams.id} , function(data) { + resourceFactory.auditResource.get({templateResource: routeParams.id}, function (data) { scope.details = data; scope.commandAsJson = data.commandAsJson; var obj = JSON.parse(scope.commandAsJson); scope.jsondata = []; - _.each(obj,function(value,key){ - scope.jsondata.push({name:key,property:value}); + _.each(obj, function (value, key) { + scope.jsondata.push({name: key, property: value}); }); }); scope.checkerApprove = function () { @@ -20,8 +20,8 @@ var ApproveCtrl = function ($scope, $modalInstance) { $scope.approve = function () { - resourceFactory.checkerInboxResource.save({templateResource: routeParams.id,command:'approve'},{}, function(data){ - location.path('/checkeractionperformed'); + resourceFactory.checkerInboxResource.save({templateResource: routeParams.id, command: 'approve'}, {}, function (data) { + location.path('/checkeractionperformed'); }); $modalInstance.close('approve'); }; @@ -38,7 +38,7 @@ }; var DeleteCtrl = function ($scope, $modalInstance) { $scope.delete = function () { - resourceFactory.checkerInboxResource.delete({templateResource: routeParams.id}, {}, function(data){ + resourceFactory.checkerInboxResource.delete({templateResource: routeParams.id}, {}, function (data) { location.path('/checkeractionperformed'); }); $modalInstance.close('delete'); @@ -49,7 +49,7 @@ }; } }); - mifosX.ng.application.controller('ViewCheckerinboxController', ['$scope', 'ResourceFactory', '$routeParams','$location','$modal', mifosX.controllers.ViewCheckerinboxController]).run(function($log) { + mifosX.ng.application.controller('ViewCheckerinboxController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewCheckerinboxController]).run(function ($log) { $log.info("ViewCheckerinboxController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/main/ViewMakerCheckerTaskController.js b/app/scripts/controllers/main/ViewMakerCheckerTaskController.js index a554512c..45837144 100644 --- a/app/scripts/controllers/main/ViewMakerCheckerTaskController.js +++ b/app/scripts/controllers/main/ViewMakerCheckerTaskController.js @@ -1,10 +1,10 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewMakerCheckerTaskController: function(scope, routeParams) { + ViewMakerCheckerTaskController: function (scope, routeParams) { scope.commandId = routeParams.commandId; } }); - mifosX.ng.application.controller('ViewMakerCheckerTaskController', ['$scope', '$routeParams', mifosX.controllers.ViewMakerCheckerTaskController]).run(function($log) { + mifosX.ng.application.controller('ViewMakerCheckerTaskController', ['$scope', '$routeParams', mifosX.controllers.ViewMakerCheckerTaskController]).run(function ($log) { $log.info("ViewMakerCheckerTaskController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/AddCodeController.js b/app/scripts/controllers/organization/AddCodeController.js index 2bd4ab37..fbca09cf 100644 --- a/app/scripts/controllers/organization/AddCodeController.js +++ b/app/scripts/controllers/organization/AddCodeController.js @@ -1,20 +1,19 @@ - -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddCodeController: function(scope, resourceFactory, location) { + AddCodeController: function (scope, resourceFactory, location) { scope.codes = []; - resourceFactory.codeResources.getAllCodes(function(data) { + resourceFactory.codeResources.getAllCodes(function (data) { scope.codes = data; }); - scope.submit = function() { - resourceFactory.codeResources.save(this.formData,function(data){ - location.path('/codes'); - }); - }; + scope.submit = function () { + resourceFactory.codeResources.save(this.formData, function (data) { + location.path('/codes'); + }); + }; } }); - mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function($log) { + mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function ($log) { $log.info("AddCodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/AddHolController.js b/app/scripts/controllers/organization/AddHolController.js index c12ba798..7c42d5cc 100644 --- a/app/scripts/controllers/organization/AddHolController.js +++ b/app/scripts/controllers/organization/AddHolController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddHolController: function(scope, resourceFactory, location,dateFilter) { + AddHolController: function (scope, resourceFactory, location, dateFilter) { scope.offices = []; scope.holidays = []; scope.date = {}; @@ -12,50 +12,51 @@ scope.deepCopy = function (obj) { if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); - } - return out; + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; } if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); - } - return out; + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; } return obj; } - resourceFactory.officeResource.getAllOffices(function(data){ + resourceFactory.officeResource.getAllOffices(function (data) { scope.offices = scope.deepCopy(data); - for(var i in data){ - data[i].children = []; - idToNodeMap[data[i].id] = data[i]; + for (var i in data) { + data[i].children = []; + idToNodeMap[data[i].id] = data[i]; } - function sortByParentId(a, b){ - return a.parentId - b.parentId; + function sortByParentId(a, b) { + return a.parentId - b.parentId; } + data.sort(sortByParentId); var root = []; - for(var i = 0; i < data.length; i++) { - var currentObj = data[i]; - if(currentObj.children){ - currentObj.collapsed = "true"; - } - if(typeof currentObj.parentId === "undefined") { - root.push(currentObj); - } else { + for (var i = 0; i < data.length; i++) { + var currentObj = data[i]; + if (currentObj.children) { + currentObj.collapsed = "true"; + } + if (typeof currentObj.parentId === "undefined") { + root.push(currentObj); + } else { parentNode = idToNodeMap[currentObj.parentId]; parentNode.children.push(currentObj); - } + } } scope.treedata = root; }); - scope.holidayApplyToOffice = function (node) { + scope.holidayApplyToOffice = function (node) { if (node.selectedCheckBox === 'true') { recurHolidayApplyToOffice(node); holidayOfficeIdArray = _.uniq(holidayOfficeIdArray); @@ -66,11 +67,11 @@ } }; - function recurHolidayApplyToOffice (node) { + function recurHolidayApplyToOffice(node) { node.selectedCheckBox = 'true'; holidayOfficeIdArray.push(node.id); if (node.children.length > 0) { - for(var i = 0; i < node.children.length; i++) { + for (var i = 0; i < node.children.length; i++) { node.children[i].selectedCheckBox = 'true'; holidayOfficeIdArray.push(node.children[i].id); if (node.children[i].children.length > 0) { @@ -80,7 +81,7 @@ } } - function recurRemoveHolidayAppliedOOffice (node) { + function recurRemoveHolidayAppliedOOffice(node) { holidayOfficeIdArray = _.without(holidayOfficeIdArray, node.id); if (node.children.length > 0) { for (var i = 0; i < node.children.length; i++) { @@ -94,10 +95,10 @@ } scope.minDat = new Date(); - scope.submit = function() { - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var reqThirdDate = dateFilter(scope.date.third,scope.df); + scope.submit = function () { + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var reqThirdDate = dateFilter(scope.date.third, scope.df); var newholiday = new Object(); newholiday.locale = scope.optlang.code; newholiday.dateFormat = scope.df; @@ -112,13 +113,13 @@ temp.officeId = holidayOfficeIdArray[i]; newholiday.offices.push(temp); } - resourceFactory.holValueResource.save(newholiday,function(data){ + resourceFactory.holValueResource.save(newholiday, function (data) { location.path('/holidays'); }); }; } }); - mifosX.ng.application.controller('AddHolController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.AddHolController]).run(function($log) { + mifosX.ng.application.controller('AddHolController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.AddHolController]).run(function ($log) { $log.info("AddHolController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/BulkLoanReassignmentController.js b/app/scripts/controllers/organization/BulkLoanReassignmentController.js index 491c7114..ad4e7726 100644 --- a/app/scripts/controllers/organization/BulkLoanReassignmentController.js +++ b/app/scripts/controllers/organization/BulkLoanReassignmentController.js @@ -1,45 +1,44 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - BulkLoanReassignmentController: function(scope, resourceFactory,route,dateFilter) { + BulkLoanReassignmentController: function (scope, resourceFactory, route, dateFilter) { scope.offices = []; scope.accounts = {}; scope.officeIdTemp = {}; scope.first = {}; scope.toOfficers = []; scope.first.date = new Date(); - resourceFactory.officeResource.getAllOffices(function(data) { + resourceFactory.officeResource.getAllOffices(function (data) { scope.offices = data; }); - scope.getOfficers = function(){ + scope.getOfficers = function () { scope.officerChoice = true; - resourceFactory.loanReassignmentResource.get({templateSource:'template',officeId:scope.officeIdTemp},function(data) { + resourceFactory.loanReassignmentResource.get({templateSource: 'template', officeId: scope.officeIdTemp}, function (data) { scope.officers = data.loanOfficerOptions; }); }; - scope.getOfficerClients = function(){ + scope.getOfficerClients = function () { var toOfficers = angular.copy(scope.officers); - for(var i in toOfficers){ - if(toOfficers[i].id==this.formData.fromLoanOfficerId){ + for (var i in toOfficers) { + if (toOfficers[i].id == this.formData.fromLoanOfficerId) { var index = i; } } - toOfficers.splice(index,1); + toOfficers.splice(index, 1); scope.toOfficers = toOfficers; - resourceFactory.loanReassignmentResource.get({templateSource:'template',officeId:scope.officeIdTemp,fromLoanOfficerId:scope.formData.fromLoanOfficerId},function(data) { + resourceFactory.loanReassignmentResource.get({templateSource: 'template', officeId: scope.officeIdTemp, fromLoanOfficerId: scope.formData.fromLoanOfficerId}, function (data) { scope.clients = data.accountSummaryCollection.clients; scope.groups = data.accountSummaryCollection.groups; }); }; - scope.submit = function() { - var reqDate = dateFilter(scope.first.date,scope.df); + scope.submit = function () { + var reqDate = dateFilter(scope.first.date, scope.df); var loans = []; - _.each(scope.accounts,function(value,key){ - if(value==true) - { + _.each(scope.accounts, function (value, key) { + if (value == true) { loans.push(key) } }); @@ -47,14 +46,14 @@ this.formData.dateFormat = "dd MMMM yyyy"; this.formData.locale = "en"; this.formData.loans = loans; - resourceFactory.loanReassignmentResource.save(this.formData,function(data) { + resourceFactory.loanReassignmentResource.save(this.formData, function (data) { route.reload(); }); }; } }); - mifosX.ng.application.controller('BulkLoanReassignmentController', ['$scope', 'ResourceFactory', '$route','dateFilter', mifosX.controllers.BulkLoanReassignmentController]).run(function($log) { + mifosX.ng.application.controller('BulkLoanReassignmentController', ['$scope', 'ResourceFactory', '$route', 'dateFilter', mifosX.controllers.BulkLoanReassignmentController]).run(function ($log) { $log.info("BulkLoanReassignmentController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/CreateEmployeeController.js b/app/scripts/controllers/organization/CreateEmployeeController.js index 40c7eedc..eda96412 100644 --- a/app/scripts/controllers/organization/CreateEmployeeController.js +++ b/app/scripts/controllers/organization/CreateEmployeeController.js @@ -1,23 +1,23 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateEmployeeController: function(scope, resourceFactory, location) { - scope.offices = []; - resourceFactory.officeResource.getAllOffices(function(data) { - scope.offices = data; - scope.formData = { - isLoanOfficer: true, - officeId : scope.offices[0].id, +(function (module) { + mifosX.controllers = _.extend(module, { + CreateEmployeeController: function (scope, resourceFactory, location) { + scope.offices = []; + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + scope.formData = { + isLoanOfficer: true, + officeId: scope.offices[0].id, + }; + }); + + scope.submit = function () { + resourceFactory.employeeResource.save(this.formData, function (data) { + location.path('/viewemployee/' + data.resourceId); + }); }; - }); - - scope.submit = function() { - resourceFactory.employeeResource.save(this.formData,function(data){ - location.path('/viewemployee/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateEmployeeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateEmployeeController]).run(function($log) { - $log.info("CreateEmployeeController initialized"); - }); + } + }); + mifosX.ng.application.controller('CreateEmployeeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateEmployeeController]).run(function ($log) { + $log.info("CreateEmployeeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/CreateOfficeController.js b/app/scripts/controllers/organization/CreateOfficeController.js index bd22bb19..d1c78710 100644 --- a/app/scripts/controllers/organization/CreateOfficeController.js +++ b/app/scripts/controllers/organization/CreateOfficeController.js @@ -1,29 +1,29 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateOfficeController: function(scope, resourceFactory, location,dateFilter) { - scope.offices = []; - scope.first = {}; - scope.first.date = new Date(); - scope.restrictDate = new Date(); - resourceFactory.officeResource.getAllOffices(function(data) { - scope.offices = data; - scope.formData = { - parentId : scope.offices[0].id - } - }); - - scope.submit = function() { - this.formData.locale = scope.optlang.code; - var reqDate = dateFilter(scope.first.date,scope.df); - this.formData.dateFormat = scope.df; - this.formData.openingDate = reqDate; - resourceFactory.officeResource.save(this.formData,function(data){ - location.path('/viewoffice/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateOfficeController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.CreateOfficeController]).run(function($log) { - $log.info("CreateOfficeController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + CreateOfficeController: function (scope, resourceFactory, location, dateFilter) { + scope.offices = []; + scope.first = {}; + scope.first.date = new Date(); + scope.restrictDate = new Date(); + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = data; + scope.formData = { + parentId: scope.offices[0].id + } + }); + + scope.submit = function () { + this.formData.locale = scope.optlang.code; + var reqDate = dateFilter(scope.first.date, scope.df); + this.formData.dateFormat = scope.df; + this.formData.openingDate = reqDate; + resourceFactory.officeResource.save(this.formData, function (data) { + location.path('/viewoffice/' + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('CreateOfficeController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateOfficeController]).run(function ($log) { + $log.info("CreateOfficeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/CreateRoleController.js b/app/scripts/controllers/organization/CreateRoleController.js index ba7d7e54..f3adcaa0 100644 --- a/app/scripts/controllers/organization/CreateRoleController.js +++ b/app/scripts/controllers/organization/CreateRoleController.js @@ -1,15 +1,15 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateRoleController: function(scope, location, resourceFactory) { - scope.formData = {}; - scope.submit = function() { - resourceFactory.roleResource.save(this.formData, function(data) { - location.path("/admin/viewrole/"+data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateRoleController', ['$scope', '$location', 'ResourceFactory', mifosX.controllers.CreateRoleController]).run(function($log) { - $log.info("CreateRoleController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + CreateRoleController: function (scope, location, resourceFactory) { + scope.formData = {}; + scope.submit = function () { + resourceFactory.roleResource.save(this.formData, function (data) { + location.path("/admin/viewrole/" + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('CreateRoleController', ['$scope', '$location', 'ResourceFactory', mifosX.controllers.CreateRoleController]).run(function ($log) { + $log.info("CreateRoleController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/organization/CreateUserController.js b/app/scripts/controllers/organization/CreateUserController.js index f70a8de2..e8f5be7a 100644 --- a/app/scripts/controllers/organization/CreateUserController.js +++ b/app/scripts/controllers/organization/CreateUserController.js @@ -1,25 +1,25 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateUserController: function(scope, resourceFactory, location) { - scope.offices = []; - scope.availableRoles = []; - resourceFactory.userTemplateResource.get(function(data) { - scope.offices = data.allowedOffices; - scope.availableRoles = data.availableRoles; - scope.formData = { - sendPasswordToEmail: true, - officeId : scope.offices[0].id, +(function (module) { + mifosX.controllers = _.extend(module, { + CreateUserController: function (scope, resourceFactory, location) { + scope.offices = []; + scope.availableRoles = []; + resourceFactory.userTemplateResource.get(function (data) { + scope.offices = data.allowedOffices; + scope.availableRoles = data.availableRoles; + scope.formData = { + sendPasswordToEmail: true, + officeId: scope.offices[0].id, + }; + }); + + scope.submit = function () { + resourceFactory.userListResource.save(this.formData, function (data) { + location.path('/viewuser/' + data.resourceId); + }); }; - }); - - scope.submit = function() { - resourceFactory.userListResource.save(this.formData,function(data){ - location.path('/viewuser/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateUserController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateUserController]).run(function($log) { - $log.info("CreateUserController initialized"); - }); + } + }); + mifosX.ng.application.controller('CreateUserController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateUserController]).run(function ($log) { + $log.info("CreateUserController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/CurrencyConfigController.js b/app/scripts/controllers/organization/CurrencyConfigController.js index 16b89ab3..ae6295ad 100644 --- a/app/scripts/controllers/organization/CurrencyConfigController.js +++ b/app/scripts/controllers/organization/CurrencyConfigController.js @@ -1,60 +1,60 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CurrencyConfigController: function(scope, resourceFactory, route) { - - scope.selectedCurrOptions = []; - scope.allCurrOptions = []; - scope.hideview = false; - scope.selected = undefined; + CurrencyConfigController: function (scope, resourceFactory, route) { - resourceFactory.currencyConfigResource.get(function(data){ - scope.selectedCurrOptions = data.selectedCurrencyOptions; - scope.allCurrOptions = data.currencyOptions; + scope.selectedCurrOptions = []; + scope.allCurrOptions = []; + scope.hideview = false; + scope.selected = undefined; - }); + resourceFactory.currencyConfigResource.get(function (data) { + scope.selectedCurrOptions = data.selectedCurrencyOptions; + scope.allCurrOptions = data.currencyOptions; - scope.deleteCur = function (code){ - for(var i=0; i -1) { + string = string.replace("portfolio_", ""); + } + if (string.indexOf('transaction_') > -1) { + var temp = string.split("_"); + string = temp[1] + " " + temp[0].charAt(0).toUpperCase() + temp[0].slice(1) + "s"; + } + string = string.charAt(0).toUpperCase() + string.slice(1); + return string; + }; + }); + + scope.cancel = function () { + scope.isDisabled = true; + }; + + scope.editMCTasks = function () { + scope.isDisabled = false; + }; + + scope.submit = function () { + var permissionData = {}; + permissionData.permissions = this.formData; + resourceFactory.permissionResource.update({makerCheckerable: true}, permissionData, function (data) { + route.reload(); + scope.isDisabled = true; + }); + }; } - scope.showPermissions = function (grouping) { - if (scope.previousGrouping) { - tempPermissionUIData[scope.previousGrouping] = scope.permissions; - } - scope.permissions = tempPermissionUIData[grouping]; - scope.previousGrouping = grouping; - }; - //by default show portfolio setting - scope.showPermissions('portfolio'); - - scope.permissionName = function (name) { - name = name || ""; - //replace '_' with ' ' - name = name.replace(/_/g, " "); - //for reorts replace read with view - if (scope.previousGrouping == 'report') {name = name.replace(/READ/g, "View");} - return name; - }; - - scope.formatName = function (string) { - string = string || ""; - if (string.indexOf('portfolio_') > -1) { - string = string.replace("portfolio_", ""); - } - if (string.indexOf('transaction_') > -1) { - var temp = string.split("_"); - string = temp[1]+" "+temp[0].charAt(0).toUpperCase() + temp[0].slice(1)+"s"; - } - string = string.charAt(0).toUpperCase() + string.slice(1); - return string; - }; - }); - - scope.cancel = function () { - scope.isDisabled = true; - }; - - scope.editMCTasks = function () { - scope.isDisabled = false; - }; - - scope.submit = function() { - var permissionData = {}; - permissionData.permissions = this.formData; - resourceFactory.permissionResource.update({makerCheckerable:true},permissionData,function(data){ - route.reload(); - scope.isDisabled = true; - }); - }; - } - }); - mifosX.ng.application.controller('MakerCheckerController', ['$scope', '$route', 'ResourceFactory', mifosX.controllers.MakerCheckerController]).run(function($log) { - $log.info("MakerCheckerController initialized"); - }); + }); + mifosX.ng.application.controller('MakerCheckerController', ['$scope', '$route', 'ResourceFactory', mifosX.controllers.MakerCheckerController]).run(function ($log) { + $log.info("MakerCheckerController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ManageFundsController.js b/app/scripts/controllers/organization/ManageFundsController.js index dd591580..a49b54f0 100644 --- a/app/scripts/controllers/organization/ManageFundsController.js +++ b/app/scripts/controllers/organization/ManageFundsController.js @@ -1,36 +1,36 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ManageFundsController: function(scope, location, resourceFactory) { - scope.funderror = false; - scope.formData = []; - resourceFactory.fundsResource.getAllFunds(function(data){ - scope.funds = data; - }); - scope.editFund = function(fund,name,id){ - fund.edit = !fund.edit; - scope.formData[id]=name; - }; - scope.saveFund = function(id){ - resourceFactory.fundsResource.update({fundId:id} ,{'name': this.formData[id]}, function(data){ - location.path('/managefunds'); + ManageFundsController: function (scope, location, resourceFactory) { + scope.funderror = false; + scope.formData = []; + resourceFactory.fundsResource.getAllFunds(function (data) { + scope.funds = data; }); - }; - scope.addFund = function (){ - if(scope.newfund != undefined ) { - scope.funderror = false; - resourceFactory.fundsResource.save({'name':scope.newfund} , function(data){ - location.path('/managefunds'); - }); - } else { - scope.funderror = true; - } - - scope.newfund = undefined; - }; + scope.editFund = function (fund, name, id) { + fund.edit = !fund.edit; + scope.formData[id] = name; + }; + scope.saveFund = function (id) { + resourceFactory.fundsResource.update({fundId: id}, {'name': this.formData[id]}, function (data) { + location.path('/managefunds'); + }); + }; + scope.addFund = function () { + if (scope.newfund != undefined) { + scope.funderror = false; + resourceFactory.fundsResource.save({'name': scope.newfund}, function (data) { + location.path('/managefunds'); + }); + } else { + scope.funderror = true; + } - } - }); - mifosX.ng.application.controller('ManageFundsController', ['$scope', '$location', 'ResourceFactory', mifosX.controllers.ManageFundsController]).run(function($log) { - $log.info("ManageFundsController initialized"); - }); + scope.newfund = undefined; + }; + + } + }); + mifosX.ng.application.controller('ManageFundsController', ['$scope', '$location', 'ResourceFactory', mifosX.controllers.ManageFundsController]).run(function ($log) { + $log.info("ManageFundsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/OfficesController.js b/app/scripts/controllers/organization/OfficesController.js index 5135aa29..a12accf3 100644 --- a/app/scripts/controllers/organization/OfficesController.js +++ b/app/scripts/controllers/organization/OfficesController.js @@ -1,61 +1,62 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - OfficesController: function(scope, resourceFactory,location) { +(function (module) { + mifosX.controllers = _.extend(module, { + OfficesController: function (scope, resourceFactory, location) { - scope.offices = []; - scope.isTreeView = false; - var idToNodeMap = {}; - scope.routeTo = function(id){ - location.path('/viewoffice/' + id); - }; - scope.deepCopy = function (obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); - } - return out; - } - return obj; - } + scope.offices = []; + scope.isTreeView = false; + var idToNodeMap = {}; + scope.routeTo = function (id) { + location.path('/viewoffice/' + id); + }; + scope.deepCopy = function (obj) { + if (Object.prototype.toString.call(obj) === '[object Array]') { + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; + } + if (typeof obj === 'object') { + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; + } + return obj; + } - resourceFactory.officeResource.getAllOffices(function(data){ - scope.offices = scope.deepCopy(data); - for(var i in data){ - data[i].children = []; - idToNodeMap[data[i].id] = data[i]; - } - function sortByParentId(a, b){ - return a.parentId - b.parentId; - } - data.sort(sortByParentId); + resourceFactory.officeResource.getAllOffices(function (data) { + scope.offices = scope.deepCopy(data); + for (var i in data) { + data[i].children = []; + idToNodeMap[data[i].id] = data[i]; + } + function sortByParentId(a, b) { + return a.parentId - b.parentId; + } - var root = []; - for(var i = 0; i < data.length; i++) { - var currentObj = data[i]; - if(currentObj.children){ - currentObj.collapsed = "true"; - } - if(typeof currentObj.parentId === "undefined") { - root.push(currentObj); - } else { - parentNode = idToNodeMap[currentObj.parentId]; - parentNode.children.push(currentObj); - } - } - scope.treedata = root; - }); + data.sort(sortByParentId); - } - }); - mifosX.ng.application.controller('OfficesController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.OfficesController]).run(function($log) { - $log.info("OfficesController initialized"); - }); + var root = []; + for (var i = 0; i < data.length; i++) { + var currentObj = data[i]; + if (currentObj.children) { + currentObj.collapsed = "true"; + } + if (typeof currentObj.parentId === "undefined") { + root.push(currentObj); + } else { + parentNode = idToNodeMap[currentObj.parentId]; + parentNode.children.push(currentObj); + } + } + scope.treedata = root; + }); + + } + }); + mifosX.ng.application.controller('OfficesController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.OfficesController]).run(function ($log) { + $log.info("OfficesController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/RoleController.js b/app/scripts/controllers/organization/RoleController.js index 8a37db80..293d8a45 100644 --- a/app/scripts/controllers/organization/RoleController.js +++ b/app/scripts/controllers/organization/RoleController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - RoleController: function(scope, resourceFactory,location) { - scope.roles = []; - scope.routeTo = function(id){ - location.path('/admin/viewrole/' + id); - }; - resourceFactory.roleResource.getAllRoles({}, function(data) { - scope.roles = data; - }); - } - }); - mifosX.ng.application.controller('RoleController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.RoleController]).run(function($log) { - $log.info("RoleController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + RoleController: function (scope, resourceFactory, location) { + scope.roles = []; + scope.routeTo = function (id) { + location.path('/admin/viewrole/' + id); + }; + resourceFactory.roleResource.getAllRoles({}, function (data) { + scope.roles = data; + }); + } + }); + mifosX.ng.application.controller('RoleController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.RoleController]).run(function ($log) { + $log.info("RoleController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewAccRuleController.js b/app/scripts/controllers/organization/ViewAccRuleController.js index 65535942..2d5640d3 100644 --- a/app/scripts/controllers/organization/ViewAccRuleController.js +++ b/app/scripts/controllers/organization/ViewAccRuleController.js @@ -1,21 +1,21 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewAccRuleController: function(scope, resourceFactory, routeParams, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewAccRuleController: function (scope, resourceFactory, routeParams, location) { - resourceFactory.accountingRulesResource.getById({accountingRuleId:routeParams.id}, function(data){ - scope.rule = data; + resourceFactory.accountingRulesResource.getById({accountingRuleId: routeParams.id}, function (data) { + scope.rule = data; + }); + + scope.deleteRule = function () { + resourceFactory.accountingRulesResource.delete({accountingRuleId: routeParams.id}, {}, function (data) { + location.path('/accounting_rules'); + }); + }; + + + } + }); + mifosX.ng.application.controller('ViewAccRuleController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.ViewAccRuleController]).run(function ($log) { + $log.info("ViewAccRuleController initialized"); }); - - scope.deleteRule = function (){ - resourceFactory.accountingRulesResource.delete({accountingRuleId:routeParams.id}, {}, function(data){ - location.path('/accounting_rules'); - }); - }; - - - } - }); - mifosX.ng.application.controller('ViewAccRuleController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.ViewAccRuleController]).run(function($log) { - $log.info("ViewAccRuleController initialized"); - }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/organization/ViewCodeController.js b/app/scripts/controllers/organization/ViewCodeController.js index 548bdc1a..f4151ceb 100644 --- a/app/scripts/controllers/organization/ViewCodeController.js +++ b/app/scripts/controllers/organization/ViewCodeController.js @@ -1,22 +1,22 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewCodeController: function(scope, routeParams , resourceFactory, location ) { - scope.codevalues = []; - resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) { + ViewCodeController: function (scope, routeParams, resourceFactory, location) { + scope.codevalues = []; + resourceFactory.codeResources.get({codeId: routeParams.id}, function (data) { scope.code = data; }); - resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) { + resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id}, function (data) { scope.codevalues = data; }); - scope.delcode = function(){ - resourceFactory.codeResources.remove({codeId: routeParams.id},this.code,function(data){ + scope.delcode = function () { + resourceFactory.codeResources.remove({codeId: routeParams.id}, this.code, function (data) { location.path('/codes'); }); } } }); - mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams','ResourceFactory','$location', mifosX.controllers.ViewCodeController]).run(function($log) { + mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.ViewCodeController]).run(function ($log) { $log.info("ViewCodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewDataTableController.js b/app/scripts/controllers/organization/ViewDataTableController.js index 15bb2910..518d92df 100644 --- a/app/scripts/controllers/organization/ViewDataTableController.js +++ b/app/scripts/controllers/organization/ViewDataTableController.js @@ -1,26 +1,26 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewDataTableController: function(scope, routeParams , resourceFactory ) { - resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName} , function(data) { - - var temp=[]; - var colName = data.columnHeaderData[0].columnName; - if(colName == 'id' || colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { - data.columnHeaderData.splice(0,1); - } +(function (module) { + mifosX.controllers = _.extend(module, { + ViewDataTableController: function (scope, routeParams, resourceFactory) { + resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName}, function (data) { - for(var i=0; i< data.columnHeaderData.length; i++) { - if(data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { - temp = data.columnHeaderData[i].columnName.split("_cd_"); - data.columnHeaderData[i].columnName = temp[1]; - data.columnHeaderData[i].code = temp[0]; - } - } - scope.datatable = data; - }); - } - }); - mifosX.ng.application.controller('ViewDataTableController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewDataTableController]).run(function($log) { - $log.info("ViewDataTableController initialized"); - }); + var temp = []; + var colName = data.columnHeaderData[0].columnName; + if (colName == 'id' || colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { + data.columnHeaderData.splice(0, 1); + } + + for (var i = 0; i < data.columnHeaderData.length; i++) { + if (data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { + temp = data.columnHeaderData[i].columnName.split("_cd_"); + data.columnHeaderData[i].columnName = temp[1]; + data.columnHeaderData[i].code = temp[0]; + } + } + scope.datatable = data; + }); + } + }); + mifosX.ng.application.controller('ViewDataTableController', ['$scope', '$routeParams', 'ResourceFactory', mifosX.controllers.ViewDataTableController]).run(function ($log) { + $log.info("ViewDataTableController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewEmployeeController.js b/app/scripts/controllers/organization/ViewEmployeeController.js index 56a45999..51ab7b80 100644 --- a/app/scripts/controllers/organization/ViewEmployeeController.js +++ b/app/scripts/controllers/organization/ViewEmployeeController.js @@ -1,13 +1,13 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewEmployeeController: function(scope, routeParams , resourceFactory ) { - scope.employee = []; - resourceFactory.employeeResource.get({staffId: routeParams.id} , function(data) { - scope.employee = data; - }); - } - }); - mifosX.ng.application.controller('ViewEmployeeController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewEmployeeController]).run(function($log) { - $log.info("ViewEmployeeController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewEmployeeController: function (scope, routeParams, resourceFactory) { + scope.employee = []; + resourceFactory.employeeResource.get({staffId: routeParams.id}, function (data) { + scope.employee = data; + }); + } + }); + mifosX.ng.application.controller('ViewEmployeeController', ['$scope', '$routeParams', 'ResourceFactory', mifosX.controllers.ViewEmployeeController]).run(function ($log) { + $log.info("ViewEmployeeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewHolController.js b/app/scripts/controllers/organization/ViewHolController.js index 161060cc..5dc2adee 100644 --- a/app/scripts/controllers/organization/ViewHolController.js +++ b/app/scripts/controllers/organization/ViewHolController.js @@ -1,8 +1,8 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewHolController: function(scope, routeParams, resourceFactory, $modal, location, route) { + ViewHolController: function (scope, routeParams, resourceFactory, $modal, location, route) { - resourceFactory.holValueResource.getholvalues({officeId:1,holId: routeParams.id} , function(data) { + resourceFactory.holValueResource.getholvalues({officeId: 1, holId: routeParams.id}, function (data) { scope.holiday = data; if (data.status.value === "Pending for activation") { scope.holidayStatusPending = true; @@ -23,7 +23,7 @@ var activateHolidayCtrl = function ($scope, $modalInstance) { $scope.activate = function () { - resourceFactory.holValueResource.save({holId: routeParams.id, command: 'Activate'}, {}, function(data){ + resourceFactory.holValueResource.save({holId: routeParams.id, command: 'Activate'}, {}, function (data) { route.reload(); }); $modalInstance.close('activate'); @@ -42,7 +42,7 @@ var deleteHolidayCtrl = function ($scope, $modalInstance) { $scope.activate = function () { - resourceFactory.holValueResource.delete({holId: routeParams.id}, {}, function(data){ + resourceFactory.holValueResource.delete({holId: routeParams.id}, {}, function (data) { location.path('holidays'); }); $modalInstance.close('activate'); @@ -54,7 +54,7 @@ } }); - mifosX.ng.application.controller('ViewHolController', ['$scope', '$routeParams', 'ResourceFactory', '$modal', '$location', '$route', mifosX.controllers.ViewHolController]).run(function($log) { + mifosX.ng.application.controller('ViewHolController', ['$scope', '$routeParams', 'ResourceFactory', '$modal', '$location', '$route', mifosX.controllers.ViewHolController]).run(function ($log) { $log.info("ViewHolController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewOfficeController.js b/app/scripts/controllers/organization/ViewOfficeController.js index 2b62ca77..8753f0b7 100644 --- a/app/scripts/controllers/organization/ViewOfficeController.js +++ b/app/scripts/controllers/organization/ViewOfficeController.js @@ -1,13 +1,13 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewOfficeController: function(scope, routeParams , resourceFactory ) { - scope.charges = []; - resourceFactory.officeResource.get({officeId: routeParams.id} , function(data) { - scope.office = data; - }); - } - }); - mifosX.ng.application.controller('ViewOfficeController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewOfficeController]).run(function($log) { - $log.info("ViewOfficeController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewOfficeController: function (scope, routeParams, resourceFactory) { + scope.charges = []; + resourceFactory.officeResource.get({officeId: routeParams.id}, function (data) { + scope.office = data; + }); + } + }); + mifosX.ng.application.controller('ViewOfficeController', ['$scope', '$routeParams', 'ResourceFactory', mifosX.controllers.ViewOfficeController]).run(function ($log) { + $log.info("ViewOfficeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/organization/ViewRoleController.js b/app/scripts/controllers/organization/ViewRoleController.js index 5c83d431..05fb71ce 100644 --- a/app/scripts/controllers/organization/ViewRoleController.js +++ b/app/scripts/controllers/organization/ViewRoleController.js @@ -1,79 +1,80 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewRoleController: function(scope, routeParams, resourceFactory, route) { - scope.permissions = []; - scope.groupings = []; - scope.formData = {}; - var tempPermissionUIData = []; - resourceFactory.rolePermissionResource.get({roleId:routeParams.id}, function(data) { - scope.role = data; - scope.isDisabled=true; +(function (module) { + mifosX.controllers = _.extend(module, { + ViewRoleController: function (scope, routeParams, resourceFactory, route) { + scope.permissions = []; + scope.groupings = []; + scope.formData = {}; + var tempPermissionUIData = []; + resourceFactory.rolePermissionResource.get({roleId: routeParams.id}, function (data) { + scope.role = data; + scope.isDisabled = true; - var currentGrouping = ""; - for (var i in data.permissionUsageData) { - if (data.permissionUsageData[i].grouping != currentGrouping) - { - currentGrouping = data.permissionUsageData[i].grouping; - scope.groupings.push(currentGrouping); - var newEntry = { permissions: [] }; - tempPermissionUIData[currentGrouping] = newEntry; - } - var temp = { code:data.permissionUsageData[i].code}; - scope.formData[data.permissionUsageData[i].code] = data.permissionUsageData[i].selected; - tempPermissionUIData[currentGrouping].permissions.push(temp); + var currentGrouping = ""; + for (var i in data.permissionUsageData) { + if (data.permissionUsageData[i].grouping != currentGrouping) { + currentGrouping = data.permissionUsageData[i].grouping; + scope.groupings.push(currentGrouping); + var newEntry = { permissions: [] }; + tempPermissionUIData[currentGrouping] = newEntry; + } + var temp = { code: data.permissionUsageData[i].code}; + scope.formData[data.permissionUsageData[i].code] = data.permissionUsageData[i].selected; + tempPermissionUIData[currentGrouping].permissions.push(temp); + } + + scope.editRoles = function () { + scope.isDisabled = false; + }; + + scope.cancel = function () { + scope.isDisabled = true; + }; + + scope.submit = function () { + var permissionData = {}; + permissionData.permissions = this.formData; + resourceFactory.rolePermissionResource.update({roleId: routeParams.id}, permissionData, function (data) { + route.reload(); + scope.isDisabled = true; + }); + }; + + scope.showPermissions = function (grouping) { + if (scope.previousGrouping) { + tempPermissionUIData[scope.previousGrouping] = scope.permissions; + } + scope.permissions = tempPermissionUIData[grouping]; + scope.previousGrouping = grouping; + }; + //by default show special permissions + scope.showPermissions('special'); + + scope.permissionName = function (name) { + name = name || ""; + //replace '_' with ' ' + name = name.replace(/_/g, " "); + //for reorts replace read with view + if (scope.previousGrouping == 'report') { + name = name.replace(/READ/g, "View"); + } + return name; + }; + + scope.formatName = function (string) { + if (string.indexOf('portfolio_') > -1) { + string = string.replace("portfolio_", ""); + } + if (string.indexOf('transaction_') > -1) { + var temp = string.split("_"); + string = temp[1] + " " + temp[0].charAt(0).toUpperCase() + temp[0].slice(1) + "s"; + } + string = string.charAt(0).toUpperCase() + string.slice(1); + return string; + }; + }); } - - scope.editRoles = function () { - scope.isDisabled = false; - }; - - scope.cancel = function () { - scope.isDisabled = true; - }; - - scope.submit = function() { - var permissionData = {}; - permissionData.permissions = this.formData; - resourceFactory.rolePermissionResource.update({roleId:routeParams.id},permissionData,function(data){ - route.reload(); - scope.isDisabled = true; - }); - }; - - scope.showPermissions = function (grouping) { - if (scope.previousGrouping) { - tempPermissionUIData[scope.previousGrouping] = scope.permissions; - } - scope.permissions = tempPermissionUIData[grouping]; - scope.previousGrouping = grouping; - }; - //by default show special permissions - scope.showPermissions('special'); - - scope.permissionName = function (name) { - name = name || ""; - //replace '_' with ' ' - name = name.replace(/_/g, " "); - //for reorts replace read with view - if (scope.previousGrouping == 'report') {name = name.replace(/READ/g, "View");} - return name; - }; - - scope.formatName = function (string) { - if (string.indexOf('portfolio_') > -1) { - string = string.replace("portfolio_", ""); - } - if (string.indexOf('transaction_') > -1) { - var temp = string.split("_"); - string = temp[1]+" "+temp[0].charAt(0).toUpperCase() + temp[0].slice(1)+"s"; - } - string = string.charAt(0).toUpperCase() + string.slice(1); - return string; - }; - }); - } - }); - mifosX.ng.application.controller('ViewRoleController', ['$scope', '$routeParams', 'ResourceFactory', '$route', mifosX.controllers.ViewRoleController]).run(function($log) { - $log.info("ViewRoleController initialized"); - }); + }); + mifosX.ng.application.controller('ViewRoleController', ['$scope', '$routeParams', 'ResourceFactory', '$route', mifosX.controllers.ViewRoleController]).run(function ($log) { + $log.info("ViewRoleController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/private/SuperuserController.js b/app/scripts/controllers/private/SuperuserController.js index cba4f52f..29e04f96 100644 --- a/app/scripts/controllers/private/SuperuserController.js +++ b/app/scripts/controllers/private/SuperuserController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - SuperuserController: function(scope, resourceFactory) { + SuperuserController: function (scope, resourceFactory) { scope.client = []; scope.offices = []; scope.cOfficeName = 'Head Office'; @@ -8,20 +8,20 @@ scope.bOfficeName = 'Head Office'; scope.chartType = 'Days'; scope.collectionPieData = []; - scope.formatdate = function(){ + scope.formatdate = function () { var bardate = new Date(); scope.formattedDate = []; - for(var i=0; i<12;i++) - { + for (var i = 0; i < 12; i++) { var temp_date = bardate.getDate(); bardate.setDate(temp_date - 1); var curr_date = bardate.getDate(); - var curr_month = bardate.getMonth() +1; + var curr_month = bardate.getMonth() + 1; scope.formattedDate[i] = curr_date + "/" + curr_month; } - };scope.formatdate(); + }; + scope.formatdate(); - scope.getWeek = function() { + scope.getWeek = function () { scope.formattedWeek = []; var checkDate = new Date(); checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7)); @@ -29,303 +29,283 @@ checkDate.setMonth(0); checkDate.setDate(1); var week = Math.floor(Math.round((time - checkDate) / 86400000) / 7); - for(var i=0;i<12;i++) - { - if(week==0) - { + for (var i = 0; i < 12; i++) { + if (week == 0) { week = 52; } scope.formattedWeek[i] = week - i; } - };scope.getWeek(); + }; + scope.getWeek(); - scope.getMonth = function(){ + scope.getMonth = function () { var today = new Date(); var aMonth = today.getMonth(); - scope.formattedMonth= []; + scope.formattedMonth = []; var month = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); - for (var i=0; i<12; i++) - { + for (var i = 0; i < 12; i++) { scope.formattedMonth.push(month[aMonth]); aMonth--; - if (aMonth < 0) - { + if (aMonth < 0) { aMonth = 11; } } - }; scope.getMonth(); + }; + scope.getMonth(); - scope.getBarData = function(firstData,secondClientData,secondLoanData){ + scope.getBarData = function (firstData, secondClientData, secondLoanData) { scope.BarData = [ - { - "key": "New Client Joining", - "values": [ - [ firstData[11] , secondClientData[11]] , - [ firstData[10] , secondClientData[10]] , - [ firstData[9] , secondClientData[9]] , - [ firstData[8] , secondClientData[8]] , - [ firstData[7] , secondClientData[7]] , - [ firstData[6] , secondClientData[6]] , - [ firstData[5] , secondClientData[5]] , - [ firstData[4] , secondClientData[4]] , - [ firstData[3] , secondClientData[3]] , - [ firstData[2] , secondClientData[2]] , - [ firstData[1] , secondClientData[1]] , - [ firstData[0] , secondClientData[0]] - ] - }, - { - "key": "Loans Disbursed", - "values": [ - [ firstData[11] , secondLoanData[11]] , - [ firstData[10] , secondLoanData[10]] , - [ firstData[9] , secondLoanData[9]] , - [ firstData[8] , secondLoanData[8]] , - [ firstData[7] , secondLoanData[7]] , - [ firstData[6] , secondLoanData[6]] , - [ firstData[5] , secondLoanData[5]] , - [ firstData[4] , secondLoanData[4]] , - [ firstData[3] , secondLoanData[3]] , - [ firstData[2] , secondLoanData[2]] , - [ firstData[1] , secondLoanData[1]] , - [ firstData[0] , secondLoanData[0]] - ] - } - ]; - }; - - scope.getFcount = function (dateData,retrievedDateData,responseData) { - for(var i in dateData ) - { scope.fcount[i] = 0; - for(var j in retrievedDateData) { - if(dateData[i]==retrievedDateData[j]) - { - scope.fcount[i]=responseData[j].count; + "key": "New Client Joining", + "values": [ + [ firstData[11] , secondClientData[11]] , + [ firstData[10] , secondClientData[10]] , + [ firstData[9] , secondClientData[9]] , + [ firstData[8] , secondClientData[8]] , + [ firstData[7] , secondClientData[7]] , + [ firstData[6] , secondClientData[6]] , + [ firstData[5] , secondClientData[5]] , + [ firstData[4] , secondClientData[4]] , + [ firstData[3] , secondClientData[3]] , + [ firstData[2] , secondClientData[2]] , + [ firstData[1] , secondClientData[1]] , + [ firstData[0] , secondClientData[0]] + ] + }, + { + "key": "Loans Disbursed", + "values": [ + [ firstData[11] , secondLoanData[11]] , + [ firstData[10] , secondLoanData[10]] , + [ firstData[9] , secondLoanData[9]] , + [ firstData[8] , secondLoanData[8]] , + [ firstData[7] , secondLoanData[7]] , + [ firstData[6] , secondLoanData[6]] , + [ firstData[5] , secondLoanData[5]] , + [ firstData[4] , secondLoanData[4]] , + [ firstData[3] , secondLoanData[3]] , + [ firstData[2] , secondLoanData[2]] , + [ firstData[1] , secondLoanData[1]] , + [ firstData[0] , secondLoanData[0]] + ] + } + ]; + }; + + scope.getFcount = function (dateData, retrievedDateData, responseData) { + for (var i in dateData) { + scope.fcount[i] = 0; + for (var j in retrievedDateData) { + if (dateData[i] == retrievedDateData[j]) { + scope.fcount[i] = responseData[j].count; } } } }; - scope.getLcount = function (dateData,retrievedDateData,responseData) { - for(var i in dateData ) - { scope.lcount[i] = 0; - for(var j in retrievedDateData) - { - if(dateData[i]==retrievedDateData[j]) - { - scope.lcount[i]=responseData[j].lcount; + scope.getLcount = function (dateData, retrievedDateData, responseData) { + for (var i in dateData) { + scope.lcount[i] = 0; + for (var j in retrievedDateData) { + if (dateData[i] == retrievedDateData[j]) { + scope.lcount[i] = responseData[j].lcount; } } } }; - resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByDay',R_officeId:1, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByDay', R_officeId: 1, genericResultSet: false}, function (data) { scope.client = data; scope.days = []; scope.tempDate = []; scope.fcount = []; - for(var i in scope.client) - { + for (var i in scope.client) { scope.days[i] = scope.client[i].days; } - for(var i in scope.days) - { + for (var i in scope.days) { var tday = scope.days[i][2]; var tmonth = scope.days[i][1]; var tyear = scope.days[i][0]; scope.tempDate[i] = tday + "/" + tmonth; } - scope.getFcount(scope.formattedDate,scope.tempDate,scope.client); - resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByDay',R_officeId:1, genericResultSet:false} , function(data) { + scope.getFcount(scope.formattedDate, scope.tempDate, scope.client); + resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByDay', R_officeId: 1, genericResultSet: false}, function (data) { scope.ldays = []; scope.ltempDate = []; scope.lcount = []; - for(var i in data) - { + for (var i in data) { scope.ldays[i] = data[i].days; } - for(var i in scope.ldays) - { + for (var i in scope.ldays) { var tday = scope.ldays[i][2]; var tmonth = scope.ldays[i][1]; var tyear = scope.ldays[i][0]; scope.ltempDate[i] = tday + "/" + tmonth; } - scope.getLcount(scope.formattedDate,scope.ltempDate,data); - scope.getBarData(scope.formattedDate,scope.fcount,scope.lcount); + scope.getLcount(scope.formattedDate, scope.ltempDate, data); + scope.getBarData(scope.formattedDate, scope.fcount, scope.lcount); }); }); - resourceFactory.groupTemplateResource.get(function(data) { + resourceFactory.groupTemplateResource.get(function (data) { scope.offices = data.officeOptions; }); - resourceFactory.runReportsResource.get({reportSource: 'Demand_Vs_Collection',R_officeId:1, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'Demand_Vs_Collection', R_officeId: 1, genericResultSet: false}, function (data) { scope.collectionPieData = data[0]; scope.showCollectionerror = false; - if(data[0].AmountPaid == 0 && data[0].AmountDue == 0){ + if (data[0].AmountPaid == 0 && data[0].AmountDue == 0) { scope.showCollectionerror = true; } scope.collectedData = [ - {key:"Collected", y:scope.collectionPieData.AmountPaid}, - {key:"Pending", y:scope.collectionPieData.AmountDue} + {key: "Collected", y: scope.collectionPieData.AmountPaid}, + {key: "Pending", y: scope.collectionPieData.AmountDue} ]; }); - resourceFactory.runReportsResource.get({reportSource: 'Disbursal_Vs_Awaitingdisbursal',R_officeId:1, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'Disbursal_Vs_Awaitingdisbursal', R_officeId: 1, genericResultSet: false}, function (data) { scope.disbursedPieData = data[0]; scope.showDisbursementerror = false; - if(data[0].disbursedAmount == 0 && data[0].amountToBeDisburse == 0){ + if (data[0].disbursedAmount == 0 && data[0].amountToBeDisburse == 0) { scope.showDisbursementerror = true; } scope.disbursedData = [ - {key:"Disbursed", y:scope.disbursedPieData.disbursedAmount}, - {key:"Pending", y:scope.disbursedPieData.amountToBeDisburse} + {key: "Disbursed", y: scope.disbursedPieData.disbursedAmount}, + {key: "Pending", y: scope.disbursedPieData.amountToBeDisburse} ]; }); - scope.getDailyData = function(){ + scope.getDailyData = function () { scope.chartType = 'Days'; scope.id = this.officeId || 1; - resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByDay',R_officeId:scope.id, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByDay', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.client = data; scope.days = []; scope.tempDate = []; scope.fcount = []; - for(var i in scope.offices){ - if(scope.offices[i].id == scope.id){ + for (var i in scope.offices) { + if (scope.offices[i].id == scope.id) { scope.bOfficeName = scope.offices[i].name; } } - for(var i in scope.client) - { + for (var i in scope.client) { scope.days[i] = scope.client[i].days; } - for(var i in scope.days) - { + for (var i in scope.days) { var tday = scope.days[i][2]; var tmonth = scope.days[i][1]; var tyear = scope.days[i][0]; scope.tempDate[i] = tday + "/" + tmonth; } - scope.getFcount(scope.formattedDate,scope.tempDate,scope.client); - resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByDay',R_officeId:scope.id, genericResultSet:false} , function(data) { + scope.getFcount(scope.formattedDate, scope.tempDate, scope.client); + resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByDay', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.ldays = []; scope.ltempDate = []; scope.lcount = []; - for(var i in data) - { + for (var i in data) { scope.ldays[i] = data[i].days; } - for(var i in scope.ldays) - { + for (var i in scope.ldays) { var tday = scope.ldays[i][2]; var tmonth = scope.ldays[i][1]; var tyear = scope.ldays[i][0]; scope.ltempDate[i] = tday + "/" + tmonth; } - scope.getLcount(scope.formattedDate,scope.ltempDate,data); - scope.getBarData(scope.formattedDate,scope.fcount,scope.lcount); + scope.getLcount(scope.formattedDate, scope.ltempDate, data); + scope.getBarData(scope.formattedDate, scope.fcount, scope.lcount); }); }); }; - scope.getWeeklyData = function(){ + scope.getWeeklyData = function () { scope.chartType = 'Weeks'; scope.id = this.officeId || 1; - resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByWeek',R_officeId:scope.id, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByWeek', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.client = data; scope.weeks = []; scope.fcount = []; - for(var i in scope.offices){ - if(scope.offices[i].id == scope.id){ + for (var i in scope.offices) { + if (scope.offices[i].id == scope.id) { scope.bOfficeName = scope.offices[i].name; } } - for(var i in scope.client) - { + for (var i in scope.client) { scope.weeks[i] = scope.client[i].Weeks; } - scope.getFcount(scope.formattedWeek,scope.weeks,scope.client); - resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByWeek',R_officeId:scope.id, genericResultSet:false} , function(data) { + scope.getFcount(scope.formattedWeek, scope.weeks, scope.client); + resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByWeek', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.lweeks = []; scope.lcount = []; - for(var i in data) - { + for (var i in data) { scope.lweeks[i] = data[i].Weeks; } - scope.getLcount(scope.formattedWeek,scope.lweeks,data); - scope.getBarData(scope.formattedWeek,scope.fcount,scope.lcount); + scope.getLcount(scope.formattedWeek, scope.lweeks, data); + scope.getBarData(scope.formattedWeek, scope.fcount, scope.lcount); }); }); }; - scope.getMonthlyData = function() { + scope.getMonthlyData = function () { scope.chartType = 'Months'; scope.id = this.officeId || 1; scope.formattedSMonth = []; - var monthArray = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); + var monthArray = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var today = new Date(); var aMonth = today.getMonth(); - for (var i=0; i<12; i++) - { + for (var i = 0; i < 12; i++) { scope.formattedSMonth.push(monthArray[aMonth]); aMonth--; - if (aMonth < 0) - { + if (aMonth < 0) { aMonth = 11; } } - resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByMonth',R_officeId:scope.id, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'ClientTrendsByMonth', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.client = data; scope.months = []; scope.fcount = []; - for(var i in scope.offices){ - if(scope.offices[i].id == scope.id){ + for (var i in scope.offices) { + if (scope.offices[i].id == scope.id) { scope.bOfficeName = scope.offices[i].name; } } - for(var i in scope.client) - { + for (var i in scope.client) { scope.months[i] = scope.client[i].Months; } - scope.getFcount(scope.formattedMonth,scope.months,scope.client); - resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByMonth',R_officeId:scope.id, genericResultSet:false} , function(data) { + scope.getFcount(scope.formattedMonth, scope.months, scope.client); + resourceFactory.runReportsResource.get({reportSource: 'LoanTrendsByMonth', R_officeId: scope.id, genericResultSet: false}, function (data) { scope.lmonths = []; scope.lcount = []; - for(var i in data) - { + for (var i in data) { scope.lmonths[i] = data[i].Months; } - scope.getLcount(scope.formattedMonth,scope.lmonths,data); - scope.getBarData(scope.formattedSMonth,scope.fcount,scope.lcount); + scope.getLcount(scope.formattedMonth, scope.lmonths, data); + scope.getBarData(scope.formattedSMonth, scope.fcount, scope.lcount); }); }); }; scope.getCollectionOffice = function () { var id = this.officeIdCollection || 1; - for(var i in scope.offices){ - if(scope.offices[i].id==id){ + for (var i in scope.offices) { + if (scope.offices[i].id == id) { scope.cOfficeName = scope.offices[i].name; } } - resourceFactory.runReportsResource.get({reportSource: 'Demand_Vs_Collection',R_officeId:this.officeIdCollection, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'Demand_Vs_Collection', R_officeId: this.officeIdCollection, genericResultSet: false}, function (data) { scope.showCollectionerror = false; scope.collectionPieData = data[0]; - if(data[0].AmountPaid == 0 && data[0].AmountDue == 0){ + if (data[0].AmountPaid == 0 && data[0].AmountDue == 0) { scope.showCollectionerror = true; } scope.collectedData = [ - {key:"Collected", y:scope.collectionPieData.AmountPaid}, - {key:"Pending", y:scope.collectionPieData.AmountDue} + {key: "Collected", y: scope.collectionPieData.AmountPaid}, + {key: "Pending", y: scope.collectionPieData.AmountDue} ]; }); @@ -333,51 +313,51 @@ }; scope.getDisbursementOffice = function () { var id = this.officeIdDisbursed || 1; - for(var i in scope.offices){ - if(scope.offices[i].id== id){ + for (var i in scope.offices) { + if (scope.offices[i].id == id) { scope.dOfficeName = scope.offices[i].name; } } - resourceFactory.runReportsResource.get({reportSource: 'Disbursal_Vs_Awaitingdisbursal',R_officeId:this.officeIdDisbursed, genericResultSet:false} , function(data) { + resourceFactory.runReportsResource.get({reportSource: 'Disbursal_Vs_Awaitingdisbursal', R_officeId: this.officeIdDisbursed, genericResultSet: false}, function (data) { scope.disbursedPieData = data[0]; scope.showDisbursementerror = false; - if(data[0].disbursedAmount == 0 && data[0].amountToBeDisburse == 0){ + if (data[0].disbursedAmount == 0 && data[0].amountToBeDisburse == 0) { scope.showDisbursementerror = true; } scope.disbursedData = [ - {key:"Collected", y:scope.disbursedPieData.disbursedAmount}, - {key:"Pending", y:scope.disbursedPieData.amountToBeDisburse} + {key: "Collected", y: scope.disbursedPieData.disbursedAmount}, + {key: "Pending", y: scope.disbursedPieData.amountToBeDisburse} ]; }); }; - scope.xFunction = function(){ - return function(d) { + scope.xFunction = function () { + return function (d) { return d.key; }; }; - scope.yFunction = function(){ - return function(d) { + scope.yFunction = function () { + return function (d) { return d.y; }; }; var colorArray = ['#0f82f5', '#008000', '#808080', '#000000', '#FFE6E6']; - var colorArrayPie =['#008000','#ff4500']; - scope.colorFunction = function() { - return function(d, i) { + var colorArrayPie = ['#008000', '#ff4500']; + scope.colorFunction = function () { + return function (d, i) { return colorArray[i]; }; }; - scope.colorFunctionPie = function() { - return function(d, i) { + scope.colorFunctionPie = function () { + return function (d, i) { return colorArrayPie[i]; }; }; } }); - mifosX.ng.application.controller('SuperuserController', ['$scope', 'ResourceFactory', mifosX.controllers.SuperuserController]).run(function($log) { + mifosX.ng.application.controller('SuperuserController', ['$scope', 'ResourceFactory', mifosX.controllers.SuperuserController]).run(function ($log) { $log.info("SuperuserController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/ChargeController.js b/app/scripts/controllers/product/ChargeController.js index 4db6398b..c96c7088 100644 --- a/app/scripts/controllers/product/ChargeController.js +++ b/app/scripts/controllers/product/ChargeController.js @@ -1,18 +1,18 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ChargeController: function(scope, resourceFactory,location) { - scope.charges = []; - scope.routeTo = function(id){ - location.path('/viewcharge/' + id); - }; - scope.$broadcast('ChargeDataLoadingStartEvent'); - resourceFactory.chargeResource.getAllCharges(function(data) { - scope.charges = data; - scope.$broadcast('ChargeDataLoadingCompleteEvent'); - }); - } - }); - mifosX.ng.application.controller('ChargeController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.ChargeController]).run(function($log) { - $log.info("ChargeController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ChargeController: function (scope, resourceFactory, location) { + scope.charges = []; + scope.routeTo = function (id) { + location.path('/viewcharge/' + id); + }; + scope.$broadcast('ChargeDataLoadingStartEvent'); + resourceFactory.chargeResource.getAllCharges(function (data) { + scope.charges = data; + scope.$broadcast('ChargeDataLoadingCompleteEvent'); + }); + } + }); + mifosX.ng.application.controller('ChargeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.ChargeController]).run(function ($log) { + $log.info("ChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/CreateChargeController.js b/app/scripts/controllers/product/CreateChargeController.js index 3010f35d..e6858621 100644 --- a/app/scripts/controllers/product/CreateChargeController.js +++ b/app/scripts/controllers/product/CreateChargeController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CreateChargeController: function(scope, resourceFactory,location, dateFilter) { + CreateChargeController: function (scope, resourceFactory, location, dateFilter) { scope.template = []; scope.formData = {}; scope.first = {}; @@ -9,14 +9,14 @@ scope.repeatEvery = false; scope.first.date = new Date(); - resourceFactory.chargeTemplateResource.get(function(data) { + resourceFactory.chargeTemplateResource.get(function (data) { scope.template = data; scope.showChargePaymentByField = true; scope.chargeCalculationTypeOptions = data.chargeCalculationTypeOptions; scope.chargeTimeTypeOptions = data.chargeTimeTypeOptions; }); - scope.chargeAppliesToSelected = function(chargeAppliesId) { + scope.chargeAppliesToSelected = function (chargeAppliesId) { if (chargeAppliesId == 1) { scope.showChargePaymentByField = true; scope.chargeCalculationTypeOptions = scope.template.loanChargeCalculationTypeOptions; @@ -32,7 +32,7 @@ //'annual fee' or 'monthly fee' scope.chargeTimeChange = function (chargeTimeType) { if (scope.showChargePaymentByField === false) { - for(var i in scope.chargeTimeTypeOptions) { + for (var i in scope.chargeTimeTypeOptions) { if (chargeTimeType === scope.chargeTimeTypeOptions[i].id) { if (scope.chargeTimeTypeOptions[i].value == "Annual Fee" || scope.chargeTimeTypeOptions[i].value == "Monthly Fee") { scope.showdatefield = true; @@ -50,23 +50,23 @@ } } - scope.setChoice = function(){ - if(this.formData.active){ + scope.setChoice = function () { + if (this.formData.active) { scope.choice = 1; } - else if(!this.formData.active){ + else if (!this.formData.active) { scope.choice = 0; } }; - scope.submit = function() { + scope.submit = function () { //when chargeTimeType is 'annual' or 'monthly fee' then feeOnMonthDay added to //the formData if (scope.showChargePaymentByField === false) { if (scope.showdatefield === true) { - var reqDate = dateFilter(scope.first.date,'dd MMMM'); + var reqDate = dateFilter(scope.first.date, 'dd MMMM'); this.formData.monthDayFormat = 'dd MMM'; - this.formData.feeOnMonthDay = reqDate; + this.formData.feeOnMonthDay = reqDate; } } @@ -76,13 +76,13 @@ this.formData.active = this.formData.active || false; this.formData.locale = scope.optlang.code; this.formData.monthDayFormat = 'dd MMM'; - resourceFactory.chargeResource.save(this.formData,function(data){ + resourceFactory.chargeResource.save(this.formData, function (data) { location.path('/viewcharge/' + data.resourceId); }); }; } }); - mifosX.ng.application.controller('CreateChargeController', ['$scope', 'ResourceFactory','$location', 'dateFilter', mifosX.controllers.CreateChargeController]).run(function($log) { + mifosX.ng.application.controller('CreateChargeController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateChargeController]).run(function ($log) { $log.info("CreateChargeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/CreateLoanProductController.js b/app/scripts/controllers/product/CreateLoanProductController.js index da41613f..b4a25ad3 100644 --- a/app/scripts/controllers/product/CreateLoanProductController.js +++ b/app/scripts/controllers/product/CreateLoanProductController.js @@ -1,238 +1,236 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateLoanProductController: function(scope, resourceFactory, location,dateFilter) { - scope.formData = {}; - scope.charges = []; - scope.showOrHideValue = "show"; - scope.configureFundOptions = []; - scope.specificIncomeaccounts = []; - scope.penaltySpecificIncomeaccounts = []; - scope.configureFundOption = {}; - scope.date = {}; - scope.pvFlag = false; - scope.rvFlag = false; - scope.irFlag = false; - scope.chargeFlag = false; - scope.frFlag = false; - scope.fiFlag = false; - scope.piFlag = false; - resourceFactory.loanProductResource.get({resourceType:'template'}, function(data) { - scope.product = data; - scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; - scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; - scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; - scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; - scope.penaltyOptions = scope.product.penaltyOptions || []; - scope.formData.currencyCode = scope.product.currencyOptions[0].code; - scope.formData.includeInBorrowerCycle = 'false'; - scope.formData.useBorrowerCycle = 'false'; - scope.formData.digitsAfterDecimal = '2'; - scope.formData.inMultiplesOf = '0'; - scope.formData.repaymentFrequencyType = scope.product.repaymentFrequencyType.id; - scope.formData.interestRateFrequencyType = scope.product.interestRateFrequencyType.id; - scope.formData.amortizationType = scope.product.amortizationType.id; - scope.formData.interestType = scope.product.interestType.id; - scope.formData.interestCalculationPeriodType = scope.product.interestCalculationPeriodType.id; - scope.formData.transactionProcessingStrategyId = scope.product.transactionProcessingStrategyOptions[0].id; - scope.formData.principalVariationsForBorrowerCycle = scope.product.principalVariationsForBorrowerCycle; - scope.formData.interestRateVariationsForBorrowerCycle = scope.product.interestRateVariationsForBorrowerCycle; - scope.formData.numberOfRepaymentVariationsForBorrowerCycle = scope.product.numberOfRepaymentVariationsForBorrowerCycle; - scope.formData.multiDisburseLoan = 'false'; - if (scope.assetAccountOptions[0]) { - scope.formData.fundSourceAccountId = scope.assetAccountOptions[0].id; - } - if (scope.assetAccountOptions[1]) { - scope.formData.loanPortfolioAccountId = scope.assetAccountOptions[1].id; - } - if (scope.assetAccountOptions[2]) { - scope.formData.transfersInSuspenseAccountId = scope.assetAccountOptions[2].id; - } - if (scope.incomeAccountOptions[0]) { - scope.formData.interestOnLoanAccountId = scope.incomeAccountOptions[0].id; - } - if (scope.incomeAccountOptions[1]) { - scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[1].id; - } - if (scope.incomeAccountOptions[2]) { - scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[2].id; - } - if (scope.expenseAccountOptions[0]) { - scope.formData.writeOffAccountId = scope.expenseAccountOptions[0].id; - } - if (scope.liabilityOptions[0]) { - scope.formData.overpaymentLiabilityAccountId = scope.liabilityOptions[0].id; - } - scope.formData.accountingRule = '1'; - }); - - scope.chargeSelected = function(chargeId) { - - if (chargeId) { - scope.chargeFlag=true; - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData,function(data){ - data.chargeId = data.id; - scope.charges.push(data); - //to charge select box empty - scope.chargeId = ''; +(function (module) { + mifosX.controllers = _.extend(module, { + CreateLoanProductController: function (scope, resourceFactory, location, dateFilter) { + scope.formData = {}; + scope.charges = []; + scope.showOrHideValue = "show"; + scope.configureFundOptions = []; + scope.specificIncomeaccounts = []; + scope.penaltySpecificIncomeaccounts = []; + scope.configureFundOption = {}; + scope.date = {}; + scope.pvFlag = false; + scope.rvFlag = false; + scope.irFlag = false; + scope.chargeFlag = false; + scope.frFlag = false; + scope.fiFlag = false; + scope.piFlag = false; + resourceFactory.loanProductResource.get({resourceType: 'template'}, function (data) { + scope.product = data; + scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; + scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; + scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; + scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; + scope.penaltyOptions = scope.product.penaltyOptions || []; + scope.formData.currencyCode = scope.product.currencyOptions[0].code; + scope.formData.includeInBorrowerCycle = 'false'; + scope.formData.useBorrowerCycle = 'false'; + scope.formData.digitsAfterDecimal = '2'; + scope.formData.inMultiplesOf = '0'; + scope.formData.repaymentFrequencyType = scope.product.repaymentFrequencyType.id; + scope.formData.interestRateFrequencyType = scope.product.interestRateFrequencyType.id; + scope.formData.amortizationType = scope.product.amortizationType.id; + scope.formData.interestType = scope.product.interestType.id; + scope.formData.interestCalculationPeriodType = scope.product.interestCalculationPeriodType.id; + scope.formData.transactionProcessingStrategyId = scope.product.transactionProcessingStrategyOptions[0].id; + scope.formData.principalVariationsForBorrowerCycle = scope.product.principalVariationsForBorrowerCycle; + scope.formData.interestRateVariationsForBorrowerCycle = scope.product.interestRateVariationsForBorrowerCycle; + scope.formData.numberOfRepaymentVariationsForBorrowerCycle = scope.product.numberOfRepaymentVariationsForBorrowerCycle; + scope.formData.multiDisburseLoan = 'false'; + if (scope.assetAccountOptions[0]) { + scope.formData.fundSourceAccountId = scope.assetAccountOptions[0].id; + } + if (scope.assetAccountOptions[1]) { + scope.formData.loanPortfolioAccountId = scope.assetAccountOptions[1].id; + } + if (scope.assetAccountOptions[2]) { + scope.formData.transfersInSuspenseAccountId = scope.assetAccountOptions[2].id; + } + if (scope.incomeAccountOptions[0]) { + scope.formData.interestOnLoanAccountId = scope.incomeAccountOptions[0].id; + } + if (scope.incomeAccountOptions[1]) { + scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[1].id; + } + if (scope.incomeAccountOptions[2]) { + scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[2].id; + } + if (scope.expenseAccountOptions[0]) { + scope.formData.writeOffAccountId = scope.expenseAccountOptions[0].id; + } + if (scope.liabilityOptions[0]) { + scope.formData.overpaymentLiabilityAccountId = scope.liabilityOptions[0].id; + } + scope.formData.accountingRule = '1'; }); - } - }; - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - }; + scope.chargeSelected = function (chargeId) { - //advanced accounting rule - scope.showOrHide = function(showOrHideValue) { - - if(showOrHideValue == "show") - { - scope.showOrHideValue = 'hide'; - } + if (chargeId) { + scope.chargeFlag = true; + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + //to charge select box empty + scope.chargeId = ''; + }); + } + }; - if(showOrHideValue == "hide") - { - scope.showOrHideValue = 'show'; - } - }; + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + }; + + //advanced accounting rule + scope.showOrHide = function (showOrHideValue) { + + if (showOrHideValue == "show") { + scope.showOrHideValue = 'hide'; + } + + if (showOrHideValue == "hide") { + scope.showOrHideValue = 'show'; + } + }; - scope.addConfigureFundSource = function() { - scope.frFlag = true; - scope.configureFundOptions.push({ - paymentTypeId : scope.product.paymentTypeOptions.length > 0 ? scope.product.paymentTypeOptions[0].id : '', - fundSourceAccountId : scope.assetAccountOptions.length > 0 ? scope.assetAccountOptions[0].id : '', - paymentTypeOptions : scope.product.paymentTypeOptions.length > 0 ? scope.product.paymentTypeOptions : [], - assetAccountOptions : scope.assetAccountOptions.length > 0 ? scope.assetAccountOptions : [] - }); - }; + scope.addConfigureFundSource = function () { + scope.frFlag = true; + scope.configureFundOptions.push({ + paymentTypeId: scope.product.paymentTypeOptions.length > 0 ? scope.product.paymentTypeOptions[0].id : '', + fundSourceAccountId: scope.assetAccountOptions.length > 0 ? scope.assetAccountOptions[0].id : '', + paymentTypeOptions: scope.product.paymentTypeOptions.length > 0 ? scope.product.paymentTypeOptions : [], + assetAccountOptions: scope.assetAccountOptions.length > 0 ? scope.assetAccountOptions : [] + }); + }; - scope.mapFees = function() { - scope.fiFlag = true; - scope.specificIncomeaccounts.push({ - chargeId : scope.product.chargeOptions.length > 0 ? scope.product.chargeOptions[0].id : '', - incomeAccountId : scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions[0].id : '', - chargeOptions : scope.product.chargeOptions.length > 0 ? scope.product.chargeOptions : [], - incomeAccountOptions : scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions : [] - }); - }; + scope.mapFees = function () { + scope.fiFlag = true; + scope.specificIncomeaccounts.push({ + chargeId: scope.product.chargeOptions.length > 0 ? scope.product.chargeOptions[0].id : '', + incomeAccountId: scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions[0].id : '', + chargeOptions: scope.product.chargeOptions.length > 0 ? scope.product.chargeOptions : [], + incomeAccountOptions: scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions : [] + }); + }; - scope.addPrincipalVariation = function() { - scope.pvFlag = true; - scope.formData.principalVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }); - }; - scope.addInterestRateVariation = function() { - scope.irFlag= true; - scope.formData.interestRateVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }); - }; - scope.addNumberOfRepaymentVariation = function() { - scope.rvFlag = true; - scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }); - }; + scope.addPrincipalVariation = function () { + scope.pvFlag = true; + scope.formData.principalVariationsForBorrowerCycle.push({ + valueConditionType: scope.product.valueConditionTypeOptions[0].id + }); + }; + scope.addInterestRateVariation = function () { + scope.irFlag = true; + scope.formData.interestRateVariationsForBorrowerCycle.push({ + valueConditionType: scope.product.valueConditionTypeOptions[0].id + }); + }; + scope.addNumberOfRepaymentVariation = function () { + scope.rvFlag = true; + scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ + valueConditionType: scope.product.valueConditionTypeOptions[0].id + }); + }; - scope.mapPenalty = function() { - scope.piFlag = true; - scope.penaltySpecificIncomeaccounts.push({ - chargeId : scope.penaltyOptions.length > 0 ? scope.penaltyOptions[0].id : '', - incomeAccountId : scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions[0].id : '', - penaltyOptions : scope.penaltyOptions.length > 0 ? scope.penaltyOptions : [], - incomeAccountOptions : scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions : [] - }); - }; + scope.mapPenalty = function () { + scope.piFlag = true; + scope.penaltySpecificIncomeaccounts.push({ + chargeId: scope.penaltyOptions.length > 0 ? scope.penaltyOptions[0].id : '', + incomeAccountId: scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions[0].id : '', + penaltyOptions: scope.penaltyOptions.length > 0 ? scope.penaltyOptions : [], + incomeAccountOptions: scope.incomeAccountOptions.length > 0 ? scope.incomeAccountOptions : [] + }); + }; - scope.deleteFund = function(index) { - scope.configureFundOptions.splice(index,1); - }; + scope.deleteFund = function (index) { + scope.configureFundOptions.splice(index, 1); + }; - scope.deleteFee = function(index) { - scope.specificIncomeaccounts.splice(index,1); - }; + scope.deleteFee = function (index) { + scope.specificIncomeaccounts.splice(index, 1); + }; - scope.deletePenalty = function(index) { - scope.penaltySpecificIncomeaccounts.splice(index,1); - }; + scope.deletePenalty = function (index) { + scope.penaltySpecificIncomeaccounts.splice(index, 1); + }; - scope.deletePrincipalVariation = function(index) { - scope.formData.principalVariationsForBorrowerCycle.splice(index,1); - }; + scope.deletePrincipalVariation = function (index) { + scope.formData.principalVariationsForBorrowerCycle.splice(index, 1); + }; - scope.deleteInterestRateVariation = function(index) { - scope.formData.interestRateVariationsForBorrowerCycle.splice(index,1); - }; + scope.deleteInterestRateVariation = function (index) { + scope.formData.interestRateVariationsForBorrowerCycle.splice(index, 1); + }; - scope.deleterepaymentVariation = function(index) { - scope.formData.numberOfRepaymentVariationsForBorrowerCycle.splice(index,1); - }; + scope.deleterepaymentVariation = function (index) { + scope.formData.numberOfRepaymentVariationsForBorrowerCycle.splice(index, 1); + }; - scope.cancel = function (){ - location.path('/loanproducts'); - }; + scope.cancel = function () { + location.path('/loanproducts'); + }; - scope.submit = function() { - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - scope.paymentChannelToFundSourceMappings = []; - scope.feeToIncomeAccountMappings = []; - scope.penaltyToIncomeAccountMappings = []; - scope.chargesSelected = []; + scope.submit = function () { + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + scope.paymentChannelToFundSourceMappings = []; + scope.feeToIncomeAccountMappings = []; + scope.penaltyToIncomeAccountMappings = []; + scope.chargesSelected = []; - var temp = ''; + var temp = ''; - //configure fund sources for payment channels - for (var i in scope.configureFundOptions) { - temp = { - paymentTypeId : scope.configureFundOptions[i].paymentTypeId, - fundSourceAccountId : scope.configureFundOptions[i].fundSourceAccountId - } - scope.paymentChannelToFundSourceMappings.push(temp); - } + //configure fund sources for payment channels + for (var i in scope.configureFundOptions) { + temp = { + paymentTypeId: scope.configureFundOptions[i].paymentTypeId, + fundSourceAccountId: scope.configureFundOptions[i].fundSourceAccountId + } + scope.paymentChannelToFundSourceMappings.push(temp); + } - //map fees to specific income accounts - for (var i in scope.specificIncomeaccounts) { - temp = { - chargeId : scope.specificIncomeaccounts[i].chargeId, - incomeAccountId : scope.specificIncomeaccounts[i].incomeAccountId, - } - scope.feeToIncomeAccountMappings.push(temp); - } + //map fees to specific income accounts + for (var i in scope.specificIncomeaccounts) { + temp = { + chargeId: scope.specificIncomeaccounts[i].chargeId, + incomeAccountId: scope.specificIncomeaccounts[i].incomeAccountId, + } + scope.feeToIncomeAccountMappings.push(temp); + } - //map penalties to specific income accounts - for (var i in scope.penaltySpecificIncomeaccounts) { - temp = { - chargeId : scope.penaltySpecificIncomeaccounts[i].chargeId, - incomeAccountId : scope.penaltySpecificIncomeaccounts[i].incomeAccountId, - } - scope.penaltyToIncomeAccountMappings.push(temp); - } + //map penalties to specific income accounts + for (var i in scope.penaltySpecificIncomeaccounts) { + temp = { + chargeId: scope.penaltySpecificIncomeaccounts[i].chargeId, + incomeAccountId: scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + } + scope.penaltyToIncomeAccountMappings.push(temp); + } - for (var i in scope.charges) { - temp = { - id : scope.charges[i].id - } - scope.chargesSelected.push(temp); - } + for (var i in scope.charges) { + temp = { + id: scope.charges[i].id + } + scope.chargesSelected.push(temp); + } - this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; - this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; - this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; - this.formData.charges = scope.chargesSelected; - this.formData.dateFormat = "dd MMMM yyyy"; - this.formData.locale = "en"; - this.formData.startDate = reqFirstDate; - this.formData.closeDate = reqSecondDate; - resourceFactory.loanProductResource.save(this.formData,function(data){ - location.path('/viewloanproduct/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateLoanProductController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.CreateLoanProductController]).run(function($log) { - $log.info("CreateLoanProductController initialized"); - }); + this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; + this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; + this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; + this.formData.charges = scope.chargesSelected; + this.formData.dateFormat = "dd MMMM yyyy"; + this.formData.locale = "en"; + this.formData.startDate = reqFirstDate; + this.formData.closeDate = reqSecondDate; + resourceFactory.loanProductResource.save(this.formData, function (data) { + location.path('/viewloanproduct/' + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('CreateLoanProductController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateLoanProductController]).run(function ($log) { + $log.info("CreateLoanProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/CreateSavingProductController.js b/app/scripts/controllers/product/CreateSavingProductController.js index 66281ecd..25559130 100644 --- a/app/scripts/controllers/product/CreateSavingProductController.js +++ b/app/scripts/controllers/product/CreateSavingProductController.js @@ -1,194 +1,193 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateSavingProductController: function(scope, resourceFactory, location) { - scope.formData = {}; - scope.charges = []; - scope.showOrHideValue = "show"; - scope.configureFundOptions = []; - scope.specificIncomeaccounts = []; - scope.penaltySpecificIncomeaccounts = []; - scope.configureFundOption = {}; +(function (module) { + mifosX.controllers = _.extend(module, { + CreateSavingProductController: function (scope, resourceFactory, location) { + scope.formData = {}; + scope.charges = []; + scope.showOrHideValue = "show"; + scope.configureFundOptions = []; + scope.specificIncomeaccounts = []; + scope.penaltySpecificIncomeaccounts = []; + scope.configureFundOption = {}; - resourceFactory.savingProductResource.get({resourceType:'template'}, function(data) { - scope.product = data; - scope.product.chargeOptions = scope.product.chargeOptions || []; - scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; - scope.liabilityAccountOptions = scope.product.accountingMappingOptions.liabilityAccountOptions || []; - scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; - scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; + resourceFactory.savingProductResource.get({resourceType: 'template'}, function (data) { + scope.product = data; + scope.product.chargeOptions = scope.product.chargeOptions || []; + scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; + scope.liabilityAccountOptions = scope.product.accountingMappingOptions.liabilityAccountOptions || []; + scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; + scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; - scope.formData.currencyCode = data.currencyOptions[0].code; - scope.formData.digitsAfterDecimal = data.currencyOptions[0].decimalPlaces; - scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; - scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; - scope.formData.interestCalculationType = data.interestCalculationType.id; - scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; + scope.formData.currencyCode = data.currencyOptions[0].code; + scope.formData.digitsAfterDecimal = data.currencyOptions[0].decimalPlaces; + scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; + scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; + scope.formData.interestCalculationType = data.interestCalculationType.id; + scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; - if (scope.assetAccountOptions.length > 0) { - scope.formData.savingsReferenceAccountId = scope.assetAccountOptions[0].id; - } - if (scope.assetAccountOptions.length > 1) { - scope.formData.overdraftPortfolioControlId = scope.assetAccountOptions[1].id; - } - if (scope.liabilityAccountOptions.length > 0) { - scope.formData.savingsControlAccountId = scope.liabilityAccountOptions[0].id; - } - if (scope.liabilityAccountOptions.length > 1) { - scope.formData.transfersInSuspenseAccountId = scope.liabilityAccountOptions[1].id; - } - if (scope.incomeAccountOptions.length > 0) { - scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[0].id; - } - if (scope.incomeAccountOptions.length > 1) { - scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[1].id; - } - if (scope.incomeAccountOptions.length > 2) { - scope.formData.incomeFromInterestId = scope.incomeAccountOptions[2].id; - } - if (scope.expenseAccountOptions.length > 0) { - scope.formData.interestOnSavingsAccountId = scope.expenseAccountOptions[0].id; - } - if (scope.expenseAccountOptions.length > 1) { - scope.formData.writeOffAccountId = scope.expenseAccountOptions[1].id; - } - scope.formData.accountingRule = '1'; - - }); + if (scope.assetAccountOptions.length > 0) { + scope.formData.savingsReferenceAccountId = scope.assetAccountOptions[0].id; + } + if (scope.assetAccountOptions.length > 1) { + scope.formData.overdraftPortfolioControlId = scope.assetAccountOptions[1].id; + } + if (scope.liabilityAccountOptions.length > 0) { + scope.formData.savingsControlAccountId = scope.liabilityAccountOptions[0].id; + } + if (scope.liabilityAccountOptions.length > 1) { + scope.formData.transfersInSuspenseAccountId = scope.liabilityAccountOptions[1].id; + } + if (scope.incomeAccountOptions.length > 0) { + scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[0].id; + } + if (scope.incomeAccountOptions.length > 1) { + scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[1].id; + } + if (scope.incomeAccountOptions.length > 2) { + scope.formData.incomeFromInterestId = scope.incomeAccountOptions[2].id; + } + if (scope.expenseAccountOptions.length > 0) { + scope.formData.interestOnSavingsAccountId = scope.expenseAccountOptions[0].id; + } + if (scope.expenseAccountOptions.length > 1) { + scope.formData.writeOffAccountId = scope.expenseAccountOptions[1].id; + } + scope.formData.accountingRule = '1'; - //advanced accounting rule - scope.showOrHide = function(showOrHideValue) { - - if(showOrHideValue == "show") - { - scope.showOrHideValue = 'hide'; - } - - if(showOrHideValue == "hide") - { - scope.showOrHideValue = 'show'; - } - } - - scope.chargeSelected = function(chargeId) { - if (chargeId) { - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData,function(data){ - data.chargeId = data.id; - scope.charges.push(data); - //to charge select box empty - scope.chargeId = ''; }); - } - } - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - } + //advanced accounting rule + scope.showOrHide = function (showOrHideValue) { - scope.addConfigureFundSource = function() { - if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && - scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { - scope.configureFundOptions.push({ - paymentTypeId : scope.product.paymentTypeOptions[0].id, - fundSourceAccountId : scope.assetAccountOptions[0].id, - paymentTypeOptions : scope.product.paymentTypeOptions, - assetAccountOptions : scope.assetAccountOptions - }); - }; - } + if (showOrHideValue == "show") { + scope.showOrHideValue = 'hide'; + } - scope.mapFees = function() { - if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.specificIncomeaccounts.push({ - chargeId : scope.product.chargeOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - chargeOptions : scope.product.chargeOptions, - incomeAccountOptions : scope.product.accountingMappingOptions.incomeAccountOptions - }); - } - } - - scope.mapPenalty = function() { - if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.penaltySpecificIncomeaccounts.push({ - chargeId : scope.product.penaltyOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - penaltyOptions : scope.product.penaltyOptions, - incomeAccountOptions : scope.incomeAccountOptions - }); - } - } - - scope.deleteFund = function(index) { - scope.configureFundOptions.splice(index,1); - } - - scope.deleteFee = function(index) { - scope.specificIncomeaccounts.splice(index,1); - } - - scope.deletePenalty = function(index) { - scope.penaltySpecificIncomeaccounts.splice(index,1); - } - - scope.cancel = function (){ - location.path('/savingproducts'); - }; - - scope.submit = function() { - scope.paymentChannelToFundSourceMappings = []; - scope.feeToIncomeAccountMappings = []; - scope.penaltyToIncomeAccountMappings = []; - scope.chargesSelected = []; - - var temp = ''; - - //configure fund sources for payment channels - for (var i in scope.configureFundOptions) { - temp = { - paymentTypeId : scope.configureFundOptions[i].paymentTypeId, - fundSourceAccountId : scope.configureFundOptions[i].fundSourceAccountId + if (showOrHideValue == "hide") { + scope.showOrHideValue = 'show'; + } } - scope.paymentChannelToFundSourceMappings.push(temp); - } - //map fees to specific income accounts - for (var i in scope.specificIncomeaccounts) { - temp = { - chargeId : scope.specificIncomeaccounts[i].chargeId, - incomeAccountId : scope.specificIncomeaccounts[i].incomeAccountId, + scope.chargeSelected = function (chargeId) { + if (chargeId) { + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + //to charge select box empty + scope.chargeId = ''; + }); + } } - scope.feeToIncomeAccountMappings.push(temp); - } - //map penalties to specific income accounts - for (var i in scope.penaltySpecificIncomeaccounts) { - temp = { - chargeId : scope.penaltySpecificIncomeaccounts[i].chargeId, - incomeAccountId : scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); } - scope.penaltyToIncomeAccountMappings.push(temp); - } - for (var i in scope.charges) { - temp = { - id : scope.charges[i].id + scope.addConfigureFundSource = function () { + if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && + scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { + scope.configureFundOptions.push({ + paymentTypeId: scope.product.paymentTypeOptions[0].id, + fundSourceAccountId: scope.assetAccountOptions[0].id, + paymentTypeOptions: scope.product.paymentTypeOptions, + assetAccountOptions: scope.assetAccountOptions + }); + } + ; } - scope.chargesSelected.push(temp); - } - this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; - this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; - this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; - this.formData.charges = scope.chargesSelected; - this.formData.locale = "en"; + scope.mapFees = function () { + if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.specificIncomeaccounts.push({ + chargeId: scope.product.chargeOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + chargeOptions: scope.product.chargeOptions, + incomeAccountOptions: scope.product.accountingMappingOptions.incomeAccountOptions + }); + } + } - resourceFactory.savingProductResource.save(this.formData,function(data){ - location.path('/viewsavingproduct/' + data.resourceId); - }); + scope.mapPenalty = function () { + if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.penaltySpecificIncomeaccounts.push({ + chargeId: scope.product.penaltyOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + penaltyOptions: scope.product.penaltyOptions, + incomeAccountOptions: scope.incomeAccountOptions + }); + } + } + + scope.deleteFund = function (index) { + scope.configureFundOptions.splice(index, 1); + } + + scope.deleteFee = function (index) { + scope.specificIncomeaccounts.splice(index, 1); + } + + scope.deletePenalty = function (index) { + scope.penaltySpecificIncomeaccounts.splice(index, 1); + } + + scope.cancel = function () { + location.path('/savingproducts'); + }; + + scope.submit = function () { + scope.paymentChannelToFundSourceMappings = []; + scope.feeToIncomeAccountMappings = []; + scope.penaltyToIncomeAccountMappings = []; + scope.chargesSelected = []; + + var temp = ''; + + //configure fund sources for payment channels + for (var i in scope.configureFundOptions) { + temp = { + paymentTypeId: scope.configureFundOptions[i].paymentTypeId, + fundSourceAccountId: scope.configureFundOptions[i].fundSourceAccountId + } + scope.paymentChannelToFundSourceMappings.push(temp); + } + + //map fees to specific income accounts + for (var i in scope.specificIncomeaccounts) { + temp = { + chargeId: scope.specificIncomeaccounts[i].chargeId, + incomeAccountId: scope.specificIncomeaccounts[i].incomeAccountId, + } + scope.feeToIncomeAccountMappings.push(temp); + } + + //map penalties to specific income accounts + for (var i in scope.penaltySpecificIncomeaccounts) { + temp = { + chargeId: scope.penaltySpecificIncomeaccounts[i].chargeId, + incomeAccountId: scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + } + scope.penaltyToIncomeAccountMappings.push(temp); + } + + for (var i in scope.charges) { + temp = { + id: scope.charges[i].id + } + scope.chargesSelected.push(temp); + } + + this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; + this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; + this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; + this.formData.charges = scope.chargesSelected; + this.formData.locale = "en"; + + resourceFactory.savingProductResource.save(this.formData, function (data) { + location.path('/viewsavingproduct/' + data.resourceId); + }); + } } - } - }); - mifosX.ng.application.controller('CreateSavingProductController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateSavingProductController]).run(function($log) { - $log.info("CreateSavingProductController initialized"); - }); + }); + mifosX.ng.application.controller('CreateSavingProductController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateSavingProductController]).run(function ($log) { + $log.info("CreateSavingProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/EditChargeController.js b/app/scripts/controllers/product/EditChargeController.js index 2ee8eb5c..6da23243 100644 --- a/app/scripts/controllers/product/EditChargeController.js +++ b/app/scripts/controllers/product/EditChargeController.js @@ -1,12 +1,12 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditChargeController: function(scope, resourceFactory,location,routeParams, dateFilter ) { + EditChargeController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.template = []; scope.showdatefield = false; scope.repeatEvery = false; scope.first = {}; scope.flag = false; - resourceFactory.chargeResource.getCharge({chargeId: routeParams.id,template:true}, function(data) { + resourceFactory.chargeResource.getCharge({chargeId: routeParams.id, template: true}, function (data) { scope.template = data; if (data.chargeAppliesTo.value === "Loan") { @@ -17,14 +17,14 @@ scope.flag = true; } scope.formData = { - name:data.name, - active:data.active, - penalty:data.penalty, - currencyCode:data.currency.code, - chargeAppliesTo:data.chargeAppliesTo.id, - chargeTimeType:data.chargeTimeType.id, - chargeCalculationType:data.chargeCalculationType.id, - amount:data.amount + name: data.name, + active: data.active, + penalty: data.penalty, + currencyCode: data.currency.code, + chargeAppliesTo: data.chargeAppliesTo.id, + chargeTimeType: data.chargeTimeType.id, + chargeCalculationType: data.chargeCalculationType.id, + amount: data.amount }; //when chargeAppliesTo is savings, below logic is //to display 'Due date' field, if chargeTimeType is @@ -34,7 +34,7 @@ scope.showdatefield = true; if (data.feeOnMonthDay) { data.feeOnMonthDay.push(2013); - var actDate = dateFilter(data.feeOnMonthDay,'dd MMMM'); + var actDate = dateFilter(data.feeOnMonthDay, 'dd MMMM'); scope.first.date = new Date(actDate); //to display "Repeats Every" field ,if chargeTimeType is // 'monthly fee' @@ -57,7 +57,7 @@ // 'annual fee' or 'monthly fee' scope.chargeTimeChange = function (chargeTimeType) { if (scope.formData.chargeAppliesTo === 2) { - for(var i in scope.template.chargeTimeTypeOptions) { + for (var i in scope.template.chargeTimeTypeOptions) { if (chargeTimeType === scope.template.chargeTimeTypeOptions[i].id) { if (scope.template.chargeTimeTypeOptions[i].value == "Annual Fee" || scope.template.chargeTimeTypeOptions[i].value == "Monthly Fee") { scope.showdatefield = true; @@ -74,24 +74,24 @@ } } } - scope.submit = function() { + scope.submit = function () { if (scope.formData.chargeAppliesTo === 2) { if (scope.showdatefield === true) { - var reqDate = dateFilter(scope.first.date,'dd MMMM'); + var reqDate = dateFilter(scope.first.date, 'dd MMMM'); this.formData.monthDayFormat = 'dd MMM'; - this.formData.feeOnMonthDay = reqDate; + this.formData.feeOnMonthDay = reqDate; } } this.formData.locale = scope.optlang.code; this.formData.active = this.formData.active || false; this.formData.penalty = this.formData.penalty || false; - resourceFactory.chargeResource.update({chargeId: routeParams.id},this.formData,function(data){ + resourceFactory.chargeResource.update({chargeId: routeParams.id}, this.formData, function (data) { location.path('/viewcharge/' + data.resourceId); }); }; } }); - mifosX.ng.application.controller('EditChargeController', ['$scope', 'ResourceFactory','$location','$routeParams', 'dateFilter', mifosX.controllers.EditChargeController]).run(function($log) { + mifosX.ng.application.controller('EditChargeController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditChargeController]).run(function ($log) { $log.info("EditChargeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/EditLoanProductController.js b/app/scripts/controllers/product/EditLoanProductController.js index 1b8fa982..65962d2b 100644 --- a/app/scripts/controllers/product/EditLoanProductController.js +++ b/app/scripts/controllers/product/EditLoanProductController.js @@ -1,336 +1,340 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditLoanProductController: function(scope, resourceFactory, location, routeParams,dateFilter) { - scope.formData = {}; - scope.charges = []; - scope.showOrHideValue = "show"; - scope.configureFundOptions = []; - scope.specificIncomeaccounts = []; - scope.penaltySpecificIncomeaccounts = []; - scope.configureFundOption = {}; - scope.date = {}; - scope.irFlag = false; - scope.pvFlag = false; - scope.rvFlag = false; +(function (module) { + mifosX.controllers = _.extend(module, { + EditLoanProductController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.formData = {}; + scope.charges = []; + scope.showOrHideValue = "show"; + scope.configureFundOptions = []; + scope.specificIncomeaccounts = []; + scope.penaltySpecificIncomeaccounts = []; + scope.configureFundOption = {}; + scope.date = {}; + scope.irFlag = false; + scope.pvFlag = false; + scope.rvFlag = false; - resourceFactory.loanProductResource.get({loanProductId : routeParams.id, template:'true'}, function(data) { - scope.product = data; - scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; - scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; - scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; - scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; - scope.charges = scope.product.charges || []; - if(data.startDate){scope.date.first = new Date(data.startDate);} - if(data.closeDate){scope.date.second = new Date(data.closeDate);} - scope.formData = { - name : scope.product.name, - shortName : scope.product.shortName, - description : scope.product.description, - fundId : scope.product.fundId, - description : scope.product.description, - includeInBorrowerCycle : scope.product.includeInBorrowerCycle, - useBorrowerCycle : scope.product.useBorrowerCycle, - currencyCode : scope.product.currency.code, - digitsAfterDecimal : scope.product.currency.decimalPlaces, - inMultiplesOf : scope.product.currency.inMultiplesOf, - principal : scope.product.principal, - minPrincipal : scope.product.minPrincipal, - maxPrincipal : scope.product.maxPrincipal, - numberOfRepayments : scope.product.numberOfRepayments, - minNumberOfRepayments : scope.product.minNumberOfRepayments, - maxNumberOfRepayments : scope.product.maxNumberOfRepayments, - repaymentEvery : scope.product.repaymentEvery, - repaymentFrequencyType : scope.product.repaymentFrequencyType.id, - interestRatePerPeriod : scope.product.interestRatePerPeriod, - minInterestRatePerPeriod : scope.product.minInterestRatePerPeriod, - maxInterestRatePerPeriod : scope.product.maxInterestRatePerPeriod, - interestRateFrequencyType : scope.product.interestRateFrequencyType.id, - amortizationType : scope.product.amortizationType.id, - interestType : scope.product.interestType.id, - interestCalculationPeriodType : scope.product.interestCalculationPeriodType.id, - inArrearsTolerance : scope.product.inArrearsTolerance, - transactionProcessingStrategyId : scope.product.transactionProcessingStrategyId, - graceOnPrincipalPayment : scope.product.graceOnPrincipalPayment, - graceOnInterestPayment : scope.product.graceOnInterestPayment, - graceOnInterestCharged : scope.product.graceOnInterestCharged, - accountingRule : scope.product.accountingRule.id, - principalVariationsForBorrowerCycle : [], - interestRateVariationsForBorrowerCycle : [], - numberOfRepaymentVariationsForBorrowerCycle : [], - multiDisburseLoan : scope.product.multiDisburseLoan, - maxTrancheCount : scope.product.maxTrancheCount, - outstandingLoanBalance : scope.product.outstandingLoanBalance - } + resourceFactory.loanProductResource.get({loanProductId: routeParams.id, template: 'true'}, function (data) { + scope.product = data; + scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; + scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; + scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; + scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; + scope.charges = scope.product.charges || []; + if (data.startDate) { + scope.date.first = new Date(data.startDate); + } + if (data.closeDate) { + scope.date.second = new Date(data.closeDate); + } + scope.formData = { + name: scope.product.name, + shortName: scope.product.shortName, + description: scope.product.description, + fundId: scope.product.fundId, + description: scope.product.description, + includeInBorrowerCycle: scope.product.includeInBorrowerCycle, + useBorrowerCycle: scope.product.useBorrowerCycle, + currencyCode: scope.product.currency.code, + digitsAfterDecimal: scope.product.currency.decimalPlaces, + inMultiplesOf: scope.product.currency.inMultiplesOf, + principal: scope.product.principal, + minPrincipal: scope.product.minPrincipal, + maxPrincipal: scope.product.maxPrincipal, + numberOfRepayments: scope.product.numberOfRepayments, + minNumberOfRepayments: scope.product.minNumberOfRepayments, + maxNumberOfRepayments: scope.product.maxNumberOfRepayments, + repaymentEvery: scope.product.repaymentEvery, + repaymentFrequencyType: scope.product.repaymentFrequencyType.id, + interestRatePerPeriod: scope.product.interestRatePerPeriod, + minInterestRatePerPeriod: scope.product.minInterestRatePerPeriod, + maxInterestRatePerPeriod: scope.product.maxInterestRatePerPeriod, + interestRateFrequencyType: scope.product.interestRateFrequencyType.id, + amortizationType: scope.product.amortizationType.id, + interestType: scope.product.interestType.id, + interestCalculationPeriodType: scope.product.interestCalculationPeriodType.id, + inArrearsTolerance: scope.product.inArrearsTolerance, + transactionProcessingStrategyId: scope.product.transactionProcessingStrategyId, + graceOnPrincipalPayment: scope.product.graceOnPrincipalPayment, + graceOnInterestPayment: scope.product.graceOnInterestPayment, + graceOnInterestCharged: scope.product.graceOnInterestCharged, + accountingRule: scope.product.accountingRule.id, + principalVariationsForBorrowerCycle: [], + interestRateVariationsForBorrowerCycle: [], + numberOfRepaymentVariationsForBorrowerCycle: [], + multiDisburseLoan: scope.product.multiDisburseLoan, + maxTrancheCount: scope.product.maxTrancheCount, + outstandingLoanBalance: scope.product.outstandingLoanBalance + } - _.each(scope.product.principalVariationsForBorrowerCycle, function(variation){ + _.each(scope.product.principalVariationsForBorrowerCycle, function (variation) { + scope.formData.principalVariationsForBorrowerCycle.push({ + id: variation.id, + borrowerCycleNumber: variation.borrowerCycleNumber, + valueConditionType: variation.valueConditionType.id, + minValue: variation.minValue, + maxValue: variation.maxValue, + defaultValue: variation.defaultValue + }) + }); + + _.each(scope.product.interestRateVariationsForBorrowerCycle, function (variation) { + scope.formData.interestRateVariationsForBorrowerCycle.push({ + id: variation.id, + borrowerCycleNumber: variation.borrowerCycleNumber, + valueConditionType: variation.valueConditionType.id, + minValue: variation.minValue, + maxValue: variation.maxValue, + defaultValue: variation.defaultValue + }) + }); + + _.each(scope.product.numberOfRepaymentVariationsForBorrowerCycle, function (variation) { + scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ + id: variation.id, + borrowerCycleNumber: variation.borrowerCycleNumber, + valueConditionType: variation.valueConditionType.id, + minValue: variation.minValue, + maxValue: variation.maxValue, + defaultValue: variation.defaultValue + }) + }); + + scope.setFlag(); + if (scope.formData.accountingRule == 1) { + if (scope.assetAccountOptions.length > 0) { + scope.formData.fundSourceAccountId = scope.assetAccountOptions[0].id; + } + if (scope.assetAccountOptions.length > 1) { + scope.formData.loanPortfolioAccountId = scope.assetAccountOptions[1].id; + } + if (scope.assetAccountOptions.length > 2) { + scope.formData.transfersInSuspenseAccountId = scope.assetAccountOptions[2].id; + } + if (scope.incomeAccountOptions.length > 0) { + scope.formData.interestOnLoanAccountId = scope.incomeAccountOptions[0].id; + } + if (scope.incomeAccountOptions.length > 1) { + scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[1].id; + } + if (scope.incomeAccountOptions.length > 2) { + scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[2].id; + } + if (scope.expenseAccountOptions.length > 0) { + scope.formData.writeOffAccountId = scope.expenseAccountOptions[0].id; + } + if (scope.liabilityOptions.length > 0) { + scope.formData.overpaymentLiabilityAccountId = scope.liabilityOptions[0].id; + } + } else { + scope.formData.fundSourceAccountId = scope.product.accountingMappings.fundSourceAccount.id; + scope.formData.loanPortfolioAccountId = scope.product.accountingMappings.loanPortfolioAccount.id; + scope.formData.transfersInSuspenseAccountId = scope.product.accountingMappings.transfersInSuspenseAccount.id; + scope.formData.interestOnLoanAccountId = scope.product.accountingMappings.interestOnLoanAccount.id; + scope.formData.incomeFromFeeAccountId = scope.product.accountingMappings.incomeFromFeeAccount.id; + scope.formData.incomeFromPenaltyAccountId = scope.product.accountingMappings.incomeFromPenaltyAccount.id; + scope.formData.writeOffAccountId = scope.product.accountingMappings.writeOffAccount.id; + scope.formData.overpaymentLiabilityAccountId = scope.product.accountingMappings.overpaymentLiabilityAccount.id; + + _.each(scope.product.paymentChannelToFundSourceMappings, function (fundSource) { + scope.configureFundOptions.push({ + paymentTypeId: fundSource.paymentType.id, + fundSourceAccountId: fundSource.fundSourceAccount.id, + paymentTypeOptions: scope.product.paymentTypeOptions, + assetAccountOptions: scope.assetAccountOptions + }) + }); + + _.each(scope.product.feeToIncomeAccountMappings, function (fees) { + scope.specificIncomeaccounts.push({ + chargeId: fees.charge.id, + incomeAccountId: fees.incomeAccount.id, + chargeOptions: scope.product.chargeOptions, + incomeAccountOptions: scope.incomeAccountOptions + }) + }); + + _.each(scope.product.penaltyToIncomeAccountMappings, function (penalty) { + scope.penaltySpecificIncomeaccounts.push({ + chargeId: penalty.charge.id, + incomeAccountId: penalty.incomeAccount.id, + penaltyOptions: scope.product.penaltyOptions, + incomeAccountOptions: scope.incomeAccountOptions + }) + }); + } + + }); + + scope.chargeSelected = function (chargeId) { + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + //to charge select box empty + scope.chargeId = ''; + }); + }; + + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + }; + + //advanced accounting rule + scope.showOrHide = function (showOrHideValue) { + if (showOrHideValue == "show") { + scope.showOrHideValue = 'hide'; + } + + if (showOrHideValue == "hide") { + scope.showOrHideValue = 'show'; + } + }; + + scope.addConfigureFundSource = function () { + if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && + scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { + scope.configureFundOptions.push({ + paymentTypeId: scope.product.paymentTypeOptions[0].id, + fundSourceAccountId: scope.assetAccountOptions[0].id, + paymentTypeOptions: scope.product.paymentTypeOptions, + assetAccountOptions: scope.assetAccountOptions + }); + } + }; + + scope.mapFees = function () { + if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.specificIncomeaccounts.push({ + chargeId: scope.product.chargeOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + chargeOptions: scope.product.chargeOptions, + incomeAccountOptions: scope.product.accountingMappingOptions.incomeAccountOptions + }); + } + }; + + scope.mapPenalty = function () { + if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.penaltySpecificIncomeaccounts.push({ + chargeId: scope.product.penaltyOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + penaltyOptions: scope.product.penaltyOptions, + incomeAccountOptions: scope.incomeAccountOptions + }); + } + }; + + scope.addPrincipalVariation = function () { + scope.pvFlag = true; scope.formData.principalVariationsForBorrowerCycle.push({ - id : variation.id, - borrowerCycleNumber : variation.borrowerCycleNumber, - valueConditionType : variation.valueConditionType.id, - minValue : variation.minValue, - maxValue : variation.maxValue, - defaultValue : variation.defaultValue + valueConditionType: scope.product.valueConditionTypeOptions[0].id }) - }); - - _.each(scope.product.interestRateVariationsForBorrowerCycle, function(variation){ - scope.formData.interestRateVariationsForBorrowerCycle.push({ - id : variation.id, - borrowerCycleNumber : variation.borrowerCycleNumber, - valueConditionType : variation.valueConditionType.id, - minValue : variation.minValue, - maxValue : variation.maxValue, - defaultValue : variation.defaultValue - }) - }); - - _.each(scope.product.numberOfRepaymentVariationsForBorrowerCycle, function(variation){ - scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ - id : variation.id, - borrowerCycleNumber : variation.borrowerCycleNumber, - valueConditionType : variation.valueConditionType.id, - minValue : variation.minValue, - maxValue : variation.maxValue, - defaultValue : variation.defaultValue - }) - }); - - scope.setFlag(); - if(scope.formData.accountingRule == 1){ - if (scope.assetAccountOptions.length > 0) { - scope.formData.fundSourceAccountId = scope.assetAccountOptions[0].id; - } - if (scope.assetAccountOptions.length > 1) { - scope.formData.loanPortfolioAccountId = scope.assetAccountOptions[1].id; - } - if (scope.assetAccountOptions.length > 2) { - scope.formData.transfersInSuspenseAccountId = scope.assetAccountOptions[2].id; - } - if (scope.incomeAccountOptions.length > 0) { - scope.formData.interestOnLoanAccountId = scope.incomeAccountOptions[0].id; - } - if (scope.incomeAccountOptions.length > 1) { - scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[1].id; - } - if (scope.incomeAccountOptions.length > 2) { - scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[2].id; - } - if (scope.expenseAccountOptions.length > 0) { - scope.formData.writeOffAccountId = scope.expenseAccountOptions[0].id; - } - if (scope.liabilityOptions.length > 0) { - scope.formData.overpaymentLiabilityAccountId = scope.liabilityOptions[0].id; - } - } else { - scope.formData.fundSourceAccountId = scope.product.accountingMappings.fundSourceAccount.id; - scope.formData.loanPortfolioAccountId = scope.product.accountingMappings.loanPortfolioAccount.id; - scope.formData.transfersInSuspenseAccountId = scope.product.accountingMappings.transfersInSuspenseAccount.id; - scope.formData.interestOnLoanAccountId = scope.product.accountingMappings.interestOnLoanAccount.id; - scope.formData.incomeFromFeeAccountId = scope.product.accountingMappings.incomeFromFeeAccount.id; - scope.formData.incomeFromPenaltyAccountId = scope.product.accountingMappings.incomeFromPenaltyAccount.id; - scope.formData.writeOffAccountId = scope.product.accountingMappings.writeOffAccount.id; - scope.formData.overpaymentLiabilityAccountId = scope.product.accountingMappings.overpaymentLiabilityAccount.id; - - _.each(scope.product.paymentChannelToFundSourceMappings, function(fundSource){ - scope.configureFundOptions.push({ - paymentTypeId : fundSource.paymentType.id, - fundSourceAccountId : fundSource.fundSourceAccount.id, - paymentTypeOptions : scope.product.paymentTypeOptions, - assetAccountOptions : scope.assetAccountOptions - }) - }); - - _.each(scope.product.feeToIncomeAccountMappings, function(fees){ - scope.specificIncomeaccounts.push({ - chargeId : fees.charge.id, - incomeAccountId : fees.incomeAccount.id, - chargeOptions : scope.product.chargeOptions, - incomeAccountOptions : scope.incomeAccountOptions - }) - }); - - _.each(scope.product.penaltyToIncomeAccountMappings, function(penalty){ - scope.penaltySpecificIncomeaccounts.push({ - chargeId : penalty.charge.id, - incomeAccountId : penalty.incomeAccount.id, - penaltyOptions : scope.product.penaltyOptions, - incomeAccountOptions : scope.incomeAccountOptions - }) - }); - } - - }); - - scope.chargeSelected = function(chargeId) { - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData,function(data){ - data.chargeId = data.id; - scope.charges.push(data); - //to charge select box empty - scope.chargeId = ''; - }); - }; - - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - }; - - //advanced accounting rule - scope.showOrHide = function(showOrHideValue) { - if(showOrHideValue == "show") { - scope.showOrHideValue = 'hide'; - } - - if(showOrHideValue == "hide") { - scope.showOrHideValue = 'show'; - } - }; - - scope.addConfigureFundSource = function() { - if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && - scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { - scope.configureFundOptions.push({ - paymentTypeId : scope.product.paymentTypeOptions[0].id, - fundSourceAccountId : scope.assetAccountOptions[0].id, - paymentTypeOptions : scope.product.paymentTypeOptions, - assetAccountOptions : scope.assetAccountOptions - }); - } - }; - - scope.mapFees = function() { - if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.specificIncomeaccounts.push({ - chargeId : scope.product.chargeOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - chargeOptions : scope.product.chargeOptions, - incomeAccountOptions : scope.product.accountingMappingOptions.incomeAccountOptions - }); - } - }; - - scope.mapPenalty = function() { - if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.penaltySpecificIncomeaccounts.push({ - chargeId : scope.product.penaltyOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - penaltyOptions : scope.product.penaltyOptions, - incomeAccountOptions : scope.incomeAccountOptions - }); - } - }; - - scope.addPrincipalVariation = function() { - scope.pvFlag=true; - scope.formData.principalVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }) - }; - scope.addInterestRateVariation = function() { - scope.irFlag = true; - scope.formData.interestRateVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }) - }; - scope.addNumberOfRepaymentVariation = function() { - scope.rvFlag = true; - scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ - valueConditionType : scope.product.valueConditionTypeOptions[0].id - }) - }; - - - scope.deleteFund = function(index) { - scope.configureFundOptions.splice(index,1); - }; - - scope.deleteFee = function(index) { - scope.specificIncomeaccounts.splice(index,1); - }; - - scope.deletePenalty = function(index) { - scope.penaltySpecificIncomeaccounts.splice(index,1); - }; - - scope.deletePrincipalVariation = function(index) { - scope.formData.principalVariationsForBorrowerCycle.splice(index,1); - }; - - scope.deleteInterestRateVariation = function(index) { - scope.formData.interestRateVariationsForBorrowerCycle.splice(index,1); - }; - - scope.deleterepaymentVariation = function(index) { - scope.formData.numberOfRepaymentVariationsForBorrowerCycle.splice(index,1); - }; - scope.setFlag = function(){ - if(scope.formData.principalVariationsForBorrowerCycle){ - scope.pvFlag = true; - } - if(scope.formData.numberOfRepaymentVariationsForBorrowerCycle){ - scope.rvFlag = true; - } - if(scope.formData.interestRateVariationsForBorrowerCycle){ + }; + scope.addInterestRateVariation = function () { scope.irFlag = true; - } - }; - scope.setFlag(); - scope.submit = function() { - scope.paymentChannelToFundSourceMappings = []; - scope.feeToIncomeAccountMappings = []; - scope.penaltyToIncomeAccountMappings = []; - scope.chargesSelected = []; - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var temp = ''; - //configure fund sources for payment channels - for (var i in scope.configureFundOptions) { - temp = { - paymentTypeId : scope.configureFundOptions[i].paymentTypeId, - fundSourceAccountId : scope.configureFundOptions[i].fundSourceAccountId - } - scope.paymentChannelToFundSourceMappings.push(temp); - } + scope.formData.interestRateVariationsForBorrowerCycle.push({ + valueConditionType: scope.product.valueConditionTypeOptions[0].id + }) + }; + scope.addNumberOfRepaymentVariation = function () { + scope.rvFlag = true; + scope.formData.numberOfRepaymentVariationsForBorrowerCycle.push({ + valueConditionType: scope.product.valueConditionTypeOptions[0].id + }) + }; - //map fees to specific income accounts - for (var i in scope.specificIncomeaccounts) { - temp = { - chargeId : scope.specificIncomeaccounts[i].chargeId, - incomeAccountId : scope.specificIncomeaccounts[i].incomeAccountId, - } - scope.feeToIncomeAccountMappings.push(temp); - } - //map penalties to specific income accounts - for (var i in scope.penaltySpecificIncomeaccounts) { - temp = { - chargeId : scope.penaltySpecificIncomeaccounts[i].chargeId, - incomeAccountId : scope.penaltySpecificIncomeaccounts[i].incomeAccountId, - } - scope.penaltyToIncomeAccountMappings.push(temp); - } + scope.deleteFund = function (index) { + scope.configureFundOptions.splice(index, 1); + }; - for (var i in scope.charges) { - temp = { - id : scope.charges[i].id - } - scope.chargesSelected.push(temp); - } + scope.deleteFee = function (index) { + scope.specificIncomeaccounts.splice(index, 1); + }; - this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; - this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; - this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; - this.formData.charges = scope.chargesSelected; - this.formData.dateFormat = "dd MMMM yyyy"; - this.formData.locale = "en"; - this.formData.startDate = reqFirstDate; - this.formData.closeDate = reqSecondDate; - resourceFactory.loanProductResource.put({loanProductId : routeParams.id}, this.formData,function(data){ - location.path('/viewloanproduct/' + data.resourceId); - }); + scope.deletePenalty = function (index) { + scope.penaltySpecificIncomeaccounts.splice(index, 1); + }; + + scope.deletePrincipalVariation = function (index) { + scope.formData.principalVariationsForBorrowerCycle.splice(index, 1); + }; + + scope.deleteInterestRateVariation = function (index) { + scope.formData.interestRateVariationsForBorrowerCycle.splice(index, 1); + }; + + scope.deleterepaymentVariation = function (index) { + scope.formData.numberOfRepaymentVariationsForBorrowerCycle.splice(index, 1); + }; + scope.setFlag = function () { + if (scope.formData.principalVariationsForBorrowerCycle) { + scope.pvFlag = true; + } + if (scope.formData.numberOfRepaymentVariationsForBorrowerCycle) { + scope.rvFlag = true; + } + if (scope.formData.interestRateVariationsForBorrowerCycle) { + scope.irFlag = true; + } + }; + scope.setFlag(); + scope.submit = function () { + scope.paymentChannelToFundSourceMappings = []; + scope.feeToIncomeAccountMappings = []; + scope.penaltyToIncomeAccountMappings = []; + scope.chargesSelected = []; + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var temp = ''; + //configure fund sources for payment channels + for (var i in scope.configureFundOptions) { + temp = { + paymentTypeId: scope.configureFundOptions[i].paymentTypeId, + fundSourceAccountId: scope.configureFundOptions[i].fundSourceAccountId + } + scope.paymentChannelToFundSourceMappings.push(temp); + } + + //map fees to specific income accounts + for (var i in scope.specificIncomeaccounts) { + temp = { + chargeId: scope.specificIncomeaccounts[i].chargeId, + incomeAccountId: scope.specificIncomeaccounts[i].incomeAccountId, + } + scope.feeToIncomeAccountMappings.push(temp); + } + + //map penalties to specific income accounts + for (var i in scope.penaltySpecificIncomeaccounts) { + temp = { + chargeId: scope.penaltySpecificIncomeaccounts[i].chargeId, + incomeAccountId: scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + } + scope.penaltyToIncomeAccountMappings.push(temp); + } + + for (var i in scope.charges) { + temp = { + id: scope.charges[i].id + } + scope.chargesSelected.push(temp); + } + + this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; + this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; + this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; + this.formData.charges = scope.chargesSelected; + this.formData.dateFormat = "dd MMMM yyyy"; + this.formData.locale = "en"; + this.formData.startDate = reqFirstDate; + this.formData.closeDate = reqSecondDate; + resourceFactory.loanProductResource.put({loanProductId: routeParams.id}, this.formData, function (data) { + location.path('/viewloanproduct/' + data.resourceId); + }); + } } - } - }); - mifosX.ng.application.controller('EditLoanProductController', ['$scope', 'ResourceFactory', '$location', '$routeParams','dateFilter', mifosX.controllers.EditLoanProductController]).run(function($log) { - $log.info("EditLoanProductController initialized"); - }); + }); + mifosX.ng.application.controller('EditLoanProductController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditLoanProductController]).run(function ($log) { + $log.info("EditLoanProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/EditSavingProductController.js b/app/scripts/controllers/product/EditSavingProductController.js index 84bef33e..e9ace7d3 100644 --- a/app/scripts/controllers/product/EditSavingProductController.js +++ b/app/scripts/controllers/product/EditSavingProductController.js @@ -1,249 +1,247 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditSavingProductController: function(scope, resourceFactory, location, routeParams) { - scope.formData = {}; - scope.charges = []; - scope.showOrHideValue = "show"; - scope.configureFundOptions = []; - scope.specificIncomeaccounts = []; - scope.penaltySpecificIncomeaccounts = []; - scope.configureFundOption = {}; +(function (module) { + mifosX.controllers = _.extend(module, { + EditSavingProductController: function (scope, resourceFactory, location, routeParams) { + scope.formData = {}; + scope.charges = []; + scope.showOrHideValue = "show"; + scope.configureFundOptions = []; + scope.specificIncomeaccounts = []; + scope.penaltySpecificIncomeaccounts = []; + scope.configureFundOption = {}; - resourceFactory.savingProductResource.get({savingProductId :routeParams.id, template:'true'}, function(data) { - scope.product = data; - scope.charges = data.charges; - scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; - scope.liabilityAccountOptions = scope.product.accountingMappingOptions.liabilityAccountOptions || []; - scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; - scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; - scope.formData = { - name : data.name, - shortName : data.shortName, - description : data.description, - currencyCode : data.currency.code, - digitsAfterDecimal : data.currency.decimalPlaces, - inMultiplesOf : data.currency.inMultiplesOf, - nominalAnnualInterestRate : data.nominalAnnualInterestRate, - minRequiredOpeningBalance : data.minRequiredOpeningBalance, - lockinPeriodFrequency : data.lockinPeriodFrequency, - withdrawalFeeForTransfers : data.withdrawalFeeForTransfers == true ? 'true' : 'false', - interestCompoundingPeriodType : data.interestCompoundingPeriodType.id, - interestPostingPeriodType : data.interestPostingPeriodType.id, - interestCalculationType : data.interestCalculationType.id, - interestCalculationDaysInYearType : data.interestCalculationDaysInYearType.id, - accountingRule : data.accountingRule.id, - allowOverdraft : data.allowOverdraft == true ? 'true' : 'false', - overdraftLimit : data.overdraftLimit, - } + resourceFactory.savingProductResource.get({savingProductId: routeParams.id, template: 'true'}, function (data) { + scope.product = data; + scope.charges = data.charges; + scope.assetAccountOptions = scope.product.accountingMappingOptions.assetAccountOptions || []; + scope.liabilityAccountOptions = scope.product.accountingMappingOptions.liabilityAccountOptions || []; + scope.incomeAccountOptions = scope.product.accountingMappingOptions.incomeAccountOptions || []; + scope.expenseAccountOptions = scope.product.accountingMappingOptions.expenseAccountOptions || []; + scope.formData = { + name: data.name, + shortName: data.shortName, + description: data.description, + currencyCode: data.currency.code, + digitsAfterDecimal: data.currency.decimalPlaces, + inMultiplesOf: data.currency.inMultiplesOf, + nominalAnnualInterestRate: data.nominalAnnualInterestRate, + minRequiredOpeningBalance: data.minRequiredOpeningBalance, + lockinPeriodFrequency: data.lockinPeriodFrequency, + withdrawalFeeForTransfers: data.withdrawalFeeForTransfers == true ? 'true' : 'false', + interestCompoundingPeriodType: data.interestCompoundingPeriodType.id, + interestPostingPeriodType: data.interestPostingPeriodType.id, + interestCalculationType: data.interestCalculationType.id, + interestCalculationDaysInYearType: data.interestCalculationDaysInYearType.id, + accountingRule: data.accountingRule.id, + allowOverdraft: data.allowOverdraft == true ? 'true' : 'false', + overdraftLimit: data.overdraftLimit, + } - if (data.lockinPeriodFrequencyType) { - scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; - } + if (data.lockinPeriodFrequencyType) { + scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; + } - if(scope.formData.accountingRule == 1){ + if (scope.formData.accountingRule == 1) { - if (scope.assetAccountOptions.length > 0) { - scope.formData.savingsReferenceAccountId = scope.assetAccountOptions[0].id; - } - if (scope.assetAccountOptions.length > 1) { - scope.formData.overdraftPortfolioControlId = scope.assetAccountOptions[1].id; - } - if (scope.liabilityAccountOptions.length > 0) { - scope.formData.savingsControlAccountId = scope.liabilityAccountOptions[0].id; - } - if (scope.liabilityAccountOptions.length > 1) { - scope.formData.transfersInSuspenseAccountId = scope.liabilityAccountOptions[1].id; - } - if (scope.incomeAccountOptions.length > 0) { - scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[0].id; - } - if (scope.incomeAccountOptions.length > 1) { - scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[1].id; - } - if (scope.incomeAccountOptions.length > 2) { - scope.formData.incomeFromInterestId = scope.incomeAccountOptions[2].id; - } - if (scope.expenseAccountOptions.length > 0) { - scope.formData.interestOnSavingsAccountId = scope.expenseAccountOptions[0].id; - } - if (scope.expenseAccountOptions.length > 1) { - scope.formData.writeOffAccountId = scope.expenseAccountOptions[1].id; - } - } else { - scope.formData.savingsReferenceAccountId = data.accountingMappings.savingsReferenceAccount.id; - scope.formData.savingsControlAccountId = data.accountingMappings.savingsControlAccount.id; - scope.formData.transfersInSuspenseAccountId = data.accountingMappings.transfersInSuspenseAccount.id; - scope.formData.incomeFromFeeAccountId = data.accountingMappings.incomeFromFeeAccount.id; - scope.formData.incomeFromPenaltyAccountId = data.accountingMappings.incomeFromPenaltyAccount.id; - scope.formData.interestOnSavingsAccountId = data.accountingMappings.interestOnSavingsAccount.id; - scope.formData.writeOffAccountId = data.accountingMappings.writeOffAccount.id; - scope.formData.overdraftPortfolioControlId = data.accountingMappings.overdraftPortfolioControl.id; - scope.formData.incomeFromInterestId = data.accountingMappings.incomeFromInterest.id; + if (scope.assetAccountOptions.length > 0) { + scope.formData.savingsReferenceAccountId = scope.assetAccountOptions[0].id; + } + if (scope.assetAccountOptions.length > 1) { + scope.formData.overdraftPortfolioControlId = scope.assetAccountOptions[1].id; + } + if (scope.liabilityAccountOptions.length > 0) { + scope.formData.savingsControlAccountId = scope.liabilityAccountOptions[0].id; + } + if (scope.liabilityAccountOptions.length > 1) { + scope.formData.transfersInSuspenseAccountId = scope.liabilityAccountOptions[1].id; + } + if (scope.incomeAccountOptions.length > 0) { + scope.formData.incomeFromFeeAccountId = scope.incomeAccountOptions[0].id; + } + if (scope.incomeAccountOptions.length > 1) { + scope.formData.incomeFromPenaltyAccountId = scope.incomeAccountOptions[1].id; + } + if (scope.incomeAccountOptions.length > 2) { + scope.formData.incomeFromInterestId = scope.incomeAccountOptions[2].id; + } + if (scope.expenseAccountOptions.length > 0) { + scope.formData.interestOnSavingsAccountId = scope.expenseAccountOptions[0].id; + } + if (scope.expenseAccountOptions.length > 1) { + scope.formData.writeOffAccountId = scope.expenseAccountOptions[1].id; + } + } else { + scope.formData.savingsReferenceAccountId = data.accountingMappings.savingsReferenceAccount.id; + scope.formData.savingsControlAccountId = data.accountingMappings.savingsControlAccount.id; + scope.formData.transfersInSuspenseAccountId = data.accountingMappings.transfersInSuspenseAccount.id; + scope.formData.incomeFromFeeAccountId = data.accountingMappings.incomeFromFeeAccount.id; + scope.formData.incomeFromPenaltyAccountId = data.accountingMappings.incomeFromPenaltyAccount.id; + scope.formData.interestOnSavingsAccountId = data.accountingMappings.interestOnSavingsAccount.id; + scope.formData.writeOffAccountId = data.accountingMappings.writeOffAccount.id; + scope.formData.overdraftPortfolioControlId = data.accountingMappings.overdraftPortfolioControl.id; + scope.formData.incomeFromInterestId = data.accountingMappings.incomeFromInterest.id; - _.each(scope.product.paymentChannelToFundSourceMappings, function(fundSource){ - scope.configureFundOptions.push({ - paymentTypeId : fundSource.paymentType.id, - fundSourceAccountId : fundSource.fundSourceAccount.id, - paymentTypeOptions : scope.product.paymentTypeOptions, - assetAccountOptions : scope.assetAccountOptions - }) - }); + _.each(scope.product.paymentChannelToFundSourceMappings, function (fundSource) { + scope.configureFundOptions.push({ + paymentTypeId: fundSource.paymentType.id, + fundSourceAccountId: fundSource.fundSourceAccount.id, + paymentTypeOptions: scope.product.paymentTypeOptions, + assetAccountOptions: scope.assetAccountOptions + }) + }); - _.each(scope.product.feeToIncomeAccountMappings, function(fees){ - scope.specificIncomeaccounts.push({ - chargeId : fees.charge.id, - incomeAccountId : fees.incomeAccount.id, - chargeOptions : scope.product.chargeOptions, - incomeAccountOptions : scope.incomeAccountOptions - }) - }); + _.each(scope.product.feeToIncomeAccountMappings, function (fees) { + scope.specificIncomeaccounts.push({ + chargeId: fees.charge.id, + incomeAccountId: fees.incomeAccount.id, + chargeOptions: scope.product.chargeOptions, + incomeAccountOptions: scope.incomeAccountOptions + }) + }); - _.each(scope.product.penaltyToIncomeAccountMappings, function(penalty){ - scope.penaltySpecificIncomeaccounts.push({ - chargeId : penalty.charge.id, - incomeAccountId : penalty.incomeAccount.id, - penaltyOptions : scope.product.penaltyOptions, - incomeAccountOptions : scope.incomeAccountOptions - }) - }); - } - - }); + _.each(scope.product.penaltyToIncomeAccountMappings, function (penalty) { + scope.penaltySpecificIncomeaccounts.push({ + chargeId: penalty.charge.id, + incomeAccountId: penalty.incomeAccount.id, + penaltyOptions: scope.product.penaltyOptions, + incomeAccountOptions: scope.incomeAccountOptions + }) + }); + } - //advanced accounting rule - scope.showOrHide = function(showOrHideValue) { - - if(showOrHideValue == "show") - { - scope.showOrHideValue = 'hide'; - } - - if(showOrHideValue == "hide") - { - scope.showOrHideValue = 'show'; - } - } - - scope.chargeSelected = function(chargeId) { - if (chargeId) { - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData,function(data){ - data.chargeId = data.id; - scope.charges.push(data); - //to charge select box empty - scope.chargeId = ''; }); - } - } - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - } + //advanced accounting rule + scope.showOrHide = function (showOrHideValue) { - scope.addConfigureFundSource = function() { - if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && - scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { - scope.configureFundOptions.push({ - paymentTypeId : scope.product.paymentTypeOptions[0].id, - fundSourceAccountId : scope.assetAccountOptions[0].id, - paymentTypeOptions : scope.product.paymentTypeOptions, - assetAccountOptions : scope.assetAccountOptions - }); - } - } + if (showOrHideValue == "show") { + scope.showOrHideValue = 'hide'; + } - scope.mapFees = function() { - if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.specificIncomeaccounts.push({ - chargeId : scope.product.chargeOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - chargeOptions : scope.product.chargeOptions, - incomeAccountOptions : scope.product.accountingMappingOptions.incomeAccountOptions - }); - } - } - - scope.mapPenalty = function() { - if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { - scope.penaltySpecificIncomeaccounts.push({ - chargeId : scope.product.penaltyOptions[0].id, - incomeAccountId : scope.incomeAccountOptions[0].id, - penaltyOptions : scope.product.penaltyOptions, - incomeAccountOptions : scope.incomeAccountOptions - }); - } - } - - scope.deleteFund = function(index) { - scope.configureFundOptions.splice(index,1); - } - - scope.deleteFee = function(index) { - scope.specificIncomeaccounts.splice(index,1); - } - - scope.deletePenalty = function(index) { - scope.penaltySpecificIncomeaccounts.splice(index,1); - } - - scope.cancel = function (){ - location.path('/viewsavingproduct/'+routeParams.id); - }; - - scope.submit = function() { - scope.paymentChannelToFundSourceMappings = []; - scope.feeToIncomeAccountMappings = []; - scope.penaltyToIncomeAccountMappings = []; - scope.chargesSelected = []; - - var temp = ''; - - //configure fund sources for payment channels - for (var i in scope.configureFundOptions) { - temp = { - paymentTypeId : scope.configureFundOptions[i].paymentTypeId, - fundSourceAccountId : scope.configureFundOptions[i].fundSourceAccountId + if (showOrHideValue == "hide") { + scope.showOrHideValue = 'show'; + } } - scope.paymentChannelToFundSourceMappings.push(temp); - } - //map fees to specific income accounts - for (var i in scope.specificIncomeaccounts) { - temp = { - chargeId : scope.specificIncomeaccounts[i].chargeId, - incomeAccountId : scope.specificIncomeaccounts[i].incomeAccountId, + scope.chargeSelected = function (chargeId) { + if (chargeId) { + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, this.formData, function (data) { + data.chargeId = data.id; + scope.charges.push(data); + //to charge select box empty + scope.chargeId = ''; + }); + } } - scope.feeToIncomeAccountMappings.push(temp); - } - //map penalties to specific income accounts - for (var i in scope.penaltySpecificIncomeaccounts) { - temp = { - chargeId : scope.penaltySpecificIncomeaccounts[i].chargeId, - incomeAccountId : scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); } - scope.penaltyToIncomeAccountMappings.push(temp); - } - for (var i in scope.charges) { - temp = { - id : scope.charges[i].id + scope.addConfigureFundSource = function () { + if (scope.product.paymentTypeOptions && scope.product.paymentTypeOptions.length > 0 && + scope.assetAccountOptions && scope.assetAccountOptions.length > 0) { + scope.configureFundOptions.push({ + paymentTypeId: scope.product.paymentTypeOptions[0].id, + fundSourceAccountId: scope.assetAccountOptions[0].id, + paymentTypeOptions: scope.product.paymentTypeOptions, + assetAccountOptions: scope.assetAccountOptions + }); + } } - scope.chargesSelected.push(temp); - } - this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; - this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; - this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; - this.formData.charges = scope.chargesSelected; - this.formData.locale = "en"; + scope.mapFees = function () { + if (scope.product.chargeOptions && scope.product.chargeOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.specificIncomeaccounts.push({ + chargeId: scope.product.chargeOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + chargeOptions: scope.product.chargeOptions, + incomeAccountOptions: scope.product.accountingMappingOptions.incomeAccountOptions + }); + } + } - resourceFactory.savingProductResource.update({savingProductId : routeParams.id}, this.formData,function(data){ - location.path('/viewsavingproduct/' + data.resourceId); - }); + scope.mapPenalty = function () { + if (scope.product.penaltyOptions && scope.product.penaltyOptions.length > 0 && scope.incomeAccountOptions && scope.incomeAccountOptions.length > 0) { + scope.penaltySpecificIncomeaccounts.push({ + chargeId: scope.product.penaltyOptions[0].id, + incomeAccountId: scope.incomeAccountOptions[0].id, + penaltyOptions: scope.product.penaltyOptions, + incomeAccountOptions: scope.incomeAccountOptions + }); + } + } + + scope.deleteFund = function (index) { + scope.configureFundOptions.splice(index, 1); + } + + scope.deleteFee = function (index) { + scope.specificIncomeaccounts.splice(index, 1); + } + + scope.deletePenalty = function (index) { + scope.penaltySpecificIncomeaccounts.splice(index, 1); + } + + scope.cancel = function () { + location.path('/viewsavingproduct/' + routeParams.id); + }; + + scope.submit = function () { + scope.paymentChannelToFundSourceMappings = []; + scope.feeToIncomeAccountMappings = []; + scope.penaltyToIncomeAccountMappings = []; + scope.chargesSelected = []; + + var temp = ''; + + //configure fund sources for payment channels + for (var i in scope.configureFundOptions) { + temp = { + paymentTypeId: scope.configureFundOptions[i].paymentTypeId, + fundSourceAccountId: scope.configureFundOptions[i].fundSourceAccountId + } + scope.paymentChannelToFundSourceMappings.push(temp); + } + + //map fees to specific income accounts + for (var i in scope.specificIncomeaccounts) { + temp = { + chargeId: scope.specificIncomeaccounts[i].chargeId, + incomeAccountId: scope.specificIncomeaccounts[i].incomeAccountId, + } + scope.feeToIncomeAccountMappings.push(temp); + } + + //map penalties to specific income accounts + for (var i in scope.penaltySpecificIncomeaccounts) { + temp = { + chargeId: scope.penaltySpecificIncomeaccounts[i].chargeId, + incomeAccountId: scope.penaltySpecificIncomeaccounts[i].incomeAccountId, + } + scope.penaltyToIncomeAccountMappings.push(temp); + } + + for (var i in scope.charges) { + temp = { + id: scope.charges[i].id + } + scope.chargesSelected.push(temp); + } + + this.formData.paymentChannelToFundSourceMappings = scope.paymentChannelToFundSourceMappings; + this.formData.feeToIncomeAccountMappings = scope.feeToIncomeAccountMappings; + this.formData.penaltyToIncomeAccountMappings = scope.penaltyToIncomeAccountMappings; + this.formData.charges = scope.chargesSelected; + this.formData.locale = "en"; + + resourceFactory.savingProductResource.update({savingProductId: routeParams.id}, this.formData, function (data) { + location.path('/viewsavingproduct/' + data.resourceId); + }); + } } - } - }); - mifosX.ng.application.controller('EditSavingProductController', ['$scope', 'ResourceFactory', '$location','$routeParams', mifosX.controllers.EditSavingProductController]).run(function($log) { - $log.info("EditSavingProductController initialized"); - }); + }); + mifosX.ng.application.controller('EditSavingProductController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.EditSavingProductController]).run(function ($log) { + $log.info("EditSavingProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/LoanProductController.js b/app/scripts/controllers/product/LoanProductController.js index 3821dc65..d3b9d5ce 100644 --- a/app/scripts/controllers/product/LoanProductController.js +++ b/app/scripts/controllers/product/LoanProductController.js @@ -1,19 +1,19 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - LoanProductController: function(scope, resourceFactory,location) { - scope.routeTo = function(id){ - location.path('/viewloanproduct/' + id); - }; - scope.products = []; - scope.$broadcast('LoanProductDataLoadingStartEvent'); - resourceFactory.loanProductResource.getAllLoanProducts(function(data) { - scope.loanproducts = data; - scope.$broadcast('LoanProductDataLoadingCompleteEvent'); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + LoanProductController: function (scope, resourceFactory, location) { + scope.routeTo = function (id) { + location.path('/viewloanproduct/' + id); + }; + scope.products = []; + scope.$broadcast('LoanProductDataLoadingStartEvent'); + resourceFactory.loanProductResource.getAllLoanProducts(function (data) { + scope.loanproducts = data; + scope.$broadcast('LoanProductDataLoadingCompleteEvent'); + }); - } - }); - mifosX.ng.application.controller('LoanProductController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.LoanProductController]).run(function($log) { - $log.info("LoanProductController initialized"); - }); + } + }); + mifosX.ng.application.controller('LoanProductController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.LoanProductController]).run(function ($log) { + $log.info("LoanProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/SavingProductController.js b/app/scripts/controllers/product/SavingProductController.js index eb5caa08..bfea32e7 100644 --- a/app/scripts/controllers/product/SavingProductController.js +++ b/app/scripts/controllers/product/SavingProductController.js @@ -1,17 +1,17 @@ - (function(module) { - mifosX.controllers = _.extend(module, { - SavingProductController: function(scope, resourceFactory,location) { - scope.routeTo = function(id){ - location.path('/viewsavingproduct/' + id); - }; - scope.products = []; - resourceFactory.savingProductResource.getAllSavingProducts(function(data) { - scope.savingproducts = data; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + SavingProductController: function (scope, resourceFactory, location) { + scope.routeTo = function (id) { + location.path('/viewsavingproduct/' + id); + }; + scope.products = []; + resourceFactory.savingProductResource.getAllSavingProducts(function (data) { + scope.savingproducts = data; + }); - } - }); - mifosX.ng.application.controller('SavingProductController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.SavingProductController]).run(function($log) { - $log.info("SavingProductController initialized"); - }); + } + }); + mifosX.ng.application.controller('SavingProductController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.SavingProductController]).run(function ($log) { + $log.info("SavingProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/ViewChargeController.js b/app/scripts/controllers/product/ViewChargeController.js index 4f149775..c96da62f 100644 --- a/app/scripts/controllers/product/ViewChargeController.js +++ b/app/scripts/controllers/product/ViewChargeController.js @@ -1,33 +1,33 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewChargeController: function(scope, routeParams , resourceFactory, location,$modal) { - scope.charge = []; - scope.choice = 0; - resourceFactory.chargeResource.get({chargeId: routeParams.id} , function(data) { - scope.charge = data; - }); - - scope.deleteCharge = function () { - $modal.open({ - templateUrl: 'deletech.html', - controller: ChDeleteCtrl +(function (module) { + mifosX.controllers = _.extend(module, { + ViewChargeController: function (scope, routeParams, resourceFactory, location, $modal) { + scope.charge = []; + scope.choice = 0; + resourceFactory.chargeResource.get({chargeId: routeParams.id}, function (data) { + scope.charge = data; }); - }; - var ChDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.chargeResource.delete({chargeId: routeParams.id} , {}, function(data) { - location.path('/charges'); - }); - $modalInstance.close('delete'); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - } - }); - mifosX.ng.application.controller('ViewChargeController', ['$scope', '$routeParams','ResourceFactory', '$location','$modal', mifosX.controllers.ViewChargeController]).run(function($log) { - $log.info("ViewChargeController initialized"); - }); + scope.deleteCharge = function () { + $modal.open({ + templateUrl: 'deletech.html', + controller: ChDeleteCtrl + }); + }; + var ChDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.chargeResource.delete({chargeId: routeParams.id}, {}, function (data) { + location.path('/charges'); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + } + }); + mifosX.ng.application.controller('ViewChargeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', mifosX.controllers.ViewChargeController]).run(function ($log) { + $log.info("ViewChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/ViewLoanProductController.js b/app/scripts/controllers/product/ViewLoanProductController.js index b5344637..f0684373 100644 --- a/app/scripts/controllers/product/ViewLoanProductController.js +++ b/app/scripts/controllers/product/ViewLoanProductController.js @@ -1,21 +1,21 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewLoanProductController: function(scope, routeParams , location , anchorScroll , resourceFactory ) { - scope.loanproduct = []; - scope.hasAccounting = undefined; - resourceFactory.loanProductResource.get({loanProductId: routeParams.id , template: 'true'} , function(data) { - scope.loanproduct = data; - scope.hasAccounting = data.accountingRule.id == 2 ? true : false; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewLoanProductController: function (scope, routeParams, location, anchorScroll, resourceFactory) { + scope.loanproduct = []; + scope.hasAccounting = undefined; + resourceFactory.loanProductResource.get({loanProductId: routeParams.id, template: 'true'}, function (data) { + scope.loanproduct = data; + scope.hasAccounting = data.accountingRule.id == 2 ? true : false; + }); - scope.scrollto = function (link){ + scope.scrollto = function (link) { location.hash(link); anchorScroll(); - }; - } - }); - mifosX.ng.application.controller('ViewLoanProductController', ['$scope', '$routeParams', '$location', '$anchorScroll' , 'ResourceFactory', mifosX.controllers.ViewLoanProductController]).run(function($log) { - $log.info("ViewLoanProductController initialized"); - }); + }; + } + }); + mifosX.ng.application.controller('ViewLoanProductController', ['$scope', '$routeParams', '$location', '$anchorScroll' , 'ResourceFactory', mifosX.controllers.ViewLoanProductController]).run(function ($log) { + $log.info("ViewLoanProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/ViewSavingProductController.js b/app/scripts/controllers/product/ViewSavingProductController.js index 6ad07993..e968d2f9 100644 --- a/app/scripts/controllers/product/ViewSavingProductController.js +++ b/app/scripts/controllers/product/ViewSavingProductController.js @@ -1,19 +1,19 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewSavingProductController: function(scope, routeParams , location , anchorScroll , resourceFactory ) { - resourceFactory.savingProductResource.get({savingProductId: routeParams.id , template: 'true'} , function(data) { - scope.savingproduct = data; - scope.hasAccounting = data.accountingRule.id == 2 ? true : false; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewSavingProductController: function (scope, routeParams, location, anchorScroll, resourceFactory) { + resourceFactory.savingProductResource.get({savingProductId: routeParams.id, template: 'true'}, function (data) { + scope.savingproduct = data; + scope.hasAccounting = data.accountingRule.id == 2 ? true : false; + }); - scope.scrollto = function (link){ + scope.scrollto = function (link) { location.hash(link); anchorScroll(); - }; - } - }); - mifosX.ng.application.controller('ViewSavingProductController', ['$scope', '$routeParams', '$location', '$anchorScroll' , 'ResourceFactory', mifosX.controllers.ViewSavingProductController]).run(function($log) { - $log.info("ViewSavingProductController initialized"); - }); + }; + } + }); + mifosX.ng.application.controller('ViewSavingProductController', ['$scope', '$routeParams', '$location', '$anchorScroll' , 'ResourceFactory', mifosX.controllers.ViewSavingProductController]).run(function ($log) { + $log.info("ViewSavingProductController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/productmix/AddProductMixController.js b/app/scripts/controllers/product/productmix/AddProductMixController.js index 6e4b4c87..bfd45dcf 100644 --- a/app/scripts/controllers/product/productmix/AddProductMixController.js +++ b/app/scripts/controllers/product/productmix/AddProductMixController.js @@ -1,61 +1,57 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddProductMixController: function(scope, resourceFactory, routeParams, location) { + AddProductMixController: function (scope, resourceFactory, routeParams, location) { scope.allowed = []; scope.restricted = []; scope.products = []; - resourceFactory.loanProductTemplateResource.get({isProductMixTemplate:'true'} , function(data) { + resourceFactory.loanProductTemplateResource.get({isProductMixTemplate: 'true'}, function (data) { scope.products = data.productOptions; }); - scope.productInfo = function(id){ - resourceFactory.loanProductResource.getProductmix({loanProductId:id,resourceType:'productmix',template:'true'},function(data) { + scope.productInfo = function (id) { + resourceFactory.loanProductResource.getProductmix({loanProductId: id, resourceType: 'productmix', template: 'true'}, function (data) { scope.productmix = data; scope.allowedProducts = data.allowedProducts; scope.restrictedProducts = data.restrictedProducts; }); }; - scope.restrict = function(){ - for(var i in this.allowed) - { - for(var j in scope.allowedProducts){ - if(scope.allowedProducts[j].id == this.allowed[i]) - { + scope.restrict = function () { + for (var i in this.allowed) { + for (var j in scope.allowedProducts) { + if (scope.allowedProducts[j].id == this.allowed[i]) { var temp = {}; temp.id = this.allowed[i]; temp.name = scope.allowedProducts[j].name; temp.includeInBorrowerCycle = scope.allowedProducts[j].includeInBorrowerCycle; scope.restrictedProducts.push(temp); - scope.allowedProducts.splice(j,1); + scope.allowedProducts.splice(j, 1); } } } }; - scope.allow = function(){ - for(var i in this.restricted) - { - for(var j in scope.restrictedProducts){ - if(scope.restrictedProducts[j].id == this.restricted[i]) - { + scope.allow = function () { + for (var i in this.restricted) { + for (var j in scope.restrictedProducts) { + if (scope.restrictedProducts[j].id == this.restricted[i]) { var temp = {}; temp.id = this.restricted[i]; temp.name = scope.restrictedProducts[j].name; temp.includeInBorrowerCycle = scope.restrictedProducts[j].includeInBorrowerCycle; scope.allowedProducts.push(temp); - scope.restrictedProducts.splice(j,1); + scope.restrictedProducts.splice(j, 1); } } } }; - scope.submit = function (){ + scope.submit = function () { var productId = this.formData.productId; var temp = []; var final = {}; - for(var i in scope.restrictedProducts){ + for (var i in scope.restrictedProducts) { temp[i] = scope.restrictedProducts[i].id; } final.restrictedProducts = temp; - resourceFactory.loanProductResource.save({loanProductId: productId,resourceType:'productmix'},final,function(data) { - location.path('/viewproductmix/'+data.productId); + resourceFactory.loanProductResource.save({loanProductId: productId, resourceType: 'productmix'}, final, function (data) { + location.path('/viewproductmix/' + data.productId); }); }; @@ -63,7 +59,7 @@ } }); - mifosX.ng.application.controller('AddProductMixController', ['$scope','ResourceFactory','$routeParams','$location', mifosX.controllers.AddProductMixController]).run(function($log) { + mifosX.ng.application.controller('AddProductMixController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.AddProductMixController]).run(function ($log) { $log.info("AddProductMixController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/productmix/ProductMixController.js b/app/scripts/controllers/product/productmix/ProductMixController.js index 9ad05430..3d510b15 100644 --- a/app/scripts/controllers/product/productmix/ProductMixController.js +++ b/app/scripts/controllers/product/productmix/ProductMixController.js @@ -1,16 +1,16 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ProductMixController: function(scope, resourceFactory,location) { + ProductMixController: function (scope, resourceFactory, location) { scope.productmixes = []; - scope.routeTo = function(id){ + scope.routeTo = function (id) { location.path('/viewproductmix/' + id); }; - resourceFactory.loanProductResource.getAllLoanProducts({associations:'productMixes'},function(data) { + resourceFactory.loanProductResource.getAllLoanProducts({associations: 'productMixes'}, function (data) { scope.productmixes = data; }); } }); - mifosX.ng.application.controller('ProductMixController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.ProductMixController]).run(function($log) { + mifosX.ng.application.controller('ProductMixController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.ProductMixController]).run(function ($log) { $log.info("ProductMixController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/product/productmix/ViewProductMixController.js b/app/scripts/controllers/product/productmix/ViewProductMixController.js index bb74d724..d478b896 100644 --- a/app/scripts/controllers/product/productmix/ViewProductMixController.js +++ b/app/scripts/controllers/product/productmix/ViewProductMixController.js @@ -1,11 +1,11 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewProductMixController: function(scope, resourceFactory,routeParams,location,$modal) { + ViewProductMixController: function (scope, resourceFactory, routeParams, location, $modal) { scope.productmix = []; scope.choice = 0; scope.allowed = []; scope.restricted = []; - resourceFactory.loanProductResource.getProductmix({loanProductId:routeParams.id,resourceType:'productmix'},function(data) { + resourceFactory.loanProductResource.getProductmix({loanProductId: routeParams.id, resourceType: 'productmix'}, function (data) { scope.productmix = data; scope.allowedProducts = data.allowedProducts; scope.restrictedProducts = data.restrictedProducts; @@ -19,7 +19,7 @@ }; var ProductmixDeleteCtrl = function ($scope, $modalInstance) { $scope.delete = function () { - resourceFactory.loanProductResource.delete({loanProductId:routeParams.id,resourceType:'productmix'},{},function(data) { + resourceFactory.loanProductResource.delete({loanProductId: routeParams.id, resourceType: 'productmix'}, {}, function (data) { location.path('/productmix'); }); $modalInstance.close('delete'); @@ -28,54 +28,50 @@ $modalInstance.dismiss('cancel'); }; }; - scope.restrict = function(){ - for(var i in this.allowed) - { - for(var j in scope.allowedProducts){ - if(scope.allowedProducts[j].id == this.allowed[i]) - { + scope.restrict = function () { + for (var i in this.allowed) { + for (var j in scope.allowedProducts) { + if (scope.allowedProducts[j].id == this.allowed[i]) { var temp = {}; temp.id = this.allowed[i]; temp.name = scope.allowedProducts[j].name; temp.includeInBorrowerCycle = scope.allowedProducts[j].includeInBorrowerCycle; scope.restrictedProducts.push(temp); - scope.allowedProducts.splice(j,1); + scope.allowedProducts.splice(j, 1); } } } }; - scope.allow = function(){ - for(var i in this.restricted) - { - for(var j in scope.restrictedProducts){ - if(scope.restrictedProducts[j].id == this.restricted[i]) - { + scope.allow = function () { + for (var i in this.restricted) { + for (var j in scope.restrictedProducts) { + if (scope.restrictedProducts[j].id == this.restricted[i]) { var temp = {}; temp.id = this.restricted[i]; temp.name = scope.restrictedProducts[j].name; temp.includeInBorrowerCycle = scope.restrictedProducts[j].includeInBorrowerCycle; scope.allowedProducts.push(temp); - scope.restrictedProducts.splice(j,1); + scope.restrictedProducts.splice(j, 1); } } } }; - scope.submit = function() { + scope.submit = function () { var temp = []; var final = {}; - for(var i in scope.restrictedProducts){ - temp[i] = scope.restrictedProducts[i].id; + for (var i in scope.restrictedProducts) { + temp[i] = scope.restrictedProducts[i].id; } final.restrictedProducts = temp; - resourceFactory.loanProductResource.put({loanProductId:routeParams.id,resourceType:'productmix'},final,function(data) { - location.path('/viewproductmix/'+routeParams.id); + resourceFactory.loanProductResource.put({loanProductId: routeParams.id, resourceType: 'productmix'}, final, function (data) { + location.path('/viewproductmix/' + routeParams.id); }); }; } }); - mifosX.ng.application.controller('ViewProductMixController', ['$scope', 'ResourceFactory','$routeParams','$location','$modal', mifosX.controllers.ViewProductMixController]).run(function($log) { + mifosX.ng.application.controller('ViewProductMixController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewProductMixController]).run(function ($log) { $log.info("ViewProductMixController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/reports/RunReportsController.js b/app/scripts/controllers/reports/RunReportsController.js index cb5de283..d255f369 100644 --- a/app/scripts/controllers/reports/RunReportsController.js +++ b/app/scripts/controllers/reports/RunReportsController.js @@ -1,359 +1,355 @@ -(function(module) { - mifosX.controllers = _.extend(module, { +(function (module) { + mifosX.controllers = _.extend(module, { - RunReportsController: function(scope, routeParams, resourceFactory, location, dateFilter, API_VERSION,$rootScope, $sce) { + RunReportsController: function (scope, routeParams, resourceFactory, location, dateFilter, API_VERSION, $rootScope, $sce) { - scope.isCollapsed = false; //displays options div on startup - scope.hideTable = true; //hides the results div on startup - scope.hidePentahoReport = true; //hides the results div on startup - scope.hideChart = true; - scope.piechart = false; - scope.barchart = false; - scope.formData = {}; - scope.reportParams = new Array(); - scope.reportDateParams = new Array(); - scope.reqFields = new Array(); - scope.reportData = {}; - scope.reportData.columnHeaders = []; - scope.reportData.data = []; - scope.baseURL=""; - scope.csvData = []; - scope.row = []; - scope.reportName = routeParams.name; - scope.reportType = routeParams.type; - scope.reportId = routeParams.reportId; - scope.pentahoReportParameters = []; - scope.type="pie"; + scope.isCollapsed = false; //displays options div on startup + scope.hideTable = true; //hides the results div on startup + scope.hidePentahoReport = true; //hides the results div on startup + scope.hideChart = true; + scope.piechart = false; + scope.barchart = false; + scope.formData = {}; + scope.reportParams = new Array(); + scope.reportDateParams = new Array(); + scope.reqFields = new Array(); + scope.reportData = {}; + scope.reportData.columnHeaders = []; + scope.reportData.data = []; + scope.baseURL = ""; + scope.csvData = []; + scope.row = []; + scope.reportName = routeParams.name; + scope.reportType = routeParams.type; + scope.reportId = routeParams.reportId; + scope.pentahoReportParameters = []; + scope.type = "pie"; - scope.highlight = function(id){ - var i = document.getElementById(id); - if(i.className == 'selected-row'){ - i.className = 'text-pointer'; - }else{ - i.className = 'selected-row'; - } - }; - if (scope.reportType == 'Pentaho') { - scope.formData.outputType = 'HTML'; - }; - - resourceFactory.runReportsResource.getReport({reportSource: 'FullParameterList', parameterType : true, R_reportListing: "'"+routeParams.name+"'"}, function(data){ - - for (var i in data.data ) { - var temp = { - name: data.data[i].row[0], - variable: data.data[i].row[1], - label: data.data[i].row[2], - displayType: data.data[i].row[3], - formatType: data.data[i].row[4], - defaultVal: data.data[i].row[5], - selectOne: data.data[i].row[6], - selectAll: data.data[i].row[7], - parentParameterName: data.data[i].row[8], - inputName: "R_"+ data.data[i].row[1] //model name + scope.highlight = function (id) { + var i = document.getElementById(id); + if (i.className == 'selected-row') { + i.className = 'text-pointer'; + } else { + i.className = 'selected-row'; + } }; - scope.reqFields.push(temp); - if (temp.displayType == 'select' && temp.parentParameterName == null) { - intializeParams(temp,{}); - } else if (temp.displayType == 'date') { - scope.reportDateParams.push(temp); + if (scope.reportType == 'Pentaho') { + scope.formData.outputType = 'HTML'; } - } - }); + ; - if (scope.reportType == 'Pentaho') { - resourceFactory.reportsResource.get({id:scope.reportId, fields:'reportParameters'}, function(data){ - scope.pentahoReportParameters = data.reportParameters || []; - }); - } + resourceFactory.runReportsResource.getReport({reportSource: 'FullParameterList', parameterType: true, R_reportListing: "'" + routeParams.name + "'"}, function (data) { - function getSuccuessFunction (paramData) { - var tempDataObj = new Object(); - var successFunction = function(data) { - var selectData = []; - var isExistedRecord = false; - for (var i in data.data ) { - selectData.push({id: data.data[i].row[0], name: data.data[i].row[1]}); - } - for (var i in scope.reportParams ) { - if (scope.reportParams[i].name == paramData.name) { - scope.reportParams[i].selectOptions = selectData; - isExistedRecord = true; + for (var i in data.data) { + var temp = { + name: data.data[i].row[0], + variable: data.data[i].row[1], + label: data.data[i].row[2], + displayType: data.data[i].row[3], + formatType: data.data[i].row[4], + defaultVal: data.data[i].row[5], + selectOne: data.data[i].row[6], + selectAll: data.data[i].row[7], + parentParameterName: data.data[i].row[8], + inputName: "R_" + data.data[i].row[1] //model name + }; + scope.reqFields.push(temp); + if (temp.displayType == 'select' && temp.parentParameterName == null) { + intializeParams(temp, {}); + } else if (temp.displayType == 'date') { + scope.reportDateParams.push(temp); + } + } + }); + + if (scope.reportType == 'Pentaho') { + resourceFactory.reportsResource.get({id: scope.reportId, fields: 'reportParameters'}, function (data) { + scope.pentahoReportParameters = data.reportParameters || []; + }); } - } - if (!isExistedRecord) { - paramData.selectOptions = selectData; - scope.reportParams.push(paramData); - } - }; - return successFunction; - } - function intializeParams (paramData, params) { - scope.errorStatus = undefined; - scope.errorDetails = []; - params.reportSource = paramData.name; - params.parameterType = true; - var successFunction = getSuccuessFunction(paramData); - resourceFactory.runReportsResource.getReport(params, successFunction); - } - - scope.getDependencies = function (paramData) { - for (var i = 0; i < scope.reqFields.length; i++) { - var temp = scope.reqFields[i]; - if (temp.parentParameterName == paramData.name) { - if (temp.displayType == 'select') { - var parentParamValue = this.formData[paramData.inputName]; - if (parentParamValue != undefined) { - eval("var params={};params." + paramData.inputName + "='" + parentParamValue + "';"); - intializeParams(temp, params); - } - } else if (temp.displayType == 'date') { - scope.reportDateParams.push(temp); + function getSuccuessFunction(paramData) { + var tempDataObj = new Object(); + var successFunction = function (data) { + var selectData = []; + var isExistedRecord = false; + for (var i in data.data) { + selectData.push({id: data.data[i].row[0], name: data.data[i].row[1]}); + } + for (var i in scope.reportParams) { + if (scope.reportParams[i].name == paramData.name) { + scope.reportParams[i].selectOptions = selectData; + isExistedRecord = true; + } + } + if (!isExistedRecord) { + paramData.selectOptions = selectData; + scope.reportParams.push(paramData); + } + }; + return successFunction; } - } - } - }; - scope.checkStatus = function () { - var collapsed = false; - if (scope.isCollapsed) { - collapsed = true; - } - return collapsed; - }; - - function invalidDate(checkDate) { - // validates for yyyy-mm-dd returns true if invalid, false is valid - var dateformat = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; - - if(!(dateformat.test(checkDate))) { - return true; - } else{ - var dyear = checkDate.substring(0,4); - var dmonth = checkDate.substring(5,7) - 1; - var dday = checkDate.substring(8); - - var newDate=new Date(dyear,dmonth ,dday); - return !((dday==newDate.getDate()) && (dmonth==newDate.getMonth()) && (dyear==newDate.getFullYear())); - } - } - - function removeErrors() { - var $inputs = $(':input'); - $inputs.each(function() { - $(this).removeClass("validationerror"); - }); - } - - function parameterValidationErrors() { - var tmpStartDate = ""; - var tmpEndDate = ""; - scope.errorDetails = []; - for (var i in scope.reqFields) - { - var paramDetails = scope.reqFields[i]; - - switch(paramDetails.displayType) - { - case "select": - var selectedVal = scope.formData[paramDetails.inputName]; - if (selectedVal==undefined || selectedVal == 0) - { - var fieldId = '#' + paramDetails.inputName; - $(fieldId).addClass("validationerror"); - var errorObj = new Object(); - errorObj.field = paramDetails.inputName; - errorObj.code = 'error.message.report.parameter.required'; - errorObj.args = {params:[]}; - errorObj.args.params.push({value : paramDetails.label}); - scope.errorDetails.push(errorObj); - } - break; - case "date": - var tmpDate = scope.formData[paramDetails.inputName]; - if (tmpDate==undefined || !(tmpDate > "")) - { - var fieldId = '#' + paramDetails.inputName; - $(fieldId).addClass("validationerror"); - var errorObj = new Object(); - errorObj.field = paramDetails.inputName; - errorObj.code = 'error.message.report.parameter.required'; - errorObj.args = {params:[]}; - errorObj.args.params.push({value : paramDetails.label}); - scope.errorDetails.push(errorObj); - } - if (tmpDate && invalidDate(tmpDate) == true) - { - var fieldId = '#' + paramDetails.inputName; - $(fieldId).addClass("validationerror"); - var errorObj = new Object(); - errorObj.field = paramDetails.inputName; - errorObj.code = 'error.message.report.invalid.value.for.parameter'; - errorObj.args = {params:[]}; - errorObj.args.params.push({value : paramDetails.label}); - scope.errorDetails.push(errorObj); - } - - if (paramDetails.variable == "startDate") tmpStartDate = tmpDate; - if (paramDetails.variable == "endDate") tmpEndDate = tmpDate; - break; - default: - var errorObj = new Object(); - errorObj.field = paramDetails.inputName; - errorObj.code = 'error.message.report.parameter.invalid'; - errorObj.args = {params:[]}; - errorObj.args.params.push({value : paramDetails.label}); - scope.errorDetails.push(errorObj); - break; - } - } - - if (tmpStartDate > "" && tmpEndDate > "") - { - if (tmpStartDate > tmpEndDate) - { - var errorObj = new Object(); - errorObj.field = paramDetails.inputName; - errorObj.code = 'error.message.report.incorrect.values.for.date.fields'; - errorObj.args = {params:[]}; - errorObj.args.params.push({value : paramDetails.label}); - scope.errorDetails.push(errorObj); - } - } - } - function buildReportParms() { - var paramCount = 1; - var reportParams = ""; - for (var i = 0; i < scope.reqFields.length; i++) { - var reqField = scope.reqFields[i]; - for (var j = 0; j < scope.pentahoReportParameters.length; j++) { - var tempParam = scope.pentahoReportParameters[j]; - if (reqField.name == tempParam.parameterName) { - var paramName = "R_"+tempParam.reportParameterName; - if (paramCount > 1) reportParams += "&" - reportParams += encodeURIComponent(paramName) + "=" + encodeURIComponent(scope.formData[scope.reqFields[i].inputName]); - paramCount = paramCount + 1; + function intializeParams(paramData, params) { + scope.errorStatus = undefined; + scope.errorDetails = []; + params.reportSource = paramData.name; + params.parameterType = true; + var successFunction = getSuccuessFunction(paramData); + resourceFactory.runReportsResource.getReport(params, successFunction); } - } - } - return reportParams; - } - scope.xFunction = function(){ - return function(d) { - return d.key; + + scope.getDependencies = function (paramData) { + for (var i = 0; i < scope.reqFields.length; i++) { + var temp = scope.reqFields[i]; + if (temp.parentParameterName == paramData.name) { + if (temp.displayType == 'select') { + var parentParamValue = this.formData[paramData.inputName]; + if (parentParamValue != undefined) { + eval("var params={};params." + paramData.inputName + "='" + parentParamValue + "';"); + intializeParams(temp, params); + } + } else if (temp.displayType == 'date') { + scope.reportDateParams.push(temp); + } + } + } }; - }; - scope.yFunction = function(){ - return function(d) { - return d.values; + + scope.checkStatus = function () { + var collapsed = false; + if (scope.isCollapsed) { + collapsed = true; + } + return collapsed; }; - }; - scope.setTypePie = function(){ - if(scope.type=='bar'){ - scope.type = 'pie'; + + function invalidDate(checkDate) { + // validates for yyyy-mm-dd returns true if invalid, false is valid + var dateformat = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; + + if (!(dateformat.test(checkDate))) { + return true; + } else { + var dyear = checkDate.substring(0, 4); + var dmonth = checkDate.substring(5, 7) - 1; + var dday = checkDate.substring(8); + + var newDate = new Date(dyear, dmonth, dday); + return !((dday == newDate.getDate()) && (dmonth == newDate.getMonth()) && (dyear == newDate.getFullYear())); + } } - }; - scope.setTypeBar = function(){ - if(scope.type=='pie'){ - scope.type = 'bar'; + + function removeErrors() { + var $inputs = $(':input'); + $inputs.each(function () { + $(this).removeClass("validationerror"); + }); } - }; - scope.colorFunctionPie = function() { - return function(d, i) { - return colorArrayPie[i]; + + function parameterValidationErrors() { + var tmpStartDate = ""; + var tmpEndDate = ""; + scope.errorDetails = []; + for (var i in scope.reqFields) { + var paramDetails = scope.reqFields[i]; + + switch (paramDetails.displayType) { + case "select": + var selectedVal = scope.formData[paramDetails.inputName]; + if (selectedVal == undefined || selectedVal == 0) { + var fieldId = '#' + paramDetails.inputName; + $(fieldId).addClass("validationerror"); + var errorObj = new Object(); + errorObj.field = paramDetails.inputName; + errorObj.code = 'error.message.report.parameter.required'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: paramDetails.label}); + scope.errorDetails.push(errorObj); + } + break; + case "date": + var tmpDate = scope.formData[paramDetails.inputName]; + if (tmpDate == undefined || !(tmpDate > "")) { + var fieldId = '#' + paramDetails.inputName; + $(fieldId).addClass("validationerror"); + var errorObj = new Object(); + errorObj.field = paramDetails.inputName; + errorObj.code = 'error.message.report.parameter.required'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: paramDetails.label}); + scope.errorDetails.push(errorObj); + } + if (tmpDate && invalidDate(tmpDate) == true) { + var fieldId = '#' + paramDetails.inputName; + $(fieldId).addClass("validationerror"); + var errorObj = new Object(); + errorObj.field = paramDetails.inputName; + errorObj.code = 'error.message.report.invalid.value.for.parameter'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: paramDetails.label}); + scope.errorDetails.push(errorObj); + } + + if (paramDetails.variable == "startDate") tmpStartDate = tmpDate; + if (paramDetails.variable == "endDate") tmpEndDate = tmpDate; + break; + default: + var errorObj = new Object(); + errorObj.field = paramDetails.inputName; + errorObj.code = 'error.message.report.parameter.invalid'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: paramDetails.label}); + scope.errorDetails.push(errorObj); + break; + } + } + + if (tmpStartDate > "" && tmpEndDate > "") { + if (tmpStartDate > tmpEndDate) { + var errorObj = new Object(); + errorObj.field = paramDetails.inputName; + errorObj.code = 'error.message.report.incorrect.values.for.date.fields'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: paramDetails.label}); + scope.errorDetails.push(errorObj); + } + } + } + + function buildReportParms() { + var paramCount = 1; + var reportParams = ""; + for (var i = 0; i < scope.reqFields.length; i++) { + var reqField = scope.reqFields[i]; + for (var j = 0; j < scope.pentahoReportParameters.length; j++) { + var tempParam = scope.pentahoReportParameters[j]; + if (reqField.name == tempParam.parameterName) { + var paramName = "R_" + tempParam.reportParameterName; + if (paramCount > 1) reportParams += "&" + reportParams += encodeURIComponent(paramName) + "=" + encodeURIComponent(scope.formData[scope.reqFields[i].inputName]); + paramCount = paramCount + 1; + } + } + } + return reportParams; + } + + scope.xFunction = function () { + return function (d) { + return d.key; + }; }; - }; - scope.runReport = function (){ - //clear the previous errors - scope.errorDetails = []; - removeErrors(); + scope.yFunction = function () { + return function (d) { + return d.values; + }; + }; + scope.setTypePie = function () { + if (scope.type == 'bar') { + scope.type = 'pie'; + } + }; + scope.setTypeBar = function () { + if (scope.type == 'pie') { + scope.type = 'bar'; + } + }; + scope.colorFunctionPie = function () { + return function (d, i) { + return colorArrayPie[i]; + }; + }; + scope.runReport = function () { + //clear the previous errors + scope.errorDetails = []; + removeErrors(); - //update date fields with proper dateformat - for(var i in scope.reportDateParams) { - if (scope.formData[scope.reportDateParams[i].inputName]) { - scope.formData[scope.reportDateParams[i].inputName] = dateFilter(scope.formData[scope.reportDateParams[i].inputName],'yyyy-MM-dd'); - } + //update date fields with proper dateformat + for (var i in scope.reportDateParams) { + if (scope.formData[scope.reportDateParams[i].inputName]) { + scope.formData[scope.reportDateParams[i].inputName] = dateFilter(scope.formData[scope.reportDateParams[i].inputName], 'yyyy-MM-dd'); + } + } + + //Custom validation for report parameters + parameterValidationErrors(); + + if (scope.errorDetails.length == 0) { + scope.isCollapsed = true; + switch (scope.reportType) { + case "Table": + scope.hideTable = false; + scope.hidePentahoReport = true; + scope.hideChart = true; + scope.formData.reportSource = scope.reportName; + resourceFactory.runReportsResource.getReport(scope.formData, function (data) { + scope.reportData.columnHeaders = data.columnHeaders; + scope.reportData.data = data.data; + for (var i in data.columnHeaders) { + scope.row.push(data.columnHeaders[i].columnName); + } + scope.csvData.push(scope.row); + for (var k in data.data) { + scope.csvData.push(data.data[k].row); + } + }); + break; + + case "Pentaho": + scope.hideTable = true; + scope.hidePentahoReport = false; + scope.hideChart = true; + scope.baseURL = $rootScope.hostUrl + API_VERSION + "/runreports/" + encodeURIComponent(scope.reportName); + scope.baseURL += "?output-type=" + encodeURIComponent(scope.formData.outputType) + "&tenantIdentifier=" + $rootScope.tenantIdentifier; + + var inQueryParameters = buildReportParms(); + if (inQueryParameters > "") scope.baseURL += "&" + inQueryParameters; + // allow untrusted urls for iframe http://docs.angularjs.org/error/$sce/insecurl + scope.baseURL = $sce.trustAsResourceUrl(scope.baseURL); + break; + case "Chart": + scope.hideTable = true; + scope.hidePentahoReport = true; + scope.hideChart = false; + scope.formData.reportSource = scope.reportName; + resourceFactory.runReportsResource.getReport(scope.formData, function (data) { + scope.reportData.columnHeaders = data.columnHeaders; + scope.reportData.data = data.data; + scope.chartData = []; + scope.barData = []; + var l = data.data.length; + for (var i = 0; i < l; i++) { + scope.row = {}; + scope.row.key = data.data[i].row[0]; + scope.row.values = data.data[i].row[1]; + scope.chartData.push(scope.row); + } + var x = {}; + x.key = "summary"; + x.values = []; + for (var m = 0; m < l; m++) { + var inner = [data.data[m].row[0], data.data[m].row[1]]; + x.values.push(inner); + } + scope.barData.push(x); + console.log(scope.barData); + }); + break; + default: + var errorObj = new Object(); + errorObj.field = scope.reportType; + errorObj.code = 'error.message.report.type.is.invalid'; + errorObj.args = {params: []}; + errorObj.args.params.push({value: scope.reportType}); + scope.errorDetails.push(errorObj); + break; + } + } + }; } - - //Custom validation for report parameters - parameterValidationErrors(); - - if (scope.errorDetails.length == 0) { - scope.isCollapsed=true; - switch(scope.reportType) { - case "Table": - scope.hideTable=false; - scope.hidePentahoReport = true; - scope.hideChart = true; - scope.formData.reportSource = scope.reportName; - resourceFactory.runReportsResource.getReport(scope.formData, function(data){ - scope.reportData.columnHeaders = data.columnHeaders; - scope.reportData.data = data.data; - for(var i in data.columnHeaders){ - scope.row.push(data.columnHeaders[i].columnName); - } - scope.csvData.push(scope.row); - for(var k in data.data){ - scope.csvData.push(data.data[k].row); - } - }); - break; - - case "Pentaho": - scope.hideTable=true; - scope.hidePentahoReport = false; - scope.hideChart = true; - scope.baseURL = $rootScope.hostUrl +API_VERSION + "/runreports/" + encodeURIComponent(scope.reportName); - scope.baseURL += "?output-type="+encodeURIComponent(scope.formData.outputType)+"&tenantIdentifier="+$rootScope.tenantIdentifier; - - var inQueryParameters = buildReportParms(); - if (inQueryParameters > "") scope.baseURL += "&" + inQueryParameters; - // allow untrusted urls for iframe http://docs.angularjs.org/error/$sce/insecurl - scope.baseURL = $sce.trustAsResourceUrl(scope.baseURL); - break; - case "Chart": - scope.hideTable = true; - scope.hidePentahoReport = true; - scope.hideChart = false; - scope.formData.reportSource = scope.reportName; - resourceFactory.runReportsResource.getReport(scope.formData, function(data){ - scope.reportData.columnHeaders = data.columnHeaders; - scope.reportData.data = data.data; - scope.chartData = []; - scope.barData = []; - var l = data.data.length; - for(var i=0;i 0) - { - for (var i = scope.mixtaxonomyArray.length - 1; i >= 0; i--) { - var taxonomyId = scope.mixtaxonomyArray[i]["id"]; - var mapping = ($.parseJSON(mappingJson))[''+taxonomyId]; - if (mapping != undefined) { - scope.mixtaxonomyArray[i].mapping = mapping; +(function (module) { + mifosX.controllers = _.extend(module, { + XBRLController: function (scope, resourceFactory, location, dateFilter, route, http, API_VERSION, $rootScope, localStorageService, $timeout) { + scope.offices = []; + scope.date = {}; + scope.restrictDate = new Date(); + scope.formData = {}; + scope.mixtaxonomyArray = []; + resourceFactory.xbrlMixtaxonomyResource.get(function (data) { + scope.mixtaxonomyArray = data; + http({ + method: 'GET', + url: $rootScope.hostUrl + API_VERSION + '/mixmapping' + }) + .success(function (data) { + var mappingJson = data.config; + if (mappingJson != undefined && mappingJson.length > 0) { + for (var i = scope.mixtaxonomyArray.length - 1; i >= 0; i--) { + var taxonomyId = scope.mixtaxonomyArray[i]["id"]; + var mapping = ($.parseJSON(mappingJson))['' + taxonomyId]; + if (mapping != undefined) { + scope.mixtaxonomyArray[i].mapping = mapping; + } + } - } - } + }); }); - }); - resourceFactory.accountCoaResource.getAllAccountCoas(function(data) { - scope.glaccounts = []; + resourceFactory.accountCoaResource.getAllAccountCoas(function (data) { + scope.glaccounts = []; + + for (var i = 0; i < data.length; i++) { + var glaccount = {}; + glaccount.label = "{" + data[i].glCode + "}" + " - " + data[i].name; + glaccount.value = "{" + data[i].glCode + "}"; + scope.glaccounts.push(glaccount); + } + + }); + + if (localStorageService.get('XbrlReportSaveSuccess') == 'true') { + scope.savesuccess = true; + localStorageService.remove('XbrlReportSaveSuccess'); + scope.XbrlSuccess = true; + $timeout(function () { + scope.XbrlSuccess = false; + }, 3000); - for (var i = 0; i < data.length; i++) { - var glaccount = {}; - glaccount.label = "{" + data[i].glCode + "}" + " - " + data[i].name; - glaccount.value = "{" + data[i].glCode + "}"; - scope.glaccounts.push(glaccount); } - }); - - if (localStorageService.get('XbrlReportSaveSuccess') == 'true') { - scope.savesuccess = true; - localStorageService.remove('XbrlReportSaveSuccess'); - scope.XbrlSuccess = true; - $timeout(function() { - scope.XbrlSuccess = false; - }, 3000); - + scope.isPortfolio = function (mixtaxonomy) { + if (mixtaxonomy.type === 0) { + return true; + } else { + return false; + } + }; + + scope.isBalanceSheet = function (mixtaxonomy) { + if (mixtaxonomy.type === 1) { + return true; + } else { + return false; + } + }; + + scope.isIncome = function (mixtaxonomy) { + if (mixtaxonomy.type === 2) { + return true; + } else { + return false; + } + }; + + scope.isExpense = function (mixtaxonomy) { + if (mixtaxonomy.type === 3) { + return true; + } else { + return false; + } + }; + + scope.run = function () { + scope.startDate = dateFilter(scope.date.startDate, 'yyyy-MM-dd'); + scope.endDate = dateFilter(scope.date.endDate, 'yyyy-MM-dd'); + + if (scope.startDate === undefined) { + scope.startDate = ""; + } + if (scope.endDate === undefined) { + scope.endDate = ""; + } + + http({ + method: 'GET', + url: $rootScope.hostUrl + API_VERSION + '/mixreport?startDate=' + scope.startDate + '&endDate=' + scope.endDate + }).success(function (data) { + var parser = new DOMParser(); + var xmlDoc = parser.parseFromString(data, "text/xml"); + $rootScope.xmlData = xmlDoc; + location.path('/xbrlreport'); + }); + }; + + scope.submit = function () { + var config = {}; + var serialObject = {}; + for (var i = scope.mixtaxonomyArray.length - 1; i >= 0; i--) { + var taxonomyId = scope.mixtaxonomyArray[i]["id"]; + var mapping = scope.mixtaxonomyArray[i].mapping; + config["" + taxonomyId] = mapping; + } + serialObject["config"] = JSON.stringify(config); + serialObject["identifier"] = "default"; + resourceFactory.xbrlMixMappingResource.update({}, JSON.stringify(serialObject), function (data) { + localStorageService.add('XbrlReportSaveSuccess', true); + route.reload(); + }); + }; } - - scope.isPortfolio = function (mixtaxonomy) { - if(mixtaxonomy.type === 0) { - return true; - } else { - return false; - } - }; - - scope.isBalanceSheet = function (mixtaxonomy) { - if(mixtaxonomy.type === 1) { - return true; - } else { - return false; - } - }; - - scope.isIncome = function (mixtaxonomy) { - if(mixtaxonomy.type === 2) { - return true; - } else { - return false; - } - }; - - scope.isExpense = function (mixtaxonomy) { - if(mixtaxonomy.type === 3) { - return true; - } else { - return false; - } - }; - - scope.run = function () { - scope.startDate = dateFilter(scope.date.startDate,'yyyy-MM-dd'); - scope.endDate = dateFilter(scope.date.endDate,'yyyy-MM-dd'); - - if (scope.startDate === undefined) { - scope.startDate = ""; - } - if (scope.endDate === undefined) { - scope.endDate = ""; - } - - http({ - method:'GET', - url: $rootScope.hostUrl + API_VERSION + '/mixreport?startDate='+scope.startDate+'&endDate='+scope.endDate - }).success(function(data) { - var parser = new DOMParser(); - var xmlDoc = parser.parseFromString(data, "text/xml"); - $rootScope.xmlData = xmlDoc; - location.path('/xbrlreport'); - }); - }; - - scope.submit = function() { - var config = {}; - var serialObject = {}; - for (var i = scope.mixtaxonomyArray.length - 1; i >= 0; i--) { - var taxonomyId = scope.mixtaxonomyArray[i]["id"]; - var mapping = scope.mixtaxonomyArray[i].mapping; - config[""+taxonomyId] = mapping; - } - serialObject["config"] = JSON.stringify(config); - serialObject["identifier"] = "default"; - resourceFactory.xbrlMixMappingResource.update({}, JSON.stringify(serialObject),function(data){ - localStorageService.add('XbrlReportSaveSuccess', true); - route.reload(); - }); - }; - } - }); - mifosX.ng.application.controller('XBRLController', ['$scope', 'ResourceFactory', '$location','dateFilter', '$route', '$http', 'API_VERSION', '$rootScope', - 'localStorageService', '$timeout', mifosX.controllers.XBRLController]).run(function($log) { - $log.info("XBRLController initialized"); - }); + }); + mifosX.ng.application.controller('XBRLController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', '$route', '$http', 'API_VERSION', '$rootScope', + 'localStorageService', '$timeout', mifosX.controllers.XBRLController]).run(function ($log) { + $log.info("XBRLController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/reports/XBRLReportController.js b/app/scripts/controllers/reports/XBRLReportController.js index 25ff8536..b4226d0d 100644 --- a/app/scripts/controllers/reports/XBRLReportController.js +++ b/app/scripts/controllers/reports/XBRLReportController.js @@ -1,30 +1,30 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - XBRLReportController: function(scope, resourceFactory, location, $rootScope) { - - scope.xmlData = $rootScope.xmlData; - var html=""; - $(scope.xmlData).find("*[contextRef]").each(function(i){ - var contextId = $(this).attr("contextRef"); - var context = $(scope.xmlData).find("#"+contextId).find("scenario").text(); - html += ''; - html += ''; - html += ''; - var inputId = this.tagName + "|" + contextId; - html += ''; - html += ''; - }); - $("#xbrlreport").html(html); +(function (module) { + mifosX.controllers = _.extend(module, { + XBRLReportController: function (scope, resourceFactory, location, $rootScope) { - scope.saveReport = function () { - var string = (new XMLSerializer()).serializeToString(scope.xmlData); - window.location.href='data:Application/octet-stream;Content-Disposition:attachment;filename=file.xml,'+escape(string); - }; + scope.xmlData = $rootScope.xmlData; + var html = "
TitleDimensionValue
' + this.tagName + '' + context + '
"; + $(scope.xmlData).find("*[contextRef]").each(function (i) { + var contextId = $(this).attr("contextRef"); + var context = $(scope.xmlData).find("#" + contextId).find("scenario").text(); + html += ''; + html += ''; + html += ''; + var inputId = this.tagName + "|" + contextId; + html += ''; + html += ''; + }); + $("#xbrlreport").html(html); + + scope.saveReport = function () { + var string = (new XMLSerializer()).serializeToString(scope.xmlData); + window.location.href = 'data:Application/octet-stream;Content-Disposition:attachment;filename=file.xml,' + escape(string); + }; - } - }); - mifosX.ng.application.controller('XBRLReportController', ['$scope', 'ResourceFactory', '$location','$rootScope', mifosX.controllers.XBRLReportController]).run(function($log) { - $log.info("XBRLReportController initialized"); - }); + } + }); + mifosX.ng.application.controller('XBRLReportController', ['$scope', 'ResourceFactory', '$location', '$rootScope', mifosX.controllers.XBRLReportController]).run(function ($log) { + $log.info("XBRLReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/AddNewSavingsChargeController.js b/app/scripts/controllers/savings/AddNewSavingsChargeController.js index 12661f8e..6f5c9c11 100644 --- a/app/scripts/controllers/savings/AddNewSavingsChargeController.js +++ b/app/scripts/controllers/savings/AddNewSavingsChargeController.js @@ -1,54 +1,54 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - AddNewSavingsChargeController: function (scope, resourceFactory, location, routeParams, dateFilter) { - scope.offices = []; - scope.cancelRoute = routeParams.id; - scope.date ={}; - - resourceFactory.savingsChargeResource.get({accountId : routeParams.id, resourceType : 'template'}, function (data) { - scope.chargeOptions = data.chargeOptions; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + AddNewSavingsChargeController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.offices = []; + scope.cancelRoute = routeParams.id; + scope.date = {}; - scope.chargeSelected = function (id) { - resourceFactory.chargeResource.get({chargeId : id, template : 'true'},function(data){ - scope.chargeCalculationType = data.chargeCalculationType.id; - scope.chargeTimeType = data.chargeTimeType.id; - scope.chargeDetails = data; - scope.formData.amount = data.amount; - scope.withDrawCharge = data.chargeTimeType.value === "Withdrawal Fee" ? true : false; - scope.formData.feeInterval = data.feeInterval; - if (data.chargeTimeType.value === "Annual Fee" || data.chargeTimeType.value === "Monthly Fee") { - scope.chargeTimeTypeAnnualOrMonth = true; - } - }); - }; - - scope.submit = function () { - this.formData.locale = "en"; - if (scope.withDrawCharge !== true) { - if (scope.chargeTimeTypeAnnualOrMonth === true) { - this.formData.monthDayFormat = "dd MMMM"; - if (scope.date.due) { - this.formData.feeOnMonthDay = dateFilter(scope.date.due,'dd MMMM'); - } else { - this.formData.feeOnMonthDay = ""; - } - } else { - this.formData.dateFormat = "dd MMMM yyyy"; - if (scope.date.specificduedate) { - this.formData.dueDate = dateFilter(scope.date.specificduedate,scope.df); - } else { - this.formData.dueDate = ""; - } - } - } - resourceFactory.savingsChargeResource.save({accountId : routeParams.id}, this.formData, function(data) { - location.path('/viewsavingaccount/'+routeParams.id); - }); - }; - } - }); - mifosX.ng.application.controller('AddNewSavingsChargeController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.AddNewSavingsChargeController]).run(function($log) { - $log.info("AddNewSavingsChargeController initialized"); - }); + resourceFactory.savingsChargeResource.get({accountId: routeParams.id, resourceType: 'template'}, function (data) { + scope.chargeOptions = data.chargeOptions; + }); + + scope.chargeSelected = function (id) { + resourceFactory.chargeResource.get({chargeId: id, template: 'true'}, function (data) { + scope.chargeCalculationType = data.chargeCalculationType.id; + scope.chargeTimeType = data.chargeTimeType.id; + scope.chargeDetails = data; + scope.formData.amount = data.amount; + scope.withDrawCharge = data.chargeTimeType.value === "Withdrawal Fee" ? true : false; + scope.formData.feeInterval = data.feeInterval; + if (data.chargeTimeType.value === "Annual Fee" || data.chargeTimeType.value === "Monthly Fee") { + scope.chargeTimeTypeAnnualOrMonth = true; + } + }); + }; + + scope.submit = function () { + this.formData.locale = "en"; + if (scope.withDrawCharge !== true) { + if (scope.chargeTimeTypeAnnualOrMonth === true) { + this.formData.monthDayFormat = "dd MMMM"; + if (scope.date.due) { + this.formData.feeOnMonthDay = dateFilter(scope.date.due, 'dd MMMM'); + } else { + this.formData.feeOnMonthDay = ""; + } + } else { + this.formData.dateFormat = "dd MMMM yyyy"; + if (scope.date.specificduedate) { + this.formData.dueDate = dateFilter(scope.date.specificduedate, scope.df); + } else { + this.formData.dueDate = ""; + } + } + } + resourceFactory.savingsChargeResource.save({accountId: routeParams.id}, this.formData, function (data) { + location.path('/viewsavingaccount/' + routeParams.id); + }); + }; + } + }); + mifosX.ng.application.controller('AddNewSavingsChargeController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.AddNewSavingsChargeController]).run(function ($log) { + $log.info("AddNewSavingsChargeController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/CreateSavingAccountController.js b/app/scripts/controllers/savings/CreateSavingAccountController.js index d879f86a..2ea73839 100644 --- a/app/scripts/controllers/savings/CreateSavingAccountController.js +++ b/app/scripts/controllers/savings/CreateSavingAccountController.js @@ -1,137 +1,146 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateSavingAccountController: function(scope, resourceFactory, location, routeParams, dateFilter) { - scope.products = []; - scope.fieldOfficers = []; - scope.formData = {}; - scope.restrictDate = new Date(); - scope.clientId = routeParams.clientId; - scope.groupId = routeParams.groupId; - if (routeParams.centerEntity) { - scope.centerEntity = true; - } - scope.charges = []; - scope.inparams = {}; - if (scope.clientId) {scope.inparams.clientId = scope.clientId}; - if (scope.groupId) {scope.inparams.groupId = scope.groupId}; - if (scope.centerId) {scope.inparams.centerId = scope.centerId}; +(function (module) { + mifosX.controllers = _.extend(module, { + CreateSavingAccountController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.products = []; + scope.fieldOfficers = []; + scope.formData = {}; + scope.restrictDate = new Date(); + scope.clientId = routeParams.clientId; + scope.groupId = routeParams.groupId; + if (routeParams.centerEntity) { + scope.centerEntity = true; + } + scope.charges = []; + scope.inparams = {}; + if (scope.clientId) { + scope.inparams.clientId = scope.clientId + } + ; + if (scope.groupId) { + scope.inparams.groupId = scope.groupId + } + ; + if (scope.centerId) { + scope.inparams.centerId = scope.centerId + } + ; - resourceFactory.savingsTemplateResource.get(scope.inparams, function(data) { - scope.products = data.productOptions; - scope.chargeOptions = data.chargeOptions; - scope.clientName = data.clientName; - scope.groupName = data.groupName; - }); - - scope.changeProduct =function() { - scope.inparams.productId = scope.formData.productId; - resourceFactory.savingsTemplateResource.get(scope.inparams, function(data) { + resourceFactory.savingsTemplateResource.get(scope.inparams, function (data) { + scope.products = data.productOptions; + scope.chargeOptions = data.chargeOptions; + scope.clientName = data.clientName; + scope.groupName = data.groupName; + }); - scope.data = data; - scope.charges = data.charges; + scope.changeProduct = function () { + scope.inparams.productId = scope.formData.productId; + resourceFactory.savingsTemplateResource.get(scope.inparams, function (data) { - for (var i in scope.charges) { - if (scope.charges[i].chargeTimeType.value === "Annual Fee" && scope.charges[i].feeOnMonthDay) { - scope.charges[i].feeOnMonthDay.push('2013'); - scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay,scope.df)); + scope.data = data; + scope.charges = data.charges; + + for (var i in scope.charges) { + if (scope.charges[i].chargeTimeType.value === "Annual Fee" && scope.charges[i].feeOnMonthDay) { + scope.charges[i].feeOnMonthDay.push('2013'); + scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay, scope.df)); + } + } + scope.fieldOfficers = data.fieldOfficerOptions; + scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; + scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; + scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; + /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ + //scope.formData.annualFeeAmount = data.annualFeeAmount; + scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; + scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; + scope.formData.allowOverdraft = data.allowOverdraft; + scope.formData.overdraftLimit = data.overdraftLimit; + + if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; + if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; + if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; + if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; + if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; + if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; + + }); + }; + + scope.addCharge = function (chargeId) { + scope.errorchargeevent = false; + if (chargeId) { + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, function (data) { + data.chargeId = data.id; + if (data.chargeTimeType.value == "Annual Fee") { + if (data.feeOnMonthDay) { + data.feeOnMonthDay.push(2013); + data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); + } + } else if (data.chargeTimeType.value == "Monthly Fee") { + if (data.feeOnMonthDay) { + data.feeOnMonthDay.push(2013); + data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); + } + } + scope.charges.push(data); + scope.chargeId = undefined; + }); + } else { + scope.errorchargeevent = true; + scope.labelchargeerror = "selectcharge"; } } - scope.fieldOfficers = data.fieldOfficerOptions; - scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; - scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; - scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; - /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ - //scope.formData.annualFeeAmount = data.annualFeeAmount; - scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; - scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; - scope.formData.allowOverdraft = data.allowOverdraft; - scope.formData.overdraftLimit = data.overdraftLimit; - if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; - if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; - if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; - if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; - if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; - if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + } - }); - }; + scope.submit = function () { + if (scope.date) { + this.formData.submittedOnDate = dateFilter(scope.date.submittedOnDate, scope.df); + } + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + this.formData.monthDayFormat = "dd MMM"; + this.formData.charges = []; - scope.addCharge = function(chargeId) { - scope.errorchargeevent = false; - if (chargeId) { - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, function(data){ - data.chargeId = data.id; - if (data.chargeTimeType.value == "Annual Fee") { - if (data.feeOnMonthDay) { - data.feeOnMonthDay.push(2013); - data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); - } - } else if (data.chargeTimeType.value == "Monthly Fee") { - if (data.feeOnMonthDay) { - data.feeOnMonthDay.push(2013); - data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); + if (scope.clientId) this.formData.clientId = scope.clientId; + if (scope.groupId) this.formData.groupId = scope.groupId; + if (scope.centerId) this.formData.centerId = scope.centerId; + + if (scope.charges.length > 0) { + for (var i in scope.charges) { + if (scope.charges[i].chargeTimeType.value == 'Annual Fee') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + feeOnMonthDay: dateFilter(scope.charges[i].feeOnMonthDay, 'dd MMMM')}); + } else if (scope.charges[i].chargeTimeType.value == 'Specified due date') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + dueDate: dateFilter(scope.charges[i].dueDate, scope.df)}); + } else if (scope.charges[i].chargeTimeType.value == 'Monthly Fee') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + feeOnMonthDay: dateFilter(scope.charges[i].feeOnMonthDay, 'dd MMMM'), feeInterval: scope.charges[i].feeInterval}); + } else { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount}); + } } } - scope.charges.push(data); - scope.chargeId = undefined; - }); - } else { - scope.errorchargeevent = true; - scope.labelchargeerror = "selectcharge"; - } + resourceFactory.savingsResource.save(this.formData, function (data) { + location.path('/viewsavingaccount/' + data.savingsId); + }); + }; + + scope.cancel = function () { + if (scope.clientId) { + location.path('/viewclient/' + scope.clientId); + } else if (scope.centerEntity) { + location.path('/viewcenter/' + scope.groupId); + } else { + location.path('/viewgroup/' + scope.groupId); + } + } } - - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - } - - scope.submit = function() { - if (scope.date) { - this.formData.submittedOnDate = dateFilter(scope.date.submittedOnDate,scope.df); - } - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - this.formData.monthDayFormat= "dd MMM"; - this.formData.charges = []; - - if (scope.clientId) this.formData.clientId = scope.clientId; - if (scope.groupId) this.formData.groupId = scope.groupId; - if (scope.centerId) this.formData.centerId = scope.centerId; - - if (scope.charges.length > 0) { - for (var i in scope.charges) { - if(scope.charges[i].chargeTimeType.value=='Annual Fee') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - feeOnMonthDay:dateFilter(scope.charges[i].feeOnMonthDay,'dd MMMM')}); - } else if(scope.charges[i].chargeTimeType.value=='Specified due date') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - dueDate:dateFilter(scope.charges[i].dueDate,scope.df)}); - }else if(scope.charges[i].chargeTimeType.value=='Monthly Fee') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - feeOnMonthDay:dateFilter(scope.charges[i].feeOnMonthDay,'dd MMMM'), feeInterval : scope.charges[i].feeInterval}); - } else { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount}); - } - } - } - resourceFactory.savingsResource.save(this.formData,function(data){ - location.path('/viewsavingaccount/' + data.savingsId); - }); - }; - - scope.cancel = function() { - if (scope.clientId) { - location.path('/viewclient/' + scope.clientId); - } else if(scope.centerEntity){ - location.path('/viewcenter/' + scope.groupId); - } else{ - location.path('/viewgroup/' + scope.groupId); - } - } - } - }); - mifosX.ng.application.controller('CreateSavingAccountController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.CreateSavingAccountController]).run(function($log) { - $log.info("CreateSavingAccountController initialized"); - }); + }); + mifosX.ng.application.controller('CreateSavingAccountController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.CreateSavingAccountController]).run(function ($log) { + $log.info("CreateSavingAccountController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/EditSavingAccountController.js b/app/scripts/controllers/savings/EditSavingAccountController.js index 7bb16d75..a61edd8e 100644 --- a/app/scripts/controllers/savings/EditSavingAccountController.js +++ b/app/scripts/controllers/savings/EditSavingAccountController.js @@ -1,156 +1,156 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditSavingAccountController: function(scope, resourceFactory, location, routeParams, dateFilter) { - scope.products = []; - scope.fieldOfficers = []; - scope.formData = {}; - scope.accountId = routeParams.id; - scope.charges = []; - scope.restrictDate = new Date(); - resourceFactory.savingsResource.get({accountId:scope.accountId, template:'true', associations : 'charges'}, function(data) { - scope.data = data; - scope.charges = data.charges || []; - if (scope.charges) { - for (var i in scope.charges) { - if(scope.charges[i].chargeTimeType.value=='Annual Fee') { - scope.charges[i].feeOnMonthDay.push(2013); - scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay, scope.df)); - } else if(scope.charges[i].chargeTimeType.value== "Monthly Fee") { - scope.charges[i].feeOnMonthDay.push(2013); - scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay, scope.df)); - } else if(scope.charges[i].chargeTimeType.value=='Specified due date') { - scope.charges[i].dueDate = new Date(dateFilter(scope.charges[i].dueDate, scope.df)); - } - } - } - - if (data.clientId) { - scope.formData.clientId = data.clientId; - scope.clientName = data.clientName; - } - if (data.groupId) { - scope.formData.groupId = data.groupId; - scope.groupName = data.groupName; - } - scope.formData.productId = data.savingsProductId; - scope.products = data.productOptions; - if(data.fieldOfficerId != 0)scope.formData.fieldOfficerId = data.fieldOfficerId; - if(data.timeline) { - var submittedOnDate = dateFilter(data.timeline.submittedOnDate, scope.df); - scope.formData.submittedOnDate = new Date(submittedOnDate); - } - scope.fieldOfficers = data.fieldOfficerOptions; - scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; - scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; - scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; - /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ - //scope.formData.annualFeeAmount = data.annualFeeAmount; - scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; - scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; - scope.formData.allowOverdraft = data.allowOverdraft; - scope.formData.overdraftLimit = data.overdraftLimit; - - if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; - if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; - if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; - if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; - if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; - if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; - - }); - - scope.changeProduct =function() { - var inparams = {productId : scope.formData.productId}; - if (scope.formData.clientId) inparams.clientId = scope.formData.clientId; - if (scope.formData.groupId) inparams.groupId = scope.formData.groupId; - resourceFactory.savingsTemplateResource.get(inparams, function(data) { - - scope.data = data; - - scope.fieldOfficers = data.fieldOfficerOptions; - scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; - scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; - scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; - /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ - //scope.formData.annualFeeAmount = data.annualFeeAmount; - scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; - scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; - - if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; - if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; - if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; - if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; - if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; - if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; - - }); - } - - scope.addCharge = function(chargeId) { - scope.errorchargeevent = false; - if (chargeId) { - resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, function(data){ - data.chargeId = data.id; - if (data.chargeTimeType.value == "Annual Fee") { - if (data.feeOnMonthDay) { - data.feeOnMonthDay.push(2013); - data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); - } - } else if (data.chargeTimeType.value == "Monthly Fee") { - if (data.feeOnMonthDay) { - data.feeOnMonthDay.push(2013); - data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); +(function (module) { + mifosX.controllers = _.extend(module, { + EditSavingAccountController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.products = []; + scope.fieldOfficers = []; + scope.formData = {}; + scope.accountId = routeParams.id; + scope.charges = []; + scope.restrictDate = new Date(); + resourceFactory.savingsResource.get({accountId: scope.accountId, template: 'true', associations: 'charges'}, function (data) { + scope.data = data; + scope.charges = data.charges || []; + if (scope.charges) { + for (var i in scope.charges) { + if (scope.charges[i].chargeTimeType.value == 'Annual Fee') { + scope.charges[i].feeOnMonthDay.push(2013); + scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay, scope.df)); + } else if (scope.charges[i].chargeTimeType.value == "Monthly Fee") { + scope.charges[i].feeOnMonthDay.push(2013); + scope.charges[i].feeOnMonthDay = new Date(dateFilter(scope.charges[i].feeOnMonthDay, scope.df)); + } else if (scope.charges[i].chargeTimeType.value == 'Specified due date') { + scope.charges[i].dueDate = new Date(dateFilter(scope.charges[i].dueDate, scope.df)); + } } } - delete data.id; - scope.charges.push(data); - scope.chargeId = undefined; + if (data.clientId) { + scope.formData.clientId = data.clientId; + scope.clientName = data.clientName; + } + if (data.groupId) { + scope.formData.groupId = data.groupId; + scope.groupName = data.groupName; + } + scope.formData.productId = data.savingsProductId; + scope.products = data.productOptions; + if (data.fieldOfficerId != 0)scope.formData.fieldOfficerId = data.fieldOfficerId; + if (data.timeline) { + var submittedOnDate = dateFilter(data.timeline.submittedOnDate, scope.df); + scope.formData.submittedOnDate = new Date(submittedOnDate); + } + scope.fieldOfficers = data.fieldOfficerOptions; + scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; + scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; + scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; + /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ + //scope.formData.annualFeeAmount = data.annualFeeAmount; + scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; + scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; + scope.formData.allowOverdraft = data.allowOverdraft; + scope.formData.overdraftLimit = data.overdraftLimit; + + if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; + if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; + if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; + if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; + if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; + if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; + }); - } else { - scope.errorchargeevent = true; - scope.labelchargeerror = "selectcharge"; - } - } - scope.deleteCharge = function(index) { - scope.charges.splice(index,1); - } - - scope.cancel = function() { - location.path('/viewsavingaccount/' +scope.accountId); - } + scope.changeProduct = function () { + var inparams = {productId: scope.formData.productId}; + if (scope.formData.clientId) inparams.clientId = scope.formData.clientId; + if (scope.formData.groupId) inparams.groupId = scope.formData.groupId; + resourceFactory.savingsTemplateResource.get(inparams, function (data) { - scope.submit = function() { - if(this.formData.submittedOnDate) this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate,scope.df); - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - this.formData.monthDayFormat= "dd MMM"; - scope.formData.charges = []; - if (scope.charges.length > 0) { - for (var i in scope.charges) { - if(scope.charges[i].chargeTimeType.value=='Annual Fee') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - feeOnMonthDay:dateFilter(scope.charges[i].feeOnMonthDay,'dd MMMM')}); - } else if(scope.charges[i].chargeTimeType.value=='Specified due date') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - dueDate:dateFilter(scope.charges[i].dueDate,scope.df)}); - }else if(scope.charges[i].chargeTimeType.value=='Monthly Fee') { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount, - feeOnMonthDay:dateFilter(scope.charges[i].feeOnMonthDay,'dd MMMM'), feeInterval : scope.charges[i].feeInterval}); - } else { - this.formData.charges.push({ chargeId:scope.charges[i].chargeId, amount:scope.charges[i].amount}); - } - } - } + scope.data = data; - resourceFactory.savingsResource.update({'accountId': scope.accountId}, this.formData, function(data){ - location.path('/viewsavingaccount/' + data.savingsId); - }); - }; - } - }); - mifosX.ng.application.controller('EditSavingAccountController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditSavingAccountController]).run(function($log) { - $log.info("EditSavingAccountController initialized"); - }); + scope.fieldOfficers = data.fieldOfficerOptions; + scope.formData.nominalAnnualInterestRate = data.nominalAnnualInterestRate; + scope.formData.minRequiredOpeningBalance = data.minRequiredOpeningBalance; + scope.formData.lockinPeriodFrequency = data.lockinPeriodFrequency; + /* FIX-ME: uncomment annualFeeAmount when datepicker avialable, because it depends on the date field 'annualFeeOnMonthDay'*/ + //scope.formData.annualFeeAmount = data.annualFeeAmount; + scope.formData.withdrawalFeeAmount = data.withdrawalFeeAmount; + scope.formData.withdrawalFeeForTransfers = data.withdrawalFeeForTransfers; + + if (data.interestCompoundingPeriodType) scope.formData.interestCompoundingPeriodType = data.interestCompoundingPeriodType.id; + if (data.interestPostingPeriodType) scope.formData.interestPostingPeriodType = data.interestPostingPeriodType.id; + if (data.interestCalculationType) scope.formData.interestCalculationType = data.interestCalculationType.id; + if (data.interestCalculationDaysInYearType) scope.formData.interestCalculationDaysInYearType = data.interestCalculationDaysInYearType.id; + if (data.lockinPeriodFrequencyType) scope.formData.lockinPeriodFrequencyType = data.lockinPeriodFrequencyType.id; + if (data.withdrawalFeeType) scope.formData.withdrawalFeeType = data.withdrawalFeeType.id; + + }); + } + + scope.addCharge = function (chargeId) { + scope.errorchargeevent = false; + if (chargeId) { + resourceFactory.chargeResource.get({chargeId: chargeId, template: 'true'}, function (data) { + data.chargeId = data.id; + if (data.chargeTimeType.value == "Annual Fee") { + if (data.feeOnMonthDay) { + data.feeOnMonthDay.push(2013); + data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); + } + } else if (data.chargeTimeType.value == "Monthly Fee") { + if (data.feeOnMonthDay) { + data.feeOnMonthDay.push(2013); + data.feeOnMonthDay = new Date(dateFilter(data.feeOnMonthDay, scope.df)); + } + } + + delete data.id; + scope.charges.push(data); + scope.chargeId = undefined; + }); + } else { + scope.errorchargeevent = true; + scope.labelchargeerror = "selectcharge"; + } + } + + scope.deleteCharge = function (index) { + scope.charges.splice(index, 1); + } + + scope.cancel = function () { + location.path('/viewsavingaccount/' + scope.accountId); + } + + scope.submit = function () { + if (this.formData.submittedOnDate) this.formData.submittedOnDate = dateFilter(this.formData.submittedOnDate, scope.df); + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + this.formData.monthDayFormat = "dd MMM"; + scope.formData.charges = []; + if (scope.charges.length > 0) { + for (var i in scope.charges) { + if (scope.charges[i].chargeTimeType.value == 'Annual Fee') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + feeOnMonthDay: dateFilter(scope.charges[i].feeOnMonthDay, 'dd MMMM')}); + } else if (scope.charges[i].chargeTimeType.value == 'Specified due date') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + dueDate: dateFilter(scope.charges[i].dueDate, scope.df)}); + } else if (scope.charges[i].chargeTimeType.value == 'Monthly Fee') { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount, + feeOnMonthDay: dateFilter(scope.charges[i].feeOnMonthDay, 'dd MMMM'), feeInterval: scope.charges[i].feeInterval}); + } else { + this.formData.charges.push({ chargeId: scope.charges[i].chargeId, amount: scope.charges[i].amount}); + } + } + } + + resourceFactory.savingsResource.update({'accountId': scope.accountId}, this.formData, function (data) { + location.path('/viewsavingaccount/' + data.savingsId); + }); + }; + } + }); + mifosX.ng.application.controller('EditSavingAccountController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditSavingAccountController]).run(function ($log) { + $log.info("EditSavingAccountController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/SavingAccountActionsController.js b/app/scripts/controllers/savings/SavingAccountActionsController.js index 0cf3a566..64a52fe5 100644 --- a/app/scripts/controllers/savings/SavingAccountActionsController.js +++ b/app/scripts/controllers/savings/SavingAccountActionsController.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - SavingAccountActionsController: function(scope, resourceFactory, location, routeParams, dateFilter) { + SavingAccountActionsController: function (scope, resourceFactory, location, routeParams, dateFilter) { scope.action = routeParams.action || ""; scope.accountId = routeParams.id; @@ -9,7 +9,7 @@ scope.restrictDate = new Date(); // Transaction UI Related scope.isTransaction = false; - scope.showPaymentDetails =false; + scope.showPaymentDetails = false; scope.paymentTypes = []; switch (scope.action) { @@ -47,8 +47,8 @@ scope.showNoteField = false; break; case "deposit": - resourceFactory.savingsTrxnsTemplateResource.get({savingsId:scope.accountId, command:'deposit'}, function (data) { - scope.paymentTypes=data.paymentTypeOptions; + resourceFactory.savingsTrxnsTemplateResource.get({savingsId: scope.accountId, command: 'deposit'}, function (data) { + scope.paymentTypes = data.paymentTypeOptions; }); scope.title = 'label.heading.depositmoneytosavingaccount'; scope.labelName = 'label.input.transactiondate'; @@ -59,8 +59,8 @@ scope.showPaymentDetails = false; break; case "withdrawal": - resourceFactory.savingsTrxnsTemplateResource.get({savingsId:scope.accountId, command:'withdrawal'}, function (data) { - scope.paymentTypes=data.paymentTypeOptions; + resourceFactory.savingsTrxnsTemplateResource.get({savingsId: scope.accountId, command: 'withdrawal'}, function (data) { + scope.paymentTypes = data.paymentTypeOptions; }); scope.title = 'label.heading.withdrawmoneyfromsavingaccount'; scope.labelName = 'label.input.transactiondate'; @@ -71,7 +71,7 @@ scope.showPaymentDetails = false; break; case "applyAnnualFees": - resourceFactory.savingsResource.get({accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, + resourceFactory.savingsResource.get({accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, function (data) { scope.formData.amount = data.amount; if (data.dueDate) { @@ -95,13 +95,13 @@ scope.showNoteField = true; break; case "modifytransaction": - resourceFactory.savingsTrxnsResource.get({savingsId:scope.accountId, transactionId:routeParams.transactionId, template:'true'}, + resourceFactory.savingsTrxnsResource.get({savingsId: scope.accountId, transactionId: routeParams.transactionId, template: 'true'}, function (data) { scope.title = 'label.heading.editsavingaccounttransaction'; scope.labelName = 'label.input.transactiondate'; scope.modelName = 'transactionDate'; scope.formData[scope.modelName] = new Date(data.date) || new Date(); - scope.paymentTypes=data.paymentTypeOptions; + scope.paymentTypes = data.paymentTypeOptions; scope.formData.transactionAmount = data.amount; if (data.paymentDetailData) { if (data.paymentDetailData.paymentType) { @@ -120,7 +120,7 @@ scope.showPaymentDetails = false; break; case "editsavingcharge": - resourceFactory.savingsResource.get({accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, + resourceFactory.savingsResource.get({accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, function (data) { scope.formData.amount = data.amount; if (data.feeOnMonthDay) { @@ -150,8 +150,8 @@ break; case "paycharge": scope.formData.dueDate = new Date(); - resourceFactory.savingsResource.get({accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, - command : 'paycharge'}, function (data) { + resourceFactory.savingsResource.get({accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, + command: 'paycharge'}, function (data) { scope.formData.amount = data.amountOutstanding; }); scope.labelName = 'label.amount'; @@ -168,8 +168,8 @@ location.path('/viewsavingaccount/' + routeParams.id); }; - scope.submit = function() { - var params = {command:scope.action}; + scope.submit = function () { + var params = {command: scope.action}; if (scope.action != "undoapproval") { this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; @@ -177,17 +177,17 @@ if (scope.action == "deposit" || scope.action == "withdrawal" || scope.action == "modifytransaction") { if (scope.action == "withdrawal") { if (this.formData.transactionDate) { - this.formData.transactionDate = dateFilter(this.formData.transactionDate,scope.df); + this.formData.transactionDate = dateFilter(this.formData.transactionDate, scope.df); } } else if (scope.action == "deposit") { if (this.formData.transactionDate) { - this.formData.transactionDate = dateFilter(this.formData.transactionDate,scope.df); + this.formData.transactionDate = dateFilter(this.formData.transactionDate, scope.df); } } if (scope.action == "modifytransaction") { params.command = 'modify'; if (this.formData.transactionDate) { - this.formData.transactionDate = dateFilter(this.formData.transactionDate,scope.df); + this.formData.transactionDate = dateFilter(this.formData.transactionDate, scope.df); } params.transactionId = routeParams.transactionId; } @@ -197,54 +197,54 @@ }); } else if (scope.action == "editsavingcharge") { if (this.formData.feeOnMonthDayFullDate) { - this.formData.feeOnMonthDay = dateFilter(this.formData.feeOnMonthDayFullDate,scope.df); + this.formData.feeOnMonthDay = dateFilter(this.formData.feeOnMonthDayFullDate, scope.df); this.formData.monthDayFormat = "dd MMM"; this.formData.feeOnMonthDay = this.formData.feeOnMonthDay.substring(0, this.formData.feeOnMonthDay.length - 5); delete this.formData.feeOnMonthDayFullDate; } - resourceFactory.savingsResource.update({accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, this.formData, + resourceFactory.savingsResource.update({accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, this.formData, function (data) { location.path('/viewsavingaccount/' + data.savingsId); }); } else if (scope.action == "deletesavingcharge") { - resourceFactory.savingsResource.delete({accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId}, this.formData, + resourceFactory.savingsResource.delete({accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId}, this.formData, function (data) { location.path('/viewsavingaccount/' + data.savingsId); }); } else if (scope.action == "paycharge" || scope.action == "waive") { - params = {accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, command : scope.action}; + params = {accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, command: scope.action}; if (this.formData.dueDate) { - this.formData.dueDate = dateFilter(this.formData.dueDate,scope.df); + this.formData.dueDate = dateFilter(this.formData.dueDate, scope.df); } resourceFactory.savingsResource.save(params, this.formData, function (data) { location.path('/viewsavingaccount/' + data.savingsId); }); } else { - params.accountId=scope.accountId; + params.accountId = scope.accountId; if (scope.action == "approve") { if (this.formData.approvedOnDate) { - this.formData.approvedOnDate = dateFilter(this.formData.approvedOnDate,scope.df); + this.formData.approvedOnDate = dateFilter(this.formData.approvedOnDate, scope.df); } } else if (scope.action == "withdrawnByApplicant") { if (this.formData.withdrawnOnDate) { - this.formData.withdrawnOnDate = dateFilter(this.formData.withdrawnOnDate,scope.df); + this.formData.withdrawnOnDate = dateFilter(this.formData.withdrawnOnDate, scope.df); } - }else if (scope.action == "reject") { + } else if (scope.action == "reject") { if (this.formData.rejectedOnDate) { - this.formData.rejectedOnDate = dateFilter(this.formData.rejectedOnDate,scope.df); + this.formData.rejectedOnDate = dateFilter(this.formData.rejectedOnDate, scope.df); } } else if (scope.action == "activate") { if (this.formData.activatedOnDate) { - this.formData.activatedOnDate = dateFilter(this.formData.activatedOnDate,scope.df); + this.formData.activatedOnDate = dateFilter(this.formData.activatedOnDate, scope.df); } } else if (scope.action == "applyAnnualFees" || scope.action == "paycharge" || scope.action == "waivecharge") { - params = {accountId : routeParams.id, resourceType : 'charges', chargeId : routeParams.chargeId, command : 'paycharge'}; + params = {accountId: routeParams.id, resourceType: 'charges', chargeId: routeParams.chargeId, command: 'paycharge'}; if (this.formData.dueDate) { - this.formData.dueDate = dateFilter(this.formData.dueDate,scope.df); + this.formData.dueDate = dateFilter(this.formData.dueDate, scope.df); } } else if (scope.action == "close") { if (this.formData.closedOnDate) { - this.formData.closedOnDate = dateFilter(this.formData.closedOnDate,scope.df); + this.formData.closedOnDate = dateFilter(this.formData.closedOnDate, scope.df); } } @@ -255,7 +255,7 @@ }; } }); - mifosX.ng.application.controller('SavingAccountActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.SavingAccountActionsController]).run(function($log) { + mifosX.ng.application.controller('SavingAccountActionsController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.SavingAccountActionsController]).run(function ($log) { $log.info("SavingAccountActionsController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/ViewSavingDetailsController.js b/app/scripts/controllers/savings/ViewSavingDetailsController.js index 06424bed..f0102268 100644 --- a/app/scripts/controllers/savings/ViewSavingDetailsController.js +++ b/app/scripts/controllers/savings/ViewSavingDetailsController.js @@ -1,215 +1,223 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewSavingDetailsController: function(scope, routeParams, resourceFactory, location, route,dateFilter) { - scope.isDebit = function (savingsTransactionType) { - return savingsTransactionType.withdrawal == true || savingsTransactionType.feeDeduction == true; - }; +(function (module) { + mifosX.controllers = _.extend(module, { + ViewSavingDetailsController: function (scope, routeParams, resourceFactory, location, route, dateFilter) { + scope.isDebit = function (savingsTransactionType) { + return savingsTransactionType.withdrawal == true || savingsTransactionType.feeDeduction == true; + }; - scope.clickEvent = function(eventName, accountId) { - eventName = eventName || ""; - switch (eventName) { - case "modifyapplication": - location.path('/editsavingaccount/' + accountId); - break; - case "approve": - location.path('/savingaccount/' + accountId + '/approve'); - break; - case "reject": - location.path('/savingaccount/' + accountId + '/reject'); - break; - case "withdrawnbyclient": - location.path('/savingaccount/' + accountId + '/withdrawnByApplicant'); - break; - case "delete": - resourceFactory.savingsResource.delete({accountId:accountId}, {}, function(data){ - var destination = '/viewgroup/' + data.groupId; - if (data.clientId) destination = '/viewclient/' + data.clientId; - location.path(destination); - }); - break; - case "undoapproval": - location.path('/savingaccount/' + accountId + '/undoapproval'); - break; - case "activate": - location.path('/savingaccount/' + accountId + '/activate'); - break; - case "deposit": - location.path('/savingaccount/' + accountId + '/deposit'); - break; - case "withdraw": - location.path('/savingaccount/' + accountId + '/withdrawal'); - break; - case "addcharge": - location.path('/savingaccounts/' + accountId + '/charges'); - break; - case "calculateInterest": - resourceFactory.savingsResource.save({accountId:accountId,command:'calculateInterest'}, {}, function(data){ - route.reload(); - }); - break; - case "postInterest": - resourceFactory.savingsResource.save({accountId:accountId,command:'postInterest'}, {}, function(data){ - route.reload(); - }); - break; - case "applyAnnualFees": - location.path('/savingaccountcharge/' + accountId + '/applyAnnualFees/' + scope.annualChargeId); - break; - case "transferFunds": - if (scope.savingaccountdetails.clientId) { - location.path('/accounttransfers/fromsavings/'+accountId); - } - break; - case "close": - location.path('/savingaccount/' + accountId + '/close'); - break; - } - }; - - resourceFactory.savingsResource.get({accountId: routeParams.id, associations: 'all'}, function(data) { - scope.savingaccountdetails = data; - scope.status = data.status.value; - if(scope.status=="Submitted and pending approval" || scope.status=="Active" || scope.status=="Approved" ){ - scope.choice = true; - } - scope.chargeAction = data.status.value == "Submitted and pending approval" ? true : false; - if(scope.savingaccountdetails.charges) { - scope.charges = scope.savingaccountdetails.charges; - scope.chargeTableShow = true; - } else { - scope.chargeTableShow = false; - } - if (data.status.value == "Submitted and pending approval") { - scope.buttons = { singlebuttons : [{ - name:"button.modifyapplication", - icon :"icon-pencil " - }, - { - name:"button.approve", - icon :"icon-ok-sign" - }], - options: [{ - name:"button.reject" - }, - { - name:"button.withdrawnbyclient" - }, - { - name:"button.addcharge" - }, - { - name:"button.delete" - }] - }; - } - - if (data.status.value == "Approved") { - scope.buttons = { singlebuttons : [{ - name:"button.undoapproval", - icon :"icon-undo" - }, - { - name:"button.activate", - icon :"icon-ok-sign" - } - ] - }; - } - - if (data.status.value == "Active") { - scope.buttons = { singlebuttons : [{ - name:"button.deposit", - icon :"icon-arrow-right" - }, - { - name:"button.withdraw", - icon :"icon-arrow-left" - }, - { - name:"button.calculateInterest", - icon :"icon-table" - } - ], - options: [{ - name:"button.postInterest" - }, - { - name:"button.addcharge" - }, - { - name:"button.close" - }] - - }; - if (data.clientId) { - scope.buttons.options.push({ - name:"button.transferFunds" - }); - } - if(data.charges) { - for (var i in scope.charges) { - if(scope.charges[i].name == "Annual fee - INR") { - scope.buttons.options.push({ - name:"button.applyAnnualFees" - }); - scope.annualChargeId = scope.charges[i].id; - } - } - } - } - var annualdueDate = []; - annualdueDate = data.annualFee.feeOnMonthDay; - annualdueDate.push(2013); - scope.annualdueDate = new Date(annualdueDate); - }); - - resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_savings_account'} , function(data) { - scope.savingdatatables = data; - }); - - scope.dataTableChange = function(datatable) { - resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, - entityId: routeParams.id, genericResultSet: 'true'} , function(data) { - scope.datatabledetails = data; - scope.datatabledetails.isData = data.data.length > 0 ? true : false; - scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; - scope.singleRow = []; - for(var i in data.columnHeaders) { - if (scope.datatabledetails.columnHeaders[i].columnCode) { - for (var j in scope.datatabledetails.columnHeaders[i].columnValues){ - for(var k in data.data) { - if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { - data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; - } + scope.clickEvent = function (eventName, accountId) { + eventName = eventName || ""; + switch (eventName) { + case "modifyapplication": + location.path('/editsavingaccount/' + accountId); + break; + case "approve": + location.path('/savingaccount/' + accountId + '/approve'); + break; + case "reject": + location.path('/savingaccount/' + accountId + '/reject'); + break; + case "withdrawnbyclient": + location.path('/savingaccount/' + accountId + '/withdrawnByApplicant'); + break; + case "delete": + resourceFactory.savingsResource.delete({accountId: accountId}, {}, function (data) { + var destination = '/viewgroup/' + data.groupId; + if (data.clientId) destination = '/viewclient/' + data.clientId; + location.path(destination); + }); + break; + case "undoapproval": + location.path('/savingaccount/' + accountId + '/undoapproval'); + break; + case "activate": + location.path('/savingaccount/' + accountId + '/activate'); + break; + case "deposit": + location.path('/savingaccount/' + accountId + '/deposit'); + break; + case "withdraw": + location.path('/savingaccount/' + accountId + '/withdrawal'); + break; + case "addcharge": + location.path('/savingaccounts/' + accountId + '/charges'); + break; + case "calculateInterest": + resourceFactory.savingsResource.save({accountId: accountId, command: 'calculateInterest'}, {}, function (data) { + route.reload(); + }); + break; + case "postInterest": + resourceFactory.savingsResource.save({accountId: accountId, command: 'postInterest'}, {}, function (data) { + route.reload(); + }); + break; + case "applyAnnualFees": + location.path('/savingaccountcharge/' + accountId + '/applyAnnualFees/' + scope.annualChargeId); + break; + case "transferFunds": + if (scope.savingaccountdetails.clientId) { + location.path('/accounttransfers/fromsavings/' + accountId); + } + break; + case "close": + location.path('/savingaccount/' + accountId + '/close'); + break; } - } - } - } - if(scope.datatabledetails.isData){ - for(var i in data.columnHeaders){ - if(!scope.datatabledetails.isMultirow){ - var row = {}; - row.key = data.columnHeaders[i].columnName; - row.value = data.data[0].row[i]; - scope.singleRow.push(row); + }; + + resourceFactory.savingsResource.get({accountId: routeParams.id, associations: 'all'}, function (data) { + scope.savingaccountdetails = data; + scope.status = data.status.value; + if (scope.status == "Submitted and pending approval" || scope.status == "Active" || scope.status == "Approved") { + scope.choice = true; + } + scope.chargeAction = data.status.value == "Submitted and pending approval" ? true : false; + if (scope.savingaccountdetails.charges) { + scope.charges = scope.savingaccountdetails.charges; + scope.chargeTableShow = true; + } else { + scope.chargeTableShow = false; + } + if (data.status.value == "Submitted and pending approval") { + scope.buttons = { singlebuttons: [ + { + name: "button.modifyapplication", + icon: "icon-pencil " + }, + { + name: "button.approve", + icon: "icon-ok-sign" + } + ], + options: [ + { + name: "button.reject" + }, + { + name: "button.withdrawnbyclient" + }, + { + name: "button.addcharge" + }, + { + name: "button.delete" + } + ] + }; + } + + if (data.status.value == "Approved") { + scope.buttons = { singlebuttons: [ + { + name: "button.undoapproval", + icon: "icon-undo" + }, + { + name: "button.activate", + icon: "icon-ok-sign" + } + ] + }; + } + + if (data.status.value == "Active") { + scope.buttons = { singlebuttons: [ + { + name: "button.deposit", + icon: "icon-arrow-right" + }, + { + name: "button.withdraw", + icon: "icon-arrow-left" + }, + { + name: "button.calculateInterest", + icon: "icon-table" + } + ], + options: [ + { + name: "button.postInterest" + }, + { + name: "button.addcharge" + }, + { + name: "button.close" + } + ] + + }; + if (data.clientId) { + scope.buttons.options.push({ + name: "button.transferFunds" + }); + } + if (data.charges) { + for (var i in scope.charges) { + if (scope.charges[i].name == "Annual fee - INR") { + scope.buttons.options.push({ + name: "button.applyAnnualFees" + }); + scope.annualChargeId = scope.charges[i].id; + } + } } } - } - }); - }; + var annualdueDate = []; + annualdueDate = data.annualFee.feeOnMonthDay; + annualdueDate.push(2013); + scope.annualdueDate = new Date(annualdueDate); + }); - scope.deleteAll = function (apptableName, entityId) { - resourceFactory.DataTablesResource.delete({datatablename:apptableName, entityId:entityId, genericResultSet:'true'}, {}, function(data){ - route.reload(); - }); - }; + resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_savings_account'}, function (data) { + scope.savingdatatables = data; + }); - scope.modifyTransaction = function(accountId, transactionId) { - location.path('/savingaccount/' + accountId + '/modifytransaction?transactionId=' + transactionId); - }; - } - }); - mifosX.ng.application.controller('ViewSavingDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route','dateFilter', mifosX.controllers.ViewSavingDetailsController]).run(function($log) { - $log.info("ViewSavingDetailsController initialized"); - }); + scope.dataTableChange = function (datatable) { + resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, + entityId: routeParams.id, genericResultSet: 'true'}, function (data) { + scope.datatabledetails = data; + scope.datatabledetails.isData = data.data.length > 0 ? true : false; + scope.datatabledetails.isMultirow = data.columnHeaders[0].columnName == "id" ? true : false; + scope.singleRow = []; + for (var i in data.columnHeaders) { + if (scope.datatabledetails.columnHeaders[i].columnCode) { + for (var j in scope.datatabledetails.columnHeaders[i].columnValues) { + for (var k in data.data) { + if (data.data[k].row[i] == scope.datatabledetails.columnHeaders[i].columnValues[j].id) { + data.data[k].row[i] = scope.datatabledetails.columnHeaders[i].columnValues[j].value; + } + } + } + } + } + if (scope.datatabledetails.isData) { + for (var i in data.columnHeaders) { + if (!scope.datatabledetails.isMultirow) { + var row = {}; + row.key = data.columnHeaders[i].columnName; + row.value = data.data[0].row[i]; + scope.singleRow.push(row); + } + } + } + }); + }; + + scope.deleteAll = function (apptableName, entityId) { + resourceFactory.DataTablesResource.delete({datatablename: apptableName, entityId: entityId, genericResultSet: 'true'}, {}, function (data) { + route.reload(); + }); + }; + + scope.modifyTransaction = function (accountId, transactionId) { + location.path('/savingaccount/' + accountId + '/modifytransaction?transactionId=' + transactionId); + }; + } + }); + mifosX.ng.application.controller('ViewSavingDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', 'dateFilter', mifosX.controllers.ViewSavingDetailsController]).run(function ($log) { + $log.info("ViewSavingDetailsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/savings/ViewSavingsTransactionController.js b/app/scripts/controllers/savings/ViewSavingsTransactionController.js index 62acc2bb..2fb1c996 100644 --- a/app/scripts/controllers/savings/ViewSavingsTransactionController.js +++ b/app/scripts/controllers/savings/ViewSavingsTransactionController.js @@ -1,25 +1,25 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewSavingsTransactionController: function(scope, resourceFactory, location, routeParams, dateFilter) { - scope.flag = false; - resourceFactory.savingsTrxnsResource.get({savingsId:routeParams.accountId, transactionId:routeParams.id}, function(data){ - scope.transaction = data; - if(scope.transaction.transactionType.value=='Transfer' || scope.transaction.reversed=='true'){ - scope.flag = true; - } - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewSavingsTransactionController: function (scope, resourceFactory, location, routeParams, dateFilter) { + scope.flag = false; + resourceFactory.savingsTrxnsResource.get({savingsId: routeParams.accountId, transactionId: routeParams.id}, function (data) { + scope.transaction = data; + if (scope.transaction.transactionType.value == 'Transfer' || scope.transaction.reversed == 'true') { + scope.flag = true; + } + }); - scope.undoTransaction = function(accountId, transactionId) { - var params = {savingsId:accountId, transactionId:transactionId, command:'undo'}; - var formData = {dateFormat:scope.df, locale:scope.optlang.code, transactionAmount:0}; - formData.transactionDate = dateFilter(new Date(),scope.df); - resourceFactory.savingsTrxnsResource.save(params, formData, function(data){ - location.path('/viewsavingaccount/' + data.savingsId); - }); - }; - } - }); - mifosX.ng.application.controller('ViewSavingsTransactionController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ViewSavingsTransactionController]).run(function($log) { - $log.info("ViewSavingsTransactionController initialized"); - }); + scope.undoTransaction = function (accountId, transactionId) { + var params = {savingsId: accountId, transactionId: transactionId, command: 'undo'}; + var formData = {dateFormat: scope.df, locale: scope.optlang.code, transactionAmount: 0}; + formData.transactionDate = dateFilter(new Date(), scope.df); + resourceFactory.savingsTrxnsResource.save(params, formData, function (data) { + location.path('/viewsavingaccount/' + data.savingsId); + }); + }; + } + }); + mifosX.ng.application.controller('ViewSavingsTransactionController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.ViewSavingsTransactionController]).run(function ($log) { + $log.info("ViewSavingsTransactionController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/AddCodeController.js b/app/scripts/controllers/system/AddCodeController.js index 95f89c23..c26d3545 100644 --- a/app/scripts/controllers/system/AddCodeController.js +++ b/app/scripts/controllers/system/AddCodeController.js @@ -1,16 +1,15 @@ - -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AddCodeController: function(scope, resourceFactory, location) { + AddCodeController: function (scope, resourceFactory, location) { - scope.submit = function() { - resourceFactory.codeResources.save(this.formData,function(data){ - location.path('/viewcode/'+data.resourceId); + scope.submit = function () { + resourceFactory.codeResources.save(this.formData, function (data) { + location.path('/viewcode/' + data.resourceId); }); }; } }); - mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function($log) { + mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function ($log) { $log.info("AddCodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/AuditController.js b/app/scripts/controllers/system/AuditController.js index d85138a7..47aedc72 100644 --- a/app/scripts/controllers/system/AuditController.js +++ b/app/scripts/controllers/system/AuditController.js @@ -1,67 +1,102 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - AuditController: function(scope, resourceFactory,dateFilter,location) { + AuditController: function (scope, resourceFactory, dateFilter, location) { scope.formData = []; scope.isCollapsed = true; scope.date = {}; - resourceFactory.auditResource.get({templateResource: 'searchtemplate'} , function(data) { + resourceFactory.auditResource.get({templateResource: 'searchtemplate'}, function (data) { scope.template = data; }); - scope.viewUser = function(item){ + scope.viewUser = function (item) { scope.userTypeahead = true; scope.formData.user = item.id; }; - scope.routeTo = function(id){ - location.path('viewaudit/'+id); + scope.routeTo = function (id) { + location.path('viewaudit/' + id); }; - scope.search = function(){ + scope.search = function () { scope.isCollapsed = true; scope.displayResults = true; - var reqFirstDate = dateFilter(scope.date.first,scope.df); - var reqSecondDate = dateFilter(scope.date.second,scope.df); - var reqThirdDate = dateFilter(scope.date.third,scope.df); - var reqFourthDate = dateFilter(scope.date.fourth,scope.df); + var reqFirstDate = dateFilter(scope.date.first, scope.df); + var reqSecondDate = dateFilter(scope.date.second, scope.df); + var reqThirdDate = dateFilter(scope.date.third, scope.df); + var reqFourthDate = dateFilter(scope.date.fourth, scope.df); var params = {}; - if (scope.formData.action) { params.actionName = scope.formData.action; }; + if (scope.formData.action) { + params.actionName = scope.formData.action; + } + ; - if (scope.formData.entity) { params.entityName = scope.formData.entity; }; + if (scope.formData.entity) { + params.entityName = scope.formData.entity; + } + ; - if(scope.formData.status) {params.processingResult = scope.formData.status;}; + if (scope.formData.status) { + params.processingResult = scope.formData.status; + } + ; - if(scope.formData.status==0) {params.processingResult = scope.formData.status;}; + if (scope.formData.status == 0) { + params.processingResult = scope.formData.status; + } + ; - if (scope.formData.resourceId) { params.resourceId = scope.formData.resourceId; }; + if (scope.formData.resourceId) { + params.resourceId = scope.formData.resourceId; + } + ; - if (scope.formData.user) { params.makerId = scope.formData.user; }; + if (scope.formData.user) { + params.makerId = scope.formData.user; + } + ; - if (scope.date.first) { params.makerDateTimeFrom = reqFirstDate; }; + if (scope.date.first) { + params.makerDateTimeFrom = reqFirstDate; + } + ; - if (scope.date.second) { params.makerDateTimeto = reqSecondDate; }; + if (scope.date.second) { + params.makerDateTimeto = reqSecondDate; + } + ; - if (scope.formData.checkedBy) { params.checkerId = scope.formData.checkedBy; }; + if (scope.formData.checkedBy) { + params.checkerId = scope.formData.checkedBy; + } + ; - if (scope.date.third) { params.checkerDateTimeFrom = reqThirdDate; }; + if (scope.date.third) { + params.checkerDateTimeFrom = reqThirdDate; + } + ; - if (scope.date.fourth) { params.checkerDateTimeTo = reqFourthDate; }; - resourceFactory.auditResource.search(params , function(data) { + if (scope.date.fourth) { + params.checkerDateTimeTo = reqFourthDate; + } + ; + resourceFactory.auditResource.search(params, function (data) { scope.searchData = data; - if(scope.searchData==''){ + if (scope.searchData == '') { scope.flag = false; - }else{scope.flag = true;} + } else { + scope.flag = true; + } scope.row = []; scope.csvData = []; - if(scope.userTypeahead){ + if (scope.userTypeahead) { scope.formData.user = ''; scope.userTypeahead = false; scope.user = ''; } - scope.row = ['Id','Resource Id','Status','Office','Made on','Maker','Checked on','Checker','Entity','Action','Client']; + scope.row = ['Id', 'Resource Id', 'Status', 'Office', 'Made on', 'Maker', 'Checked on', 'Checker', 'Entity', 'Action', 'Client']; scope.csvData.push(scope.row); - for(var i in scope.searchData){ - scope.row = [scope.searchData[i].id,scope.searchData[i].resourceId,scope.searchData[i].processingResult,scope.searchData[i].officeName,dateFilter(scope.searchData[i].madeOnDate,'d MMMM y h:mm:ss'),scope.searchData[i].maker,dateFilter(scope.searchData[i].checkedOnDate,'d MMMM y h:mm:ss'),scope.searchData[i].checker,scope.searchData[i].entityName,scope.searchData[i].actionName,scope.searchData[i].clientName]; + for (var i in scope.searchData) { + scope.row = [scope.searchData[i].id, scope.searchData[i].resourceId, scope.searchData[i].processingResult, scope.searchData[i].officeName, dateFilter(scope.searchData[i].madeOnDate, 'd MMMM y h:mm:ss'), scope.searchData[i].maker, dateFilter(scope.searchData[i].checkedOnDate, 'd MMMM y h:mm:ss'), scope.searchData[i].checker, scope.searchData[i].entityName, scope.searchData[i].actionName, scope.searchData[i].clientName]; scope.csvData.push(scope.row); } }); @@ -70,7 +105,7 @@ } }); - mifosX.ng.application.controller('AuditController', ['$scope', 'ResourceFactory','dateFilter','$location', mifosX.controllers.AuditController]).run(function($log) { + mifosX.ng.application.controller('AuditController', ['$scope', 'ResourceFactory', 'dateFilter', '$location', mifosX.controllers.AuditController]).run(function ($log) { $log.info("AuditController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/CodeController.js b/app/scripts/controllers/system/CodeController.js index 3f9deecc..08c53208 100644 --- a/app/scripts/controllers/system/CodeController.js +++ b/app/scripts/controllers/system/CodeController.js @@ -1,16 +1,16 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - CodeController: function(scope, resourceFactory,location) { + CodeController: function (scope, resourceFactory, location) { scope.codes = []; - resourceFactory.codeResources.getAllCodes(function(data){ + resourceFactory.codeResources.getAllCodes(function (data) { scope.codes = data; }); - scope.routeTo = function(id){ - location.path('/viewcode/'+id); + scope.routeTo = function (id) { + location.path('/viewcode/' + id); } - } - }); - mifosX.ng.application.controller('CodeController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.CodeController]).run(function($log) { + } + }); + mifosX.ng.application.controller('CodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CodeController]).run(function ($log) { $log.info("CodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/CreateDataTableController.js b/app/scripts/controllers/system/CreateDataTableController.js index f4ace4cd..a56aa1e3 100644 --- a/app/scripts/controllers/system/CreateDataTableController.js +++ b/app/scripts/controllers/system/CreateDataTableController.js @@ -1,64 +1,64 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateDataTableController: function(scope, routeParams , resourceFactory, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + CreateDataTableController: function (scope, routeParams, resourceFactory, location) { - scope.columns = []; - scope.columnnameerror = false; - scope.columntypeerror = false; - scope.datatableTemplate = {}; - scope.labelerror = "requiredfield"; + scope.columns = []; + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.datatableTemplate = {}; + scope.labelerror = "requiredfield"; - resourceFactory.codeResources.getAllCodes({}, function(data) { - scope.codes = data; - }); + resourceFactory.codeResources.getAllCodes({}, function (data) { + scope.codes = data; + }); - scope.addColumn = function () { - if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { - scope.columnnameerror = false; - scope.columntypeerror = false; - scope.columns.push({name:scope.datatableTemplate.columnName, type:scope.datatableTemplate.columnType, mandatory:false}); - scope.datatableTemplate.columnName = undefined; - scope.datatableTemplate.columnType = undefined; - } else if (!scope.datatableTemplate.columnName) { - scope.errorDetails = []; - scope.columnnameerror = true; - scope.labelerror = "columnnameerr"; - } else if (scope.datatableTemplate.columnName) { - scope.errorDetails = []; - scope.columntypeerror = true; - scope.labelerror = "columntypeerr"; - } - }; + scope.addColumn = function () { + if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.columns.push({name: scope.datatableTemplate.columnName, type: scope.datatableTemplate.columnType, mandatory: false}); + scope.datatableTemplate.columnName = undefined; + scope.datatableTemplate.columnType = undefined; + } else if (!scope.datatableTemplate.columnName) { + scope.errorDetails = []; + scope.columnnameerror = true; + scope.labelerror = "columnnameerr"; + } else if (scope.datatableTemplate.columnName) { + scope.errorDetails = []; + scope.columntypeerror = true; + scope.labelerror = "columntypeerr"; + } + }; - scope.removeColumn = function (index) { - scope.columns.splice(index,1); - }; + scope.removeColumn = function (index) { + scope.columns.splice(index, 1); + }; - scope.updateDepenedencies = function (index) { - if (scope.columns[index].type != 'string') { - scope.columns[index].length = undefined; + scope.updateDepenedencies = function (index) { + if (scope.columns[index].type != 'string') { + scope.columns[index].length = undefined; + } + if (scope.columns[index].type != 'dropdown') { + scope.columns[index].code = undefined; + } + }; + + scope.submit = function () { + if (scope.columns.length == 0) { + scope.errorDetails = []; + scope.errorDetails.push({code: 'error.msg.click.on.add.to.add.columns'}); + } else { + delete scope.errorDetails; + scope.formData.multiRow = scope.formData.multiRow || false; + scope.formData.columns = scope.columns; + resourceFactory.DataTablesResource.save(this.formData, function (data) { + location.path('/viewdatatable/' + data.resourceIdentifier); + }); + } + }; } - if (scope.columns[index].type != 'dropdown') { - scope.columns[index].code = undefined; - } - }; - - scope.submit = function () { - if (scope.columns.length == 0) { - scope.errorDetails = []; - scope.errorDetails.push({code:'error.msg.click.on.add.to.add.columns'}); - }else { - delete scope.errorDetails; - scope.formData.multiRow = scope.formData.multiRow || false; - scope.formData.columns = scope.columns; - resourceFactory.DataTablesResource.save(this.formData,function(data){ - location.path('/viewdatatable/' + data.resourceIdentifier); - }); - } - }; - } - }); - mifosX.ng.application.controller('CreateDataTableController', ['$scope', '$routeParams','ResourceFactory', '$location', mifosX.controllers.CreateDataTableController]).run(function($log) { - $log.info("CreateDataTableController initialized"); - }); + }); + mifosX.ng.application.controller('CreateDataTableController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.CreateDataTableController]).run(function ($log) { + $log.info("CreateDataTableController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/CreateReportController.js b/app/scripts/controllers/system/CreateReportController.js index 735180fb..74efc976 100644 --- a/app/scripts/controllers/system/CreateReportController.js +++ b/app/scripts/controllers/system/CreateReportController.js @@ -1,62 +1,62 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateReportController: function(scope, resourceFactory, location) { - scope.formData = {}; - scope.reportParameters = []; - scope.flag = false; - resourceFactory.reportsResource.getReportDetails({resourceType : 'template'}, function(data) { - scope.reportdetail = data; - scope.formData.reportType = data.allowedReportTypes[0]; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + CreateReportController: function (scope, resourceFactory, location) { + scope.formData = {}; + scope.reportParameters = []; + scope.flag = false; + resourceFactory.reportsResource.getReportDetails({resourceType: 'template'}, function (data) { + scope.reportdetail = data; + scope.formData.reportType = data.allowedReportTypes[0]; + }); - scope.parameterSelected = function(allowedParameterId) { - scope.flag=true; - for(var i in scope.reportdetail.allowedParameters) { - if (scope.reportdetail.allowedParameters[i].id == allowedParameterId) { - scope.reportParameters.push({parameterId : allowedParameterId, - id : "", - allowedParameterName : scope.reportdetail.allowedParameters[i].parameterName - }); - } - } - scope.allowedParameterId = ''; - } - - function deepCopy(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); + scope.parameterSelected = function (allowedParameterId) { + scope.flag = true; + for (var i in scope.reportdetail.allowedParameters) { + if (scope.reportdetail.allowedParameters[i].id == allowedParameterId) { + scope.reportParameters.push({parameterId: allowedParameterId, + id: "", + allowedParameterName: scope.reportdetail.allowedParameters[i].parameterName + }); + } } - return out; + scope.allowedParameterId = ''; } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); + + function deepCopy(obj) { + if (Object.prototype.toString.call(obj) === '[object Array]') { + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; } - return out; + if (typeof obj === 'object') { + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; + } + return obj; } - return obj; - } - scope.deleteParameter = function(index) { - scope.reportParameters.splice(index,1); - } + scope.deleteParameter = function (index) { + scope.reportParameters.splice(index, 1); + } - scope.submit = function() { - scope.temp = deepCopy(scope.reportParameters); - for(var i in scope.temp) { - delete scope.temp[i].allowedParameterName; - } - this.formData.reportParameters = scope.temp; - resourceFactory.reportsResource.save(this.formData,function(data){ - location.path('/system/viewreport/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('CreateReportController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateReportController]).run(function($log) { - $log.info("CreateReportController initialized"); - }); + scope.submit = function () { + scope.temp = deepCopy(scope.reportParameters); + for (var i in scope.temp) { + delete scope.temp[i].allowedParameterName; + } + this.formData.reportParameters = scope.temp; + resourceFactory.reportsResource.save(this.formData, function (data) { + location.path('/system/viewreport/' + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('CreateReportController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateReportController]).run(function ($log) { + $log.info("CreateReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/DataTableController.js b/app/scripts/controllers/system/DataTableController.js index 5ada0ed1..7f61f974 100644 --- a/app/scripts/controllers/system/DataTableController.js +++ b/app/scripts/controllers/system/DataTableController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - DataTableController: function(scope, resourceFactory,location) { - scope.routeTo = function(id){ - location.path('/viewdatatable/' + id); - }; - resourceFactory.DataTablesResource.getAllDataTables(function(data) { - scope.datatables = data; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + DataTableController: function (scope, resourceFactory, location) { + scope.routeTo = function (id) { + location.path('/viewdatatable/' + id); + }; + resourceFactory.DataTablesResource.getAllDataTables(function (data) { + scope.datatables = data; + }); - } - }); - mifosX.ng.application.controller('DataTableController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.DataTableController]).run(function($log) { - $log.info("DataTableController initialized"); - }); + } + }); + mifosX.ng.application.controller('DataTableController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.DataTableController]).run(function ($log) { + $log.info("DataTableController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/DataTableEntryController.js b/app/scripts/controllers/system/DataTableEntryController.js index f2802fbf..9de42c1b 100644 --- a/app/scripts/controllers/system/DataTableEntryController.js +++ b/app/scripts/controllers/system/DataTableEntryController.js @@ -1,132 +1,136 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - DataTableEntryController: function(scope, location, routeParams, route, resourceFactory,$modal,dateFilter) { +(function (module) { + mifosX.controllers = _.extend(module, { + DataTableEntryController: function (scope, location, routeParams, route, resourceFactory, $modal, dateFilter) { - scope.tableName = routeParams.tableName; - scope.entityId = routeParams.entityId; - scope.resourceId = routeParams.resourceId; - scope.formDat = {}; - scope.columnHeaders = []; - scope.formData = {}; - scope.isViewMode = true; + scope.tableName = routeParams.tableName; + scope.entityId = routeParams.entityId; + scope.resourceId = routeParams.resourceId; + scope.formDat = {}; + scope.columnHeaders = []; + scope.formData = {}; + scope.isViewMode = true; - var reqparams = {datatablename:scope.tableName, entityId:scope.entityId, genericResultSet:'true'}; - if (scope.resourceId) { reqparams.resourceId = scope.resourceId; } - - resourceFactory.DataTablesResource.getTableDetails(reqparams, function(data) { - for(var i in data.columnHeaders) { - if (data.columnHeaders[i].columnCode) { - for (var j in data.columnHeaders[i].columnValues){ - if (data.data[0].row[i] == data.columnHeaders[i].columnValues[j].id) { - data.columnHeaders[i].value = data.columnHeaders[i].columnValues[j].value; - } + var reqparams = {datatablename: scope.tableName, entityId: scope.entityId, genericResultSet: 'true'}; + if (scope.resourceId) { + reqparams.resourceId = scope.resourceId; } - } else { - data.columnHeaders[i].value = data.data[0].row[i]; - } - } - scope.columnHeaders = data.columnHeaders; - }); - scope.editDatatableEntry = function () { - scope.isViewMode = false; - var colName = scope.columnHeaders[0].columnName; - if(colName == 'id') { scope.columnHeaders.splice(0,1); } - - colName = scope.columnHeaders[0].columnName; - if(colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { - scope.columnHeaders.splice(0,1); - scope.isCenter = colName == 'center_id' ? true : false; - } - for(var i in scope.columnHeaders) { - - if (scope.columnHeaders[i].columnDisplayType == 'DATE') { - scope.formDat[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].value; - } else{ - scope.formData[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].value; - } - if (scope.columnHeaders[i].columnCode) { - for (var j in scope.columnHeaders[i].columnValues){ - if (scope.columnHeaders[i].value == scope.columnHeaders[i].columnValues[j].value) { - scope.formData[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].columnValues[j].id; - } - } - } - } - }; - scope.deleteDatatableEntry = function (){ - $modal.open({ - templateUrl: 'deletedatatable.html', - controller: DatatableDeleteCtrl - }); - }; - var DatatableDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.DataTablesResource.delete(reqparams, {}, function(data){ - var destination = ""; - if ( data.loanId) { - destination = '/viewloanaccount/'+data.loanId; - } else if ( data.savingsId) { - destination = '/viewsavingaccount/' + data.savingsId; - } else if ( data.clientId) { - destination = '/viewclient/'+data.clientId; - } else if ( data.groupId) { - if (scope.isCenter) { - destination = '/viewcenter/'+data.groupId; - } else { - destination = '/viewgroup/'+data.groupId; + resourceFactory.DataTablesResource.getTableDetails(reqparams, function (data) { + for (var i in data.columnHeaders) { + if (data.columnHeaders[i].columnCode) { + for (var j in data.columnHeaders[i].columnValues) { + if (data.data[0].row[i] == data.columnHeaders[i].columnValues[j].id) { + data.columnHeaders[i].value = data.columnHeaders[i].columnValues[j].value; + } } - } else if ( data.officeId) { - destination = '/viewoffice/'+data.officeId; + } else { + data.columnHeaders[i].value = data.data[0].row[i]; + } + } + scope.columnHeaders = data.columnHeaders; + }); + + scope.editDatatableEntry = function () { + scope.isViewMode = false; + var colName = scope.columnHeaders[0].columnName; + if (colName == 'id') { + scope.columnHeaders.splice(0, 1); + } + + colName = scope.columnHeaders[0].columnName; + if (colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { + scope.columnHeaders.splice(0, 1); + scope.isCenter = colName == 'center_id' ? true : false; + } + for (var i in scope.columnHeaders) { + + if (scope.columnHeaders[i].columnDisplayType == 'DATE') { + scope.formDat[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].value; + } else { + scope.formData[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].value; + } + if (scope.columnHeaders[i].columnCode) { + for (var j in scope.columnHeaders[i].columnValues) { + if (scope.columnHeaders[i].value == scope.columnHeaders[i].columnValues[j].value) { + scope.formData[scope.columnHeaders[i].columnName] = scope.columnHeaders[i].columnValues[j].id; + } + } + } + } + }; + scope.deleteDatatableEntry = function () { + $modal.open({ + templateUrl: 'deletedatatable.html', + controller: DatatableDeleteCtrl + }); + }; + var DatatableDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.DataTablesResource.delete(reqparams, {}, function (data) { + var destination = ""; + if (data.loanId) { + destination = '/viewloanaccount/' + data.loanId; + } else if (data.savingsId) { + destination = '/viewsavingaccount/' + data.savingsId; + } else if (data.clientId) { + destination = '/viewclient/' + data.clientId; + } else if (data.groupId) { + if (scope.isCenter) { + destination = '/viewcenter/' + data.groupId; + } else { + destination = '/viewgroup/' + data.groupId; + } + } else if (data.officeId) { + destination = '/viewoffice/' + data.officeId; + } + location.path(destination); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + scope.cancel = function () { + route.reload(); + }; + + scope.submit = function () { + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + for (var i = 0; i < scope.columnHeaders.length; i++) { + if (!_.contains(_.keys(this.formData), scope.columnHeaders[i].columnName)) { + this.formData[scope.columnHeaders[i].columnName] = ""; + } + if (scope.columnHeaders[i].columnDisplayType == 'DATE') { + this.formData[scope.columnHeaders[i].columnName] = dateFilter(this.formDat[scope.columnHeaders[i].columnName], scope.df); + } + } + resourceFactory.DataTablesResource.update(reqparams, this.formData, function (data) { + var destination = ""; + if (data.loanId) { + destination = '/viewloanaccount/' + data.loanId; + } else if (data.savingsId) { + destination = '/viewsavingaccount/' + data.savingsId; + } else if (data.clientId) { + destination = '/viewclient/' + data.clientId; + } else if (data.groupId) { + if (scope.isCenter) { + destination = '/viewcenter/' + data.groupId; + } else { + destination = '/viewgroup/' + data.groupId; + } + } else if (data.officeId) { + destination = '/viewoffice/' + data.officeId; } location.path(destination); }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - scope.cancel = function () { - route.reload(); - }; - - scope.submit = function () { - this.formData.locale = scope.optlang.code; - this.formData.dateFormat = scope.df; - for (var i=0; i < scope.columnHeaders.length; i++) { - if (!_.contains(_.keys(this.formData), scope.columnHeaders[i].columnName)) { - this.formData[scope.columnHeaders[i].columnName] = ""; - } - if (scope.columnHeaders[i].columnDisplayType == 'DATE') { - this.formData[scope.columnHeaders[i].columnName] = dateFilter(this.formDat[scope.columnHeaders[i].columnName],scope.df); - } - } - resourceFactory.DataTablesResource.update(reqparams, this.formData, function(data){ - var destination = ""; - if ( data.loanId) { - destination = '/viewloanaccount/'+data.loanId; - } else if ( data.savingsId) { - destination = '/viewsavingaccount/' + data.savingsId; - } else if ( data.clientId) { - destination = '/viewclient/'+data.clientId; - } else if ( data.groupId) { - if (scope.isCenter) { - destination = '/viewcenter/'+data.groupId; - } else { - destination = '/viewgroup/'+data.groupId; - } - } else if ( data.officeId) { - destination = '/viewoffice/'+data.officeId; - } - location.path(destination); - }); - }; - - } - }); - mifosX.ng.application.controller('DataTableEntryController', ['$scope', '$location', '$routeParams', '$route', 'ResourceFactory','$modal','dateFilter', mifosX.controllers.DataTableEntryController]).run(function($log) { - $log.info("DataTableEntryController initialized"); - }); + } + }); + mifosX.ng.application.controller('DataTableEntryController', ['$scope', '$location', '$routeParams', '$route', 'ResourceFactory', '$modal', 'dateFilter', mifosX.controllers.DataTableEntryController]).run(function ($log) { + $log.info("DataTableEntryController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/EditCodeController.js b/app/scripts/controllers/system/EditCodeController.js index 7fe1b35d..59a49d7b 100644 --- a/app/scripts/controllers/system/EditCodeController.js +++ b/app/scripts/controllers/system/EditCodeController.js @@ -1,28 +1,28 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - EditCodeController: function(scope, routeParams , resourceFactory, location ) { + EditCodeController: function (scope, routeParams, resourceFactory, location) { scope.codevalues = []; scope.newcodevalues = []; scope.newEle = undefined; scope.codevalueerror = false; scope.newEle = {}; - resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) { + resourceFactory.codeResources.get({codeId: routeParams.id}, function (data) { scope.code = data; scope.codeId = data.id; }); - resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) { + resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id}, function (data) { scope.codevalues = data; }); - scope.addCv = function(){ - if(scope.newEle != undefined && scope.newEle.hasOwnProperty('name')) { + scope.addCv = function () { + if (scope.newEle != undefined && scope.newEle.hasOwnProperty('name')) { scope.codevalueerror = true; - resourceFactory.codeValueResource.save({codeId: routeParams.id},this.newEle,function(data){ - scope.stat=false; - location.path('/viewcode/'+routeParams.id); + resourceFactory.codeValueResource.save({codeId: routeParams.id}, this.newEle, function (data) { + scope.stat = false; + location.path('/viewcode/' + routeParams.id); }); } else if (!scope.newEle.name) { scope.codevalueerror = true; @@ -31,15 +31,15 @@ }; - scope.deleteCv = function(id){ - resourceFactory.codeValueResource.remove({codeId: routeParams.id,codevalueId: id},{},function(data){ - scope.stat=false; - location.path('/viewcode/'+routeParams.id); - }); - }; - } + scope.deleteCv = function (id) { + resourceFactory.codeValueResource.remove({codeId: routeParams.id, codevalueId: id}, {}, function (data) { + scope.stat = false; + location.path('/viewcode/' + routeParams.id); + }); + }; + } }); - mifosX.ng.application.controller('EditCodeController', ['$scope', '$routeParams','ResourceFactory','$location', mifosX.controllers.EditCodeController]).run(function($log) { + mifosX.ng.application.controller('EditCodeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditCodeController]).run(function ($log) { $log.info("EditCodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/EditDataTableController.js b/app/scripts/controllers/system/EditDataTableController.js index d7253ecc..f442695f 100644 --- a/app/scripts/controllers/system/EditDataTableController.js +++ b/app/scripts/controllers/system/EditDataTableController.js @@ -1,137 +1,145 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditDataTableController: function(scope, routeParams , resourceFactory, location) { +(function (module) { + mifosX.controllers = _.extend(module, { + EditDataTableController: function (scope, routeParams, resourceFactory, location) { - scope.columns = []; - scope.dropColumns = []; - scope.formData = {}; - scope.columnnameerror = false; - scope.columntypeerror = false; - scope.datatableTemplate = {}; + scope.columns = []; + scope.dropColumns = []; + scope.formData = {}; + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.datatableTemplate = {}; - resourceFactory.codeResources.getAllCodes({}, function(data) { - scope.codes = data; - }); + resourceFactory.codeResources.getAllCodes({}, function (data) { + scope.codes = data; + }); - resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName} , function(data) { - scope.datatable = data; + resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName}, function (data) { + scope.datatable = data; - scope.formData.apptableName = data.applicationTableName; + scope.formData.apptableName = data.applicationTableName; - var temp=[]; - var colName = data.columnHeaderData[0].columnName; - if(colName == 'id') { - data.columnHeaderData.splice(0,1); + var temp = []; + var colName = data.columnHeaderData[0].columnName; + if (colName == 'id') { + data.columnHeaderData.splice(0, 1); + } + colName = data.columnHeaderData[0].columnName; + if (colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { + data.columnHeaderData.splice(0, 1); + } + + for (var i in data.columnHeaderData) { + + data.columnHeaderData[i].originalName = data.columnHeaderData[i].columnName; + if (data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { + temp = data.columnHeaderData[i].columnName.split("_cd_"); + data.columnHeaderData[i].columnName = temp[1]; + data.columnHeaderData[i].code = temp[0]; + } + + var tempColumn = {name: data.columnHeaderData[i].columnName, mandatory: !data.columnHeaderData[i].isColumnNullable}; + tempColumn.originalName = data.columnHeaderData[i].originalName; + var colType = data.columnHeaderData[i].columnDisplayType.toLowerCase(); + + if (colType == 'integer') { + colType = 'number'; + } + else if (colType == 'codelookup') { + colType = 'dropdown'; + } + tempColumn.type = colType; + + if (colType == 'string') { + tempColumn.length = data.columnHeaderData[i].columnLength; + } + + if (data.columnHeaderData[i].columnCode) { + tempColumn.code = data.columnHeaderData[i].columnCode; + } + + scope.columns.push(tempColumn); + } + }); + + scope.addColumn = function () { + if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { + scope.columnnameerror = false; + scope.columntypeerror = false; + scope.columns.push({name: scope.datatableTemplate.columnName, type: scope.datatableTemplate.columnType, mandatory: false}); + scope.datatableTemplate.columnName = undefined; + scope.datatableTemplate.columnType = undefined; + } else if (!scope.datatableTemplate.columnName) { + scope.columnnameerror = true; + scope.labelerror = "columnnameerr"; + } else if (scope.datatableTemplate.columnName) { + scope.columntypeerror = true; + scope.labelerror = "columntypeerr"; + } + }; + + scope.removeColumn = function (index) { + if (scope.columns[index].originalName) { + scope.dropColumns.push({name: scope.columns[index].originalName}); + } + scope.columns.splice(index, 1); + }; + + scope.updateDepenedencies = function (index) { + if (scope.columns[index].type != 'string') { + scope.columns[index].length = undefined; + } + if (scope.columns[index].type != 'dropdown') { + scope.columns[index].code = undefined; + } + }; + + scope.submit = function () { + + scope.formData.addColumns = []; + scope.formData.changeColumns = []; + + if (scope.dropColumns.length > 0) { + scope.formData.dropColumns = scope.dropColumns; + } + + for (var i in scope.columns) { + + if (scope.columns[i].originalName) { + //This value should be updated based on the configuration + /*if (scope.columns[i].newName) { + if (scope.columns[i].type == "dropdown") { + scope.columns[i].columnName = scope.columns[i].originalName; + scope.columns[i].newName = scope.columns[i].columnCode + "_cd_" + scope.columns[i].newName; + } + }*/ + + delete scope.columns[i].originalName; + delete scope.columns[i].type; + + if (scope.columns[i].code) { + scope.columns[i].newCode = scope.columns[i].newCode || scope.columns[i].code; + } + + if (scope.columns[i].name) { + scope.columns[i].newName = scope.columns[i].newName || scope.columns[i].name; + } + scope.formData.changeColumns.push(scope.columns[i]); + + } else { + scope.formData.addColumns.push(scope.columns[i]); + } + } + + if (scope.formData.addColumns.length == 0) delete scope.formData.addColumns; + if (scope.formData.changeColumns.length == 0) delete scope.formData.changeColumns; + + resourceFactory.DataTablesResource.update({datatablename: routeParams.tableName}, this.formData, function (data) { + location.path('/viewdatatable/' + data.resourceIdentifier); + }); + }; } - colName = data.columnHeaderData[0].columnName; - if(colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { - data.columnHeaderData.splice(0,1); - } - - for(var i in data.columnHeaderData) { - - data.columnHeaderData[i].originalName = data.columnHeaderData[i].columnName; - if(data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { - temp = data.columnHeaderData[i].columnName.split("_cd_"); - data.columnHeaderData[i].columnName = temp[1]; - data.columnHeaderData[i].code = temp[0]; - } - - var tempColumn = {name:data.columnHeaderData[i].columnName, mandatory:!data.columnHeaderData[i].isColumnNullable}; - tempColumn.originalName = data.columnHeaderData[i].originalName; - var colType = data.columnHeaderData[i].columnDisplayType.toLowerCase(); - - if(colType == 'integer') { colType = 'number'; } - else if(colType == 'codelookup') { colType = 'dropdown'; } - tempColumn.type = colType; - - if (colType == 'string') { tempColumn.length = data.columnHeaderData[i].columnLength; } - - if (data.columnHeaderData[i].columnCode) { tempColumn.code = data.columnHeaderData[i].columnCode; } - - scope.columns.push(tempColumn); - } - }); - - scope.addColumn = function () { - if (scope.datatableTemplate.columnName && scope.datatableTemplate.columnType) { - scope.columnnameerror = false; - scope.columntypeerror = false; - scope.columns.push({name:scope.datatableTemplate.columnName, type:scope.datatableTemplate.columnType, mandatory:false}); - scope.datatableTemplate.columnName = undefined; - scope.datatableTemplate.columnType = undefined; - } else if (!scope.datatableTemplate.columnName) { - scope.columnnameerror = true; - scope.labelerror = "columnnameerr"; - } else if (scope.datatableTemplate.columnName) { - scope.columntypeerror = true; - scope.labelerror = "columntypeerr"; - } - }; - - scope.removeColumn = function (index) { - if (scope.columns[index].originalName) { - scope.dropColumns.push({name:scope.columns[index].originalName}); - } - scope.columns.splice(index,1); - }; - - scope.updateDepenedencies = function (index) { - if (scope.columns[index].type != 'string') { - scope.columns[index].length = undefined; - } - if (scope.columns[index].type != 'dropdown') { - scope.columns[index].code = undefined; - } - }; - - scope.submit = function () { - - scope.formData.addColumns = []; - scope.formData.changeColumns = []; - - if (scope.dropColumns.length > 0) { - scope.formData.dropColumns = scope.dropColumns; - } - - for (var i in scope.columns) { - - if (scope.columns[i].originalName) { - //This value should be updated based on the configuration - /*if (scope.columns[i].newName) { - if (scope.columns[i].type == "dropdown") { - scope.columns[i].columnName = scope.columns[i].originalName; - scope.columns[i].newName = scope.columns[i].columnCode + "_cd_" + scope.columns[i].newName; - } - }*/ - - delete scope.columns[i].originalName; - delete scope.columns[i].type; - - if (scope.columns[i].code) { - scope.columns[i].newCode = scope.columns[i].newCode || scope.columns[i].code; - } - - if (scope.columns[i].name) { - scope.columns[i].newName = scope.columns[i].newName || scope.columns[i].name; - } - scope.formData.changeColumns.push(scope.columns[i]); - - } else { - scope.formData.addColumns.push(scope.columns[i]); - } - } - - if (scope.formData.addColumns.length == 0) delete scope.formData.addColumns; - if (scope.formData.changeColumns.length == 0) delete scope.formData.changeColumns; - - resourceFactory.DataTablesResource.update({datatablename: routeParams.tableName}, this.formData, function(data){ - location.path('/viewdatatable/' + data.resourceIdentifier); - }); - }; - } - }); - mifosX.ng.application.controller('EditDataTableController', ['$scope', '$routeParams','ResourceFactory', '$location', mifosX.controllers.EditDataTableController]).run(function($log) { - $log.info("EditDataTableController initialized"); - }); + }); + mifosX.ng.application.controller('EditDataTableController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditDataTableController]).run(function ($log) { + $log.info("EditDataTableController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/EditReportController.js b/app/scripts/controllers/system/EditReportController.js index 15fbd842..0bf1bef0 100644 --- a/app/scripts/controllers/system/EditReportController.js +++ b/app/scripts/controllers/system/EditReportController.js @@ -1,78 +1,78 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditReportController: function(scope, resourceFactory, location, routeParams) { - scope.formData = {}; +(function (module) { + mifosX.controllers = _.extend(module, { + EditReportController: function (scope, resourceFactory, location, routeParams) { + scope.formData = {}; - resourceFactory.reportsResource.getReportDetails({id : routeParams.id, template : 'true'}, function(data) { - scope.reportdetail = data; - scope.reportdetail.reportParameters = data.reportParameters || []; - scope.formData.useReport = data.useReport; - }); + resourceFactory.reportsResource.getReportDetails({id: routeParams.id, template: 'true'}, function (data) { + scope.reportdetail = data; + scope.reportdetail.reportParameters = data.reportParameters || []; + scope.formData.useReport = data.useReport; + }); - scope.parameterSelected = function(allowedParameterId) { - for(var i in scope.reportdetail.allowedParameters) { - if (scope.reportdetail.allowedParameters[i].id == allowedParameterId) { - scope.reportdetail.reportParameters.push({parameterId : allowedParameterId, - id : "", - parameterName : scope.reportdetail.allowedParameters[i].parameterName - }); - } - } - scope.allowedParameterId = ''; - } - - function deepCopy(obj) { - if (Object.prototype.toString.call(obj) === '[object Array]') { - var out = [], i = 0, len = obj.length; - for ( ; i < len; i++ ) { - out[i] = arguments.callee(obj[i]); + scope.parameterSelected = function (allowedParameterId) { + for (var i in scope.reportdetail.allowedParameters) { + if (scope.reportdetail.allowedParameters[i].id == allowedParameterId) { + scope.reportdetail.reportParameters.push({parameterId: allowedParameterId, + id: "", + parameterName: scope.reportdetail.allowedParameters[i].parameterName + }); + } } - return out; + scope.allowedParameterId = ''; } - if (typeof obj === 'object') { - var out = {}, i; - for ( i in obj ) { - out[i] = arguments.callee(obj[i]); + + function deepCopy(obj) { + if (Object.prototype.toString.call(obj) === '[object Array]') { + var out = [], i = 0, len = obj.length; + for (; i < len; i++) { + out[i] = arguments.callee(obj[i]); + } + return out; } - return out; + if (typeof obj === 'object') { + var out = {}, i; + for (i in obj) { + out[i] = arguments.callee(obj[i]); + } + return out; + } + return obj; } - return obj; + + scope.deleteParameter = function (index) { + scope.reportdetail.reportParameters.splice(index, 1); + } + + scope.submit = function () { + if (scope.reportdetail.coreReport === true) { + this.formData.reportParameters = scope.temp; + } else { + scope.temp = deepCopy(scope.reportdetail.reportParameters); + scope.reportdetail.reportParameters = scope.temp; + + for (var i in scope.temp) { + delete scope.temp[i].parameterName; + } + + this.formData = { + reportName: scope.reportdetail.reportName, + reportType: scope.reportdetail.reportType, + reportSubType: scope.reportdetail.reportSubType, + reportCategory: scope.reportdetail.reportCategory, + useReport: scope.reportdetail.useReport, + description: scope.reportdetail.description, + reportSql: scope.reportdetail.reportSql, + reportParameters: scope.reportdetail.reportParameters + } + } + + resourceFactory.reportsResource.update({id: routeParams.id}, this.formData, function (data) { + location.path('/system/viewreport/' + data.resourceId); + }); + }; } - - scope.deleteParameter = function(index) { - scope.reportdetail.reportParameters.splice(index,1); - } - - scope.submit = function() { - if (scope.reportdetail.coreReport === true) { - this.formData.reportParameters = scope.temp; - } else { - scope.temp = deepCopy(scope.reportdetail.reportParameters); - scope.reportdetail.reportParameters = scope.temp; - - for(var i in scope.temp) { - delete scope.temp[i].parameterName; - } - - this.formData = { - reportName : scope.reportdetail.reportName, - reportType : scope.reportdetail.reportType, - reportSubType : scope.reportdetail.reportSubType, - reportCategory : scope.reportdetail.reportCategory, - useReport : scope.reportdetail.useReport, - description : scope.reportdetail.description, - reportSql : scope.reportdetail.reportSql, - reportParameters : scope.reportdetail.reportParameters - } - } - - resourceFactory.reportsResource.update({id: routeParams.id}, this.formData,function(data){ - location.path('/system/viewreport/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('EditReportController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.EditReportController]).run(function($log) { - $log.info("EditReportController initialized"); - }); + }); + mifosX.ng.application.controller('EditReportController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.EditReportController]).run(function ($log) { + $log.info("EditReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/EditSchedulerJobController.js b/app/scripts/controllers/system/EditSchedulerJobController.js index 273d131e..15869d3b 100644 --- a/app/scripts/controllers/system/EditSchedulerJobController.js +++ b/app/scripts/controllers/system/EditSchedulerJobController.js @@ -1,27 +1,27 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditSchedulerJobController: function(scope, routeParams, resourceFactory, location) { - resourceFactory.jobsResource.getJobDetails({jobId : routeParams.id}, function(data) { - scope.job = data; - scope.formData = { - displayName : data.displayName, - cronExpression : data.cronExpression, - active : data.active - } - }); - - scope.cancel = function() { - location.path('/viewschedulerjob/'+routeParams.id); - } +(function (module) { + mifosX.controllers = _.extend(module, { + EditSchedulerJobController: function (scope, routeParams, resourceFactory, location) { + resourceFactory.jobsResource.getJobDetails({jobId: routeParams.id}, function (data) { + scope.job = data; + scope.formData = { + displayName: data.displayName, + cronExpression: data.cronExpression, + active: data.active + } + }); - scope.submit = function() { - resourceFactory.jobsResource.update({jobId: routeParams.id}, this.formData, function(data){ - location.path('/viewschedulerjob/'+data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('EditSchedulerJobController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditSchedulerJobController]).run(function($log) { - $log.info("EditSchedulerJobController initialized"); - }); + scope.cancel = function () { + location.path('/viewschedulerjob/' + routeParams.id); + } + + scope.submit = function () { + resourceFactory.jobsResource.update({jobId: routeParams.id}, this.formData, function (data) { + location.path('/viewschedulerjob/' + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('EditSchedulerJobController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditSchedulerJobController]).run(function ($log) { + $log.info("EditSchedulerJobController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/MakeDataTableEntryController.js b/app/scripts/controllers/system/MakeDataTableEntryController.js index 95c050c1..1bf7943a 100644 --- a/app/scripts/controllers/system/MakeDataTableEntryController.js +++ b/app/scripts/controllers/system/MakeDataTableEntryController.js @@ -1,34 +1,36 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - MakeDataTableEntryController: function(scope, location, routeParams, resourceFactory, dateFilter) { + MakeDataTableEntryController: function (scope, location, routeParams, resourceFactory, dateFilter) { scope.tableName = routeParams.tableName; scope.entityId = routeParams.entityId; scope.columnHeaders = []; scope.formData = {}; scope.formDat = {}; - resourceFactory.DataTablesResource.getTableDetails({ datatablename:scope.tableName, entityId:scope.entityId, genericResultSet:'true' },function(data) { + resourceFactory.DataTablesResource.getTableDetails({ datatablename: scope.tableName, entityId: scope.entityId, genericResultSet: 'true' }, function (data) { var colName = data.columnHeaders[0].columnName; - if(colName == 'id') { data.columnHeaders.splice(0,1); } + if (colName == 'id') { + data.columnHeaders.splice(0, 1); + } colName = data.columnHeaders[0].columnName; - if(colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { - data.columnHeaders.splice(0,1); - scope.isCenter = colName == 'center_id' ? true : false; + if (colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { + data.columnHeaders.splice(0, 1); + scope.isCenter = colName == 'center_id' ? true : false; } scope.columnHeaders = data.columnHeaders; }); //return input type - scope.fieldType = function(type){ + scope.fieldType = function (type) { var fieldType = ""; - if(type){ - if(type == 'STRING' || type == 'INTEGER' || type == 'TEXT' || type == 'DECIMAL'){ + if (type) { + if (type == 'STRING' || type == 'INTEGER' || type == 'TEXT' || type == 'DECIMAL') { fieldType = 'TEXT'; - } else if(type == 'CODELOOKUP'){ + } else if (type == 'CODELOOKUP') { fieldType = 'SELECT'; - } else if(type == 'DATE'){ + } else if (type == 'DATE') { fieldType = 'DATE'; } } @@ -36,40 +38,40 @@ }; scope.cancel = function () { - location.path('/viewclient/'+ routeParams.entityId); + location.path('/viewclient/' + routeParams.entityId); }; scope.submit = function () { - var params = {datatablename:scope.tableName, entityId:scope.entityId, genericResultSet: 'true'}; + var params = {datatablename: scope.tableName, entityId: scope.entityId, genericResultSet: 'true'}; this.formData.locale = scope.optlang.code; this.formData.dateFormat = scope.df; //below logic, for the input field if data is not entered, this logic will put "", because //if no data entered in input field , that field name won't send to server side. - for (var i=0; i < scope.columnHeaders.length; i++) { + for (var i = 0; i < scope.columnHeaders.length; i++) { if (!_.contains(_.keys(this.formData), scope.columnHeaders[i].columnName)) { this.formData[scope.columnHeaders[i].columnName] = ""; } if (scope.columnHeaders[i].columnDisplayType == 'DATE') { - this.formData[scope.columnHeaders[i].columnName] = dateFilter(this.formDat[scope.columnHeaders[i].columnName],scope.df); + this.formData[scope.columnHeaders[i].columnName] = dateFilter(this.formDat[scope.columnHeaders[i].columnName], scope.df); } } - resourceFactory.DataTablesResource.save(params, this.formData, function(data){ + resourceFactory.DataTablesResource.save(params, this.formData, function (data) { var destination = ""; - if ( data.loanId) { - destination = '/viewloanaccount/'+data.loanId; - } else if ( data.savingsId) { + if (data.loanId) { + destination = '/viewloanaccount/' + data.loanId; + } else if (data.savingsId) { destination = '/viewsavingaccount/' + data.savingsId; - } else if ( data.clientId) { - destination = '/viewclient/'+data.clientId; - } else if ( data.groupId) { + } else if (data.clientId) { + destination = '/viewclient/' + data.clientId; + } else if (data.groupId) { if (scope.isCenter) { - destination = '/viewcenter/'+data.groupId; + destination = '/viewcenter/' + data.groupId; } else { - destination = '/viewgroup/'+data.groupId; + destination = '/viewgroup/' + data.groupId; } - } else if ( data.officeId) { - destination = '/viewoffice/'+data.officeId; + } else if (data.officeId) { + destination = '/viewoffice/' + data.officeId; } location.path(destination); }); @@ -77,7 +79,7 @@ } }); - mifosX.ng.application.controller('MakeDataTableEntryController', ['$scope', '$location', '$routeParams', 'ResourceFactory', 'dateFilter', mifosX.controllers.MakeDataTableEntryController]).run(function($log) { + mifosX.ng.application.controller('MakeDataTableEntryController', ['$scope', '$location', '$routeParams', 'ResourceFactory', 'dateFilter', mifosX.controllers.MakeDataTableEntryController]).run(function ($log) { $log.info("MakeDataTableEntryController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ReportsController.js b/app/scripts/controllers/system/ReportsController.js index 5cf5b028..b415b642 100644 --- a/app/scripts/controllers/system/ReportsController.js +++ b/app/scripts/controllers/system/ReportsController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ReportsController: function(scope, resourceFactory,location) { - scope.reports = []; - scope.routeTo = function(id){ - location.path('/system/viewreport/' + id); - }; - resourceFactory.reportsResource.getReport(function(data) { - scope.reports = data; - }); - } - }); - mifosX.ng.application.controller('ReportsController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.ReportsController]).run(function($log) { - $log.info("ReportsController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ReportsController: function (scope, resourceFactory, location) { + scope.reports = []; + scope.routeTo = function (id) { + location.path('/system/viewreport/' + id); + }; + resourceFactory.reportsResource.getReport(function (data) { + scope.reports = data; + }); + } + }); + mifosX.ng.application.controller('ReportsController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.ReportsController]).run(function ($log) { + $log.info("ReportsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/SchedulerJobsController.js b/app/scripts/controllers/system/SchedulerJobsController.js index a2c7e627..166940e5 100644 --- a/app/scripts/controllers/system/SchedulerJobsController.js +++ b/app/scripts/controllers/system/SchedulerJobsController.js @@ -1,94 +1,94 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - SchedulerJobsController: function(scope, resourceFactory, route,location,$modal) { - var jobIdArray = []; - resourceFactory.jobsResource.get(function(data) { - scope.jobs = data; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + SchedulerJobsController: function (scope, resourceFactory, route, location, $modal) { + var jobIdArray = []; + resourceFactory.jobsResource.get(function (data) { + scope.jobs = data; + }); - resourceFactory.schedulerResource.get(function(data) { - scope.schedulerstatus = data.active == true ? 'Active' :'Standby'; - }); - scope.selectAll = function(selectAll) { - scope.active = selectAll; - if(selectAll == 'true') { - for(var i in scope.jobs) { - jobIdArray.push(scope.jobs[i].jobId); - } - } else { - for(var i in scope.jobs) { - jobIdArray = _.without(jobIdArray,scope.jobs[i].jobId); - } + resourceFactory.schedulerResource.get(function (data) { + scope.schedulerstatus = data.active == true ? 'Active' : 'Standby'; + }); + scope.selectAll = function (selectAll) { + scope.active = selectAll; + if (selectAll == 'true') { + for (var i in scope.jobs) { + jobIdArray.push(scope.jobs[i].jobId); + } + } else { + for (var i in scope.jobs) { + jobIdArray = _.without(jobIdArray, scope.jobs[i].jobId); + } + } + }; + scope.errorLog = function (id) { + scope.id = id; + $modal.open({ + templateUrl: 'errorlog.html', + controller: ErrorLogCtrl, + resolve: { + ids: function () { + return id; + } + } + }); + }; + var ErrorLogCtrl = function ($scope, $modalInstance, ids) { + for (var i in scope.jobs) { + if (scope.jobs[i].jobId == ids) { + var index = i; + } + } + $scope.error = scope.jobs[index].lastRunHistory.jobRunErrorLog; + $scope.cancel = function () { + $modalInstance.dismiss('close'); + }; + }; + scope.routeTo = function (id) { + location.path('/viewschedulerjob/' + id); + }; + scope.runJobSelected = function (jobId, active) { + if (active == 'true') { + jobIdArray.push(jobId); + } else { + jobIdArray = _.without(jobIdArray, jobId); + } + }; + + scope.runSelectedJobs = function () { + scope.sentForExecution = []; + for (var i in jobIdArray) { + for (var j in scope.jobs) { + if (scope.jobs[j].jobId == jobIdArray[i]) { + scope.sentForExecution.push(scope.jobs[j].displayName); + } + } + } + + for (var i in jobIdArray) { + resourceFactory.jobsResource.save({jobId: jobIdArray[i], command: 'executeJob'}, {}, function (data) { + }); + } + }; + + scope.suspendJobs = function () { + resourceFactory.schedulerResource.save({command: 'stop'}, {}, function (data) { + route.reload(); + }); + }; + + scope.activeJobs = function () { + resourceFactory.schedulerResource.save({command: 'start'}, {}, function (data) { + route.reload(); + }); + }; + + scope.refresh = function () { + route.reload(); + }; } - }; - scope.errorLog = function(id){ - scope.id = id; - $modal.open({ - templateUrl: 'errorlog.html', - controller: ErrorLogCtrl, - resolve: { - ids: function () { - return id; - } - } - }); - }; - var ErrorLogCtrl = function ($scope, $modalInstance,ids) { - for(var i in scope.jobs){ - if(scope.jobs[i].jobId==ids){ - var index = i; - } - } - $scope.error=scope.jobs[index].lastRunHistory.jobRunErrorLog; - $scope.cancel = function () { - $modalInstance.dismiss('close'); - }; - }; - scope.routeTo = function(id){ - location.path('/viewschedulerjob/'+id); - }; - scope.runJobSelected = function(jobId, active) { - if(active == 'true') { - jobIdArray.push(jobId); - } else { - jobIdArray = _.without(jobIdArray,jobId); - } - }; - - scope.runSelectedJobs = function() { - scope.sentForExecution = []; - for(var i in jobIdArray) { - for(var j in scope.jobs) { - if(scope.jobs[j].jobId == jobIdArray[i]) { - scope.sentForExecution.push(scope.jobs[j].displayName); - } - } - } - - for(var i in jobIdArray) { - resourceFactory.jobsResource.save({jobId: jobIdArray[i], command : 'executeJob'}, {}, function(data){ - }); - } - }; - - scope.suspendJobs = function() { - resourceFactory.schedulerResource.save({command : 'stop'}, {}, function(data) { - route.reload(); - }); - }; - - scope.activeJobs = function() { - resourceFactory.schedulerResource.save({command : 'start'}, {}, function(data) { - route.reload(); - }); - }; - - scope.refresh = function() { - route.reload(); - }; - } - }); - mifosX.ng.application.controller('SchedulerJobsController', ['$scope', 'ResourceFactory', '$route','$location','$modal', mifosX.controllers.SchedulerJobsController]).run(function($log) { - $log.info("SchedulerJobsController initialized"); - }); + }); + mifosX.ng.application.controller('SchedulerJobsController', ['$scope', 'ResourceFactory', '$route', '$location', '$modal', mifosX.controllers.SchedulerJobsController]).run(function ($log) { + $log.info("SchedulerJobsController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewAuditController.js b/app/scripts/controllers/system/ViewAuditController.js index 638a434a..125c6e7e 100644 --- a/app/scripts/controllers/system/ViewAuditController.js +++ b/app/scripts/controllers/system/ViewAuditController.js @@ -1,19 +1,19 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewAuditController: function(scope, resourceFactory, routeParams) { + ViewAuditController: function (scope, resourceFactory, routeParams) { scope.details = {}; - resourceFactory.auditResource.get({templateResource: routeParams.id} , function(data) { + resourceFactory.auditResource.get({templateResource: routeParams.id}, function (data) { scope.details = data; scope.commandAsJson = data.commandAsJson; var obj = JSON.parse(scope.commandAsJson); scope.jsondata = []; - _.each(obj,function(value,key){ - scope.jsondata.push({name:key,property:value}); + _.each(obj, function (value, key) { + scope.jsondata.push({name: key, property: value}); }); }); } }); - mifosX.ng.application.controller('ViewAuditController', ['$scope', 'ResourceFactory', '$routeParams', mifosX.controllers.ViewAuditController]).run(function($log) { + mifosX.ng.application.controller('ViewAuditController', ['$scope', 'ResourceFactory', '$routeParams', mifosX.controllers.ViewAuditController]).run(function ($log) { $log.info("ViewAuditController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewCodeController.js b/app/scripts/controllers/system/ViewCodeController.js index d000aef3..19549e9d 100644 --- a/app/scripts/controllers/system/ViewCodeController.js +++ b/app/scripts/controllers/system/ViewCodeController.js @@ -1,50 +1,50 @@ -(function(module) { +(function (module) { mifosX.controllers = _.extend(module, { - ViewCodeController: function(scope, routeParams , resourceFactory, location,$modal,route ) { + ViewCodeController: function (scope, routeParams, resourceFactory, location, $modal, route) { scope.codevalues = []; scope.formData = []; scope.newcode = {}; scope.codename = {}; - resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) { + resourceFactory.codeResources.get({codeId: routeParams.id}, function (data) { scope.code = data; scope.codename.name = data.name; }); - resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) { + resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id}, function (data) { scope.codevalues = data; }); - scope.delCode = function (){ + scope.delCode = function () { $modal.open({ templateUrl: 'deletecode.html', controller: CodeDeleteCtrl }); }; - scope.showEdit = function(id,name,position,cv){ + scope.showEdit = function (id, name, position, cv) { scope.formData[id] = { - name:name, - position:position + name: name, + position: position } - cv.edit = ! cv.edit; + cv.edit = !cv.edit; }; - scope.editCodeValue = function (id,cv){ - resourceFactory.codeValueResource.update({codeId: routeParams.id, codevalueId: id},this.formData[id],function(data){ - cv.edit = ! cv.edit; + scope.editCodeValue = function (id, cv) { + resourceFactory.codeValueResource.update({codeId: routeParams.id, codevalueId: id}, this.formData[id], function (data) { + cv.edit = !cv.edit; route.reload(); }); }; - scope.showEditCode = function(){ + scope.showEditCode = function () { scope.newcode.edit = !scope.newcode.edit; scope.codename.name = scope.code.name; }; - scope.updateCode = function(){ - resourceFactory.codeResources.update({codeId: routeParams.id},this.codename,function(data){ + scope.updateCode = function () { + resourceFactory.codeResources.update({codeId: routeParams.id}, this.codename, function (data) { route.reload(); }); } var CodeDeleteCtrl = function ($scope, $modalInstance) { $scope.delete = function () { - resourceFactory.codeResources.delete({codeId: routeParams.id},{},function(data){ + resourceFactory.codeResources.delete({codeId: routeParams.id}, {}, function (data) { location.path('/codes'); }); $modalInstance.close('delete'); @@ -53,7 +53,7 @@ $modalInstance.dismiss('cancel'); }; }; - var EditCodeValueCtrl = function ($scope, $modalInstance,cid) { + var EditCodeValueCtrl = function ($scope, $modalInstance, cid) { $scope.edit = function () { $modalInstance.close('delete'); @@ -62,7 +62,7 @@ $modalInstance.dismiss('cancel'); }; }; - scope.deleteCodeValue = function (id){ + scope.deleteCodeValue = function (id) { $modal.open({ templateUrl: 'deletecodevalue.html', controller: CodeValueDeleteCtrl, @@ -73,9 +73,9 @@ } }); }; - var CodeValueDeleteCtrl = function ($scope, $modalInstance,cvid) { + var CodeValueDeleteCtrl = function ($scope, $modalInstance, cvid) { $scope.delete = function () { - resourceFactory.codeValueResource.delete({codeId: routeParams.id,codevalueId: cvid},{},function(data){ + resourceFactory.codeValueResource.delete({codeId: routeParams.id, codevalueId: cvid}, {}, function (data) { route.reload(); }); $modalInstance.close('delete'); @@ -87,7 +87,7 @@ } }); - mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams','ResourceFactory','$location','$modal','$route', mifosX.controllers.ViewCodeController]).run(function($log) { + mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', '$route', mifosX.controllers.ViewCodeController]).run(function ($log) { $log.info("ViewCodeController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewDataTableController.js b/app/scripts/controllers/system/ViewDataTableController.js index b8b44d94..b9e79733 100644 --- a/app/scripts/controllers/system/ViewDataTableController.js +++ b/app/scripts/controllers/system/ViewDataTableController.js @@ -1,48 +1,48 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewDataTableController: function(scope, routeParams, resourceFactory, location,$modal) { +(function (module) { + mifosX.controllers = _.extend(module, { + ViewDataTableController: function (scope, routeParams, resourceFactory, location, $modal) { - resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName} , function(data) { - - var temp=[]; - var colName = data.columnHeaderData[0].columnName; - if(colName == 'id') { - data.columnHeaderData.splice(0,1); - } - colName = data.columnHeaderData[0].columnName; - if(colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { - data.columnHeaderData.splice(0,1); - } + resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName}, function (data) { - for(var i=0; i< data.columnHeaderData.length; i++) { - if(data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { - temp = data.columnHeaderData[i].columnName.split("_cd_"); - data.columnHeaderData[i].columnName = temp[1]; - data.columnHeaderData[i].code = temp[0]; - } - } - scope.datatable = data; - }); - scope.deleteTable = function (){ - $modal.open({ - templateUrl: 'deletetable.html', - controller: TableDeleteCtrl + var temp = []; + var colName = data.columnHeaderData[0].columnName; + if (colName == 'id') { + data.columnHeaderData.splice(0, 1); + } + colName = data.columnHeaderData[0].columnName; + if (colName == 'client_id' || colName == 'office_id' || colName == 'group_id' || colName == 'center_id' || colName == 'loan_id' || colName == 'savings_account_id') { + data.columnHeaderData.splice(0, 1); + } + + for (var i = 0; i < data.columnHeaderData.length; i++) { + if (data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) { + temp = data.columnHeaderData[i].columnName.split("_cd_"); + data.columnHeaderData[i].columnName = temp[1]; + data.columnHeaderData[i].code = temp[0]; + } + } + scope.datatable = data; }); - }; - var TableDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.DataTablesResource.delete({datatablename: routeParams.tableName}, {}, function(data){ - location.path('/datatables'); + scope.deleteTable = function () { + $modal.open({ + templateUrl: 'deletetable.html', + controller: TableDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var TableDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.DataTablesResource.delete({datatablename: routeParams.tableName}, {}, function (data) { + location.path('/datatables'); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewDataTableController', ['$scope', '$routeParams','ResourceFactory', '$location','$modal', mifosX.controllers.ViewDataTableController]).run(function($log) { - $log.info("ViewDataTableController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewDataTableController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', mifosX.controllers.ViewDataTableController]).run(function ($log) { + $log.info("ViewDataTableController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewReportController.js b/app/scripts/controllers/system/ViewReportController.js index dd058f00..3c2310a4 100644 --- a/app/scripts/controllers/system/ViewReportController.js +++ b/app/scripts/controllers/system/ViewReportController.js @@ -1,30 +1,30 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewReportController: function(scope, routeParams , resourceFactory,location,$modal) { - resourceFactory.reportsResource.getReportDetails({id: routeParams.id} , function(data) { - scope.report = data; - scope.noncoreReport = data.coreReport==true ? false : true; - }); - scope.deletereport = function (){ - $modal.open({ - templateUrl: 'deletenoncorereport.html', - controller: NoncoreReportDeleteCtrl +(function (module) { + mifosX.controllers = _.extend(module, { + ViewReportController: function (scope, routeParams, resourceFactory, location, $modal) { + resourceFactory.reportsResource.getReportDetails({id: routeParams.id}, function (data) { + scope.report = data; + scope.noncoreReport = data.coreReport == true ? false : true; }); - }; - var NoncoreReportDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.reportsResource.delete({id: routeParams.id} , {} , function(data) { - location.path('/reports'); + scope.deletereport = function () { + $modal.open({ + templateUrl: 'deletenoncorereport.html', + controller: NoncoreReportDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var NoncoreReportDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.reportsResource.delete({id: routeParams.id}, {}, function (data) { + location.path('/reports'); + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewReportController', ['$scope', '$routeParams','ResourceFactory', '$location','$modal', mifosX.controllers.ViewReportController]).run(function($log) { - $log.info("ViewReportController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewReportController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', mifosX.controllers.ViewReportController]).run(function ($log) { + $log.info("ViewReportController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewSchedulerJobController.js b/app/scripts/controllers/system/ViewSchedulerJobController.js index dca6bda2..c8d7ef27 100644 --- a/app/scripts/controllers/system/ViewSchedulerJobController.js +++ b/app/scripts/controllers/system/ViewSchedulerJobController.js @@ -1,12 +1,12 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewSchedulerJobController: function(scope, routeParams , resourceFactory ) { - resourceFactory.jobsResource.getJobDetails({jobId : routeParams.id}, function(data) { - scope.job = data; - }); - } - }); - mifosX.ng.application.controller('ViewSchedulerJobController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewSchedulerJobController]).run(function($log) { - $log.info("ViewSchedulerJobController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewSchedulerJobController: function (scope, routeParams, resourceFactory) { + resourceFactory.jobsResource.getJobDetails({jobId: routeParams.id}, function (data) { + scope.job = data; + }); + } + }); + mifosX.ng.application.controller('ViewSchedulerJobController', ['$scope', '$routeParams', 'ResourceFactory', mifosX.controllers.ViewSchedulerJobController]).run(function ($log) { + $log.info("ViewSchedulerJobController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/system/ViewSchedulerJobHistoryController.js b/app/scripts/controllers/system/ViewSchedulerJobHistoryController.js index 4d5afd43..623596ca 100644 --- a/app/scripts/controllers/system/ViewSchedulerJobHistoryController.js +++ b/app/scripts/controllers/system/ViewSchedulerJobHistoryController.js @@ -1,15 +1,14 @@ - -(function(module) { - mifosX.controllers = _.extend(module, { - ViewSchedulerJobHistoryController: function(scope, resourceFactory , paginatorService, routeParams) { - scope.jobhistory = []; - var fetchFunction = function(offset, limit, callback) { - resourceFactory.jobsResource.getJobHistory({jobId : routeParams.id, resourceType : 'runhistory', offset: offset, limit: limit} , callback); - }; - scope.jobhistory = paginatorService.paginate(fetchFunction, 14); - } - }); - mifosX.ng.application.controller('ViewSchedulerJobHistoryController', ['$scope', 'ResourceFactory', 'PaginatorService', '$routeParams', mifosX.controllers.ViewSchedulerJobHistoryController]).run(function($log) { - $log.info("ViewSchedulerJobHistoryController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + ViewSchedulerJobHistoryController: function (scope, resourceFactory, paginatorService, routeParams) { + scope.jobhistory = []; + var fetchFunction = function (offset, limit, callback) { + resourceFactory.jobsResource.getJobHistory({jobId: routeParams.id, resourceType: 'runhistory', offset: offset, limit: limit}, callback); + }; + scope.jobhistory = paginatorService.paginate(fetchFunction, 14); + } + }); + mifosX.ng.application.controller('ViewSchedulerJobHistoryController', ['$scope', 'ResourceFactory', 'PaginatorService', '$routeParams', mifosX.controllers.ViewSchedulerJobHistoryController]).run(function ($log) { + $log.info("ViewSchedulerJobHistoryController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/CreateTemplateController.js b/app/scripts/controllers/template/CreateTemplateController.js index 5a06bebd..7aab76d6 100644 --- a/app/scripts/controllers/template/CreateTemplateController.js +++ b/app/scripts/controllers/template/CreateTemplateController.js @@ -1,113 +1,118 @@ /*global mifosX _ CKEDITOR */ -(function(module) { - mifosX.controllers = _.extend(module, { - CreateTemplateController: function(scope, resourceFactory, location) { - scope.mappers = []; - scope.formData = {}; - resourceFactory.templateResource.getTemplateDetails({resourceType : 'template'}, function(data) { - scope.template = data; - scope.advanceOption = 'false'; - scope.oneAtATime = 'true'; - scope.formData.entity = data.entities[0].id; - scope.formData.type = data.types[0].id; - scope.templateKeyEntity = "Client"; - scope.clientKeys(); - scope.mappers.push({ - mappersorder : 0, - mapperskey : "client", - mappersvalue : "clients/{{clientId}}?tenantIdentifier=default", - defaultAddIcon : 'true' - }); - }); - - scope.clientKeys = function() { - scope.templateKeys = ["{{client.accountNo}}", "{{client.status.value}}", "{{client.fullname}}", - "{{client.displayName}}", "{{client.officeName}}", "{{#client.groups}}", "{{/client.groups}}"]; - scope.templateEntity = [{"entityName" : "Client", - "templateKeys" : scope.templateKeys}]; - CKEDITOR.instances.templateeditor.setData(''); - }; - - scope.loanKeys = function() { - CKEDITOR.instances.templateeditor.setData(''); - scope.loanTemplateKeys = ["{{loan.accountNo}}", "{{loan.status.value}}", "{{loan.loanProductId}}", - "{{loan.loanProductName}}", "{{loan.loanProductDescription}}"]; - scope.repaymentTemplateKeys = ["{{loan.repaymentSchedule.loanTermInDays}}", "{{loan.repaymentSchedule.totalPrincipalDisbursed}}", - "{{loan.repaymentSchedule.totalPrincipalExpected}}", "{{loan.repaymentSchedule.totalPrincipalPaid}}", - "{{loan.repaymentSchedule.totalInterestCharged}}", "{{loan.repaymentSchedule.totalFeeChargesCharged}}", - "{{loan.repaymentSchedule.totalPenaltyChargesCharged}}", "{{loan.repaymentSchedule.totalWaived}}", - "{{loan.repaymentSchedule.totalWrittenOff}}", "{{loan.repaymentSchedule.totalRepaymentExpected}}", - "{{loan.repaymentSchedule.totalRepayment}}", "{{loan.repaymentSchedule.totalPaidInAdvance}}", - "{{loan.repaymentSchedule.totalPaidLate}}", "{{loan.repaymentSchedule.totalOutstanding}}"]; - scope.templateEntity = [{"entityName" : "Loan", - "templateKeys" : scope.loanTemplateKeys - },{"entityName" : "Repayment Schedule", - "templateKeys" : scope.repaymentTemplateKeys - }]; - }; - - scope.entityChange = function(entityId) { - scope.mappers.splice(0,1); - if ( entityId !== 0) { - scope.mappers.push({ - mappersorder : 0, - mapperskey : "loan", - mappersvalue : "loans/{{loanId}}?associations=all&tenantIdentifier=default", - defaultAddIcon : 'true', - }); - scope.loanKeys(); - scope.templateKeyEntity = "Loan"; - } else { - scope.templateKeyEntity = "Client"; - scope.mappers.push({ - mappersorder : 0, - mapperskey : "client", - mappersvalue : "clients/{{clientId}}?tenantIdentifier=default", - defaultAddIcon : 'true', +(function (module) { + mifosX.controllers = _.extend(module, { + CreateTemplateController: function (scope, resourceFactory, location) { + scope.mappers = []; + scope.formData = {}; + resourceFactory.templateResource.getTemplateDetails({resourceType: 'template'}, function (data) { + scope.template = data; + scope.advanceOption = 'false'; + scope.oneAtATime = 'true'; + scope.formData.entity = data.entities[0].id; + scope.formData.type = data.types[0].id; + scope.templateKeyEntity = "Client"; + scope.clientKeys(); + scope.mappers.push({ + mappersorder: 0, + mapperskey: "client", + mappersvalue: "clients/{{clientId}}?tenantIdentifier=default", + defaultAddIcon: 'true' + }); }); - scope.clientKeys(); + + scope.clientKeys = function () { + scope.templateKeys = ["{{client.accountNo}}", "{{client.status.value}}", "{{client.fullname}}", + "{{client.displayName}}", "{{client.officeName}}", "{{#client.groups}}", "{{/client.groups}}"]; + scope.templateEntity = [ + {"entityName": "Client", + "templateKeys": scope.templateKeys} + ]; + CKEDITOR.instances.templateeditor.setData(''); + }; + + scope.loanKeys = function () { + CKEDITOR.instances.templateeditor.setData(''); + scope.loanTemplateKeys = ["{{loan.accountNo}}", "{{loan.status.value}}", "{{loan.loanProductId}}", + "{{loan.loanProductName}}", "{{loan.loanProductDescription}}"]; + scope.repaymentTemplateKeys = ["{{loan.repaymentSchedule.loanTermInDays}}", "{{loan.repaymentSchedule.totalPrincipalDisbursed}}", + "{{loan.repaymentSchedule.totalPrincipalExpected}}", "{{loan.repaymentSchedule.totalPrincipalPaid}}", + "{{loan.repaymentSchedule.totalInterestCharged}}", "{{loan.repaymentSchedule.totalFeeChargesCharged}}", + "{{loan.repaymentSchedule.totalPenaltyChargesCharged}}", "{{loan.repaymentSchedule.totalWaived}}", + "{{loan.repaymentSchedule.totalWrittenOff}}", "{{loan.repaymentSchedule.totalRepaymentExpected}}", + "{{loan.repaymentSchedule.totalRepayment}}", "{{loan.repaymentSchedule.totalPaidInAdvance}}", + "{{loan.repaymentSchedule.totalPaidLate}}", "{{loan.repaymentSchedule.totalOutstanding}}"]; + scope.templateEntity = [ + {"entityName": "Loan", + "templateKeys": scope.loanTemplateKeys + }, + {"entityName": "Repayment Schedule", + "templateKeys": scope.repaymentTemplateKeys + } + ]; + }; + + scope.entityChange = function (entityId) { + scope.mappers.splice(0, 1); + if (entityId !== 0) { + scope.mappers.push({ + mappersorder: 0, + mapperskey: "loan", + mappersvalue: "loans/{{loanId}}?associations=all&tenantIdentifier=default", + defaultAddIcon: 'true', + }); + scope.loanKeys(); + scope.templateKeyEntity = "Loan"; + } else { + scope.templateKeyEntity = "Client"; + scope.mappers.push({ + mappersorder: 0, + mapperskey: "client", + mappersvalue: "clients/{{clientId}}?tenantIdentifier=default", + defaultAddIcon: 'true', + }); + scope.clientKeys(); + } + }; + + scope.templateKeySelected = function (templateKey) { + CKEDITOR.instances.templateeditor.insertText(templateKey); + }; + + scope.addMapperKeyValue = function () { + scope.mappers.push({ + mappersorder: scope.mappers.length, + mapperskey: "", + mappersvalue: "" + }); + }; + + scope.deleteMapperKeyValue = function (index) { + scope.mappers.splice(index, 1); + }; + + scope.advanceOptionClick = function () { + if (scope.advanceOption == 'false') { + scope.advanceOption = 'true'; + } else { + scope.advanceOption = 'false'; + } + }; + + scope.submit = function () { + for (var i in scope.mappers) { + delete scope.mappers[i].defaultAddIcon; + } + this.formData.mappers = scope.mappers; + this.formData.text = CKEDITOR.instances.templateeditor.getData(); + resourceFactory.templateResource.save(this.formData, function (data) { + location.path('/viewtemplate/' + data.resourceId); + }); + }; + + } - }; - - scope.templateKeySelected = function(templateKey) { - CKEDITOR.instances.templateeditor.insertText(templateKey); - }; - - scope.addMapperKeyValue = function() { - scope.mappers.push({ - mappersorder : scope.mappers.length, - mapperskey : "", - mappersvalue : "" - }); - }; - - scope.deleteMapperKeyValue = function(index) { - scope.mappers.splice(index,1); - }; - - scope.advanceOptionClick = function() { - if(scope.advanceOption == 'false') { - scope.advanceOption = 'true'; - } else { - scope.advanceOption = 'false'; - } - }; - - scope.submit = function() { - for(var i in scope.mappers) { - delete scope.mappers[i].defaultAddIcon; - } - this.formData.mappers = scope.mappers; - this.formData.text = CKEDITOR.instances.templateeditor.getData(); - resourceFactory.templateResource.save(this.formData, function(data) { - location.path('/viewtemplate/'+data.resourceId); - }); - }; - - - } - }); - mifosX.ng.application.controller('CreateTemplateController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateTemplateController]).run(function($log) { - $log.info("CreateTemplateController initialized"); - }); + }); + mifosX.ng.application.controller('CreateTemplateController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateTemplateController]).run(function ($log) { + $log.info("CreateTemplateController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/EditTemplateController.js b/app/scripts/controllers/template/EditTemplateController.js index ae0e4ea9..06c5adf4 100644 --- a/app/scripts/controllers/template/EditTemplateController.js +++ b/app/scripts/controllers/template/EditTemplateController.js @@ -1,148 +1,153 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - EditTemplateController: function(scope, resourceFactory, location, routeParams) { - scope.mappers = []; - scope.formData = {}; - resourceFactory.templateResource.getTemplateDetails({templateId: routeParams.id, resourceType : 'template'}, function(data) { - scope.template = data; - scope.templateId = data.template.id; - scope.advanceOption = 'false'; +(function (module) { + mifosX.controllers = _.extend(module, { + EditTemplateController: function (scope, resourceFactory, location, routeParams) { + scope.mappers = []; + scope.formData = {}; + resourceFactory.templateResource.getTemplateDetails({templateId: routeParams.id, resourceType: 'template'}, function (data) { + scope.template = data; + scope.templateId = data.template.id; + scope.advanceOption = 'false'; - for(var i in data.entities) { - if(data.entities[i].name == data.template.entity) { - scope.formData.entity = data.entities[i].id; - break; - } - } + for (var i in data.entities) { + if (data.entities[i].name == data.template.entity) { + scope.formData.entity = data.entities[i].id; + break; + } + } - for(var i in data.types) { - if(data.types[i].name == data.template.type) { - scope.formData.type = data.types[i].id; - break; - } - } + for (var i in data.types) { + if (data.types[i].name == data.template.type) { + scope.formData.type = data.types[i].id; + break; + } + } - scope.templateKeyEntity = data.template.entity; - scope.formData.name = data.template.name; + scope.templateKeyEntity = data.template.entity; + scope.formData.name = data.template.name; - for(var i in data.template.mappers) { - if (i == 0) { - scope.mappers.push({ - mappersorder : data.template.mappers[i].mapperorder, - mapperskey : data.template.mappers[i].mapperkey, - mappersvalue : data.template.mappers[i].mappervalue, - defaultAddIcon : 'true', + for (var i in data.template.mappers) { + if (i == 0) { + scope.mappers.push({ + mappersorder: data.template.mappers[i].mapperorder, + mapperskey: data.template.mappers[i].mapperkey, + mappersvalue: data.template.mappers[i].mappervalue, + defaultAddIcon: 'true', + }); + } else { + scope.mappers.push({ + mappersorder: data.template.mappers[i].mapperorder, + mapperskey: data.template.mappers[i].mapperkey, + mappersvalue: data.template.mappers[i].mappervalue, + defaultAddIcon: 'false', + }); + } + } + + if (data.template.entity == "client") { + scope.clientKeys(); + } else if (data.template.entity == "loan") { + scope.loanKeys(); + } + CKEDITOR.instances.templateeditor.insertHtml(data.template.text); }); - } else { - scope.mappers.push({ - mappersorder : data.template.mappers[i].mapperorder, - mapperskey : data.template.mappers[i].mapperkey, - mappersvalue : data.template.mappers[i].mappervalue, - defaultAddIcon : 'false', - }); - } + + scope.clientKeys = function () { + scope.clientTemplateKeys = ["{{client.accountNo}}", "{{client.status.value}}", "{{client.fullname}}", + "{{client.displayName}}", "{{client.officeName}}", "{{#client.groups}}", "{{/client.groups}}"]; + scope.templateEntity = [ + {"entityName": "Client", + "templateKeys": scope.clientTemplateKeys} + ]; + if (scope.templateKeyEntity != "client") { + CKEDITOR.instances.templateeditor.setData(''); + } + } + + scope.loanKeys = function () { + scope.loanTemplateKeys = ["{{loan.accountNo}}", "{{loan.status.value}}", "{{loan.loanProductId}}", + "{{loan.loanProductName}}", "{{loan.loanProductDescription}}"]; + scope.repaymentTemplateKeys = ["{{loan.repaymentSchedule.loanTermInDays}}", "{{loan.repaymentSchedule.totalPrincipalDisbursed}}", + "{{loan.repaymentSchedule.totalPrincipalExpected}}", "{{loan.repaymentSchedule.totalPrincipalPaid}}", + "{{loan.repaymentSchedule.totalInterestCharged}}", "{{loan.repaymentSchedule.totalFeeChargesCharged}}", + "{{loan.repaymentSchedule.totalPenaltyChargesCharged}}", "{{loan.repaymentSchedule.totalWaived}}", + "{{loan.repaymentSchedule.totalWrittenOff}}", "{{loan.repaymentSchedule.totalRepaymentExpected}}", + "{{loan.repaymentSchedule.totalRepayment}}", "{{loan.repaymentSchedule.totalPaidInAdvance}}", + "{{loan.repaymentSchedule.totalPaidLate}}", "{{loan.repaymentSchedule.totalOutstanding}}"]; + scope.templateEntity = [ + {"entityName": "Loan", + "templateKeys": scope.loanTemplateKeys + }, + {"entityName": "Repayment Schedule", + "templateKeys": scope.repaymentTemplateKeys + } + ]; + if (scope.templateKeyEntity != "loan") { + CKEDITOR.instances.templateeditor.setData(''); + } + } + + scope.entityChange = function (entityId) { + scope.mappers.splice(0, 1); + if (entityId != 0) { + scope.mappers.push({ + mappersorder: 0, + mapperskey: "loan", + mappersvalue: "loans/{{loanId}}?associations=all&tenantIdentifier=default", + disable: 'true', + }); + scope.loanKeys(); + scope.templateKeyEntity = "Loan"; + } else { + scope.templateKeyEntity = "Client"; + scope.mappers.push({ + mappersorder: 0, + mapperskey: "client", + mappersvalue: "clients/{{clientId}}?tenantIdentifier=default", + disable: 'true', + }); + scope.clientKeys(); + } + } + + scope.templateKeySelected = function (templateKey) { + CKEDITOR.instances.templateeditor.insertText(templateKey); + } + + scope.addMapperKeyValue = function () { + scope.mappers.push({ + mappersorder: scope.mappers.length, + mapperskey: "", + mappersvalue: "" + }); + } + + scope.deleteMapperKeyValue = function (index) { + scope.mappers.splice(index, 1); + } + + scope.advanceOptionClick = function () { + if (scope.advanceOption == 'false') { + scope.advanceOption = 'true'; + } else { + scope.advanceOption = 'false'; + } + } + + scope.submit = function () { + for (var i in scope.mappers) { + delete scope.mappers[i].defaultAddIcon; + } + this.formData.mappers = scope.mappers; + this.formData.text = CKEDITOR.instances.templateeditor.getData(); + resourceFactory.templateResource.update({templateId: routeParams.id}, this.formData, function (data) { + location.path('/viewtemplate/' + data.resourceId); + }); + } + + } - - if (data.template.entity == "client") { - scope.clientKeys(); - } else if (data.template.entity == "loan") { - scope.loanKeys(); - } - CKEDITOR.instances.templateeditor.insertHtml(data.template.text); - }); - - scope.clientKeys = function() { - scope.clientTemplateKeys = ["{{client.accountNo}}", "{{client.status.value}}", "{{client.fullname}}", - "{{client.displayName}}", "{{client.officeName}}", "{{#client.groups}}", "{{/client.groups}}"]; - scope.templateEntity = [{"entityName" : "Client", - "templateKeys" : scope.clientTemplateKeys}]; - if (scope.templateKeyEntity != "client") { - CKEDITOR.instances.templateeditor.setData(''); - } - } - - scope.loanKeys = function() { - scope.loanTemplateKeys = ["{{loan.accountNo}}", "{{loan.status.value}}", "{{loan.loanProductId}}", - "{{loan.loanProductName}}", "{{loan.loanProductDescription}}"]; - scope.repaymentTemplateKeys = ["{{loan.repaymentSchedule.loanTermInDays}}", "{{loan.repaymentSchedule.totalPrincipalDisbursed}}", - "{{loan.repaymentSchedule.totalPrincipalExpected}}", "{{loan.repaymentSchedule.totalPrincipalPaid}}", - "{{loan.repaymentSchedule.totalInterestCharged}}", "{{loan.repaymentSchedule.totalFeeChargesCharged}}", - "{{loan.repaymentSchedule.totalPenaltyChargesCharged}}", "{{loan.repaymentSchedule.totalWaived}}", - "{{loan.repaymentSchedule.totalWrittenOff}}", "{{loan.repaymentSchedule.totalRepaymentExpected}}", - "{{loan.repaymentSchedule.totalRepayment}}", "{{loan.repaymentSchedule.totalPaidInAdvance}}", - "{{loan.repaymentSchedule.totalPaidLate}}", "{{loan.repaymentSchedule.totalOutstanding}}"]; - scope.templateEntity = [{"entityName" : "Loan", - "templateKeys" : scope.loanTemplateKeys - },{"entityName" : "Repayment Schedule", - "templateKeys" : scope.repaymentTemplateKeys - }]; - if (scope.templateKeyEntity != "loan") { - CKEDITOR.instances.templateeditor.setData(''); - } - } - - scope.entityChange = function(entityId) { - scope.mappers.splice(0,1); - if ( entityId != 0) { - scope.mappers.push({ - mappersorder : 0, - mapperskey : "loan", - mappersvalue : "loans/{{loanId}}?associations=all&tenantIdentifier=default", - disable : 'true', - }); - scope.loanKeys(); - scope.templateKeyEntity = "Loan"; - } else { - scope.templateKeyEntity = "Client"; - scope.mappers.push({ - mappersorder : 0, - mapperskey : "client", - mappersvalue : "clients/{{clientId}}?tenantIdentifier=default", - disable : 'true', - }); - scope.clientKeys(); - } - } - - scope.templateKeySelected = function(templateKey) { - CKEDITOR.instances.templateeditor.insertText(templateKey); - } - - scope.addMapperKeyValue = function() { - scope.mappers.push({ - mappersorder : scope.mappers.length, - mapperskey : "", - mappersvalue : "" - }); - } - - scope.deleteMapperKeyValue = function(index) { - scope.mappers.splice(index,1); - } - - scope.advanceOptionClick = function() { - if(scope.advanceOption == 'false') { - scope.advanceOption = 'true'; - } else { - scope.advanceOption = 'false'; - } - } - - scope.submit = function() { - for(var i in scope.mappers) { - delete scope.mappers[i].defaultAddIcon; - } - this.formData.mappers = scope.mappers; - this.formData.text = CKEDITOR.instances.templateeditor.getData(); - resourceFactory.templateResource.update({templateId: routeParams.id}, this.formData, function(data) { - location.path('/viewtemplate/'+data.resourceId); - }); - } - - - } - }); - mifosX.ng.application.controller('EditTemplateController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.EditTemplateController]).run(function($log) { - $log.info("EditTemplateController initialized"); - }); + }); + mifosX.ng.application.controller('EditTemplateController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.EditTemplateController]).run(function ($log) { + $log.info("EditTemplateController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/TemplateController.js b/app/scripts/controllers/template/TemplateController.js index e09c731c..2ab1bf76 100644 --- a/app/scripts/controllers/template/TemplateController.js +++ b/app/scripts/controllers/template/TemplateController.js @@ -1,12 +1,12 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - TemplateController: function(scope, resourceFactory) { - resourceFactory.templateResource.get(function(data) { - scope.templates = data; - }); - } - }); - mifosX.ng.application.controller('TemplateController', ['$scope', 'ResourceFactory', mifosX.controllers.TemplateController]).run(function($log) { - $log.info("TemplateController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + TemplateController: function (scope, resourceFactory) { + resourceFactory.templateResource.get(function (data) { + scope.templates = data; + }); + } + }); + mifosX.ng.application.controller('TemplateController', ['$scope', 'ResourceFactory', mifosX.controllers.TemplateController]).run(function ($log) { + $log.info("TemplateController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/ViewTemplateController.js b/app/scripts/controllers/template/ViewTemplateController.js index 57cf8347..1710b47c 100644 --- a/app/scripts/controllers/template/ViewTemplateController.js +++ b/app/scripts/controllers/template/ViewTemplateController.js @@ -1,32 +1,32 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewTemplateController: function(scope, routeParams , resourceFactory, location,$modal) { - resourceFactory.templateResource.getTemplateDetails({templateId: routeParams.id} , function(data) { - scope.template = data; - scope.text = data.text; - }); - scope.deleteTemplate = function (){ - $modal.open({ - templateUrl: 'deletetemplate.html', - controller: TemplateDeleteCtrl +(function (module) { + mifosX.controllers = _.extend(module, { + ViewTemplateController: function (scope, routeParams, resourceFactory, location, $modal) { + resourceFactory.templateResource.getTemplateDetails({templateId: routeParams.id}, function (data) { + scope.template = data; + scope.text = data.text; }); - }; - var TemplateDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.templateResource.delete({templateId: routeParams.id}, {}, function(data) { - location.path('/templates'); - // added dummy request param because Content-Type header gets removed - // if the request does not contain any data (a request body) + scope.deleteTemplate = function () { + $modal.open({ + templateUrl: 'deletetemplate.html', + controller: TemplateDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var TemplateDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.templateResource.delete({templateId: routeParams.id}, {}, function (data) { + location.path('/templates'); + // added dummy request param because Content-Type header gets removed + // if the request does not contain any data (a request body) + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewTemplateController', ['$scope', '$routeParams','ResourceFactory', '$location','$modal', mifosX.controllers.ViewTemplateController]).run(function($log) { - $log.info("ViewTemplateController initialized"); - }); + } + }); + mifosX.ng.application.controller('ViewTemplateController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', mifosX.controllers.ViewTemplateController]).run(function ($log) { + $log.info("ViewTemplateController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/user/UserController.js b/app/scripts/controllers/user/UserController.js index 18ee8081..053878b8 100644 --- a/app/scripts/controllers/user/UserController.js +++ b/app/scripts/controllers/user/UserController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - UserController: function(scope, resourceFactory) { - scope.users = []; - scope.newUserFormDialog = function() { - scope.$broadcast('OpenUserFormDialog', {title: 'New User'}); - }; - resourceFactory.userResource.getAllUsers({fields: "id,firstname,lastname,username,officeName"}, function(data) { - scope.users = data; - }); - } - }); - mifosX.ng.application.controller('UserController', ['$scope', 'ResourceFactory', mifosX.controllers.UserController]).run(function($log) { - $log.info("UserController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + UserController: function (scope, resourceFactory) { + scope.users = []; + scope.newUserFormDialog = function () { + scope.$broadcast('OpenUserFormDialog', {title: 'New User'}); + }; + resourceFactory.userResource.getAllUsers({fields: "id,firstname,lastname,username,officeName"}, function (data) { + scope.users = data; + }); + } + }); + mifosX.ng.application.controller('UserController', ['$scope', 'ResourceFactory', mifosX.controllers.UserController]).run(function ($log) { + $log.info("UserController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/user/UserFormController.js b/app/scripts/controllers/user/UserFormController.js index 4a40d3d6..bebab7df 100644 --- a/app/scripts/controllers/user/UserFormController.js +++ b/app/scripts/controllers/user/UserFormController.js @@ -1,57 +1,59 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - UserFormController: function(scope, resourceFactory) { - scope.offices = []; - scope.roles = []; - resourceFactory.officeResource.getAllOffices({}, function(data) { - scope.offices = data; - }); - resourceFactory.roleResource.getAllRoles({}, function(data) { - scope.roles = data; - }); +(function (module) { + mifosX.controllers = _.extend(module, { + UserFormController: function (scope, resourceFactory) { + scope.offices = []; + scope.roles = []; + resourceFactory.officeResource.getAllOffices({}, function (data) { + scope.offices = data; + }); + resourceFactory.roleResource.getAllRoles({}, function (data) { + scope.roles = data; + }); - scope.$on('OpenUserFormDialog', function() { - scope.userFormData = {selectedRoles: {}, sendPasswordToEmail: false}; - scope.formInError = false; - scope.errors = []; - }); + scope.$on('OpenUserFormDialog', function () { + scope.userFormData = {selectedRoles: {}, sendPasswordToEmail: false}; + scope.formInError = false; + scope.errors = []; + }); - scope.submitUserForm = function() { - scope.formInError = false; - scope.errors = []; - var userData = { - username: scope.userFormData.username, - firstname: scope.userFormData.firstname, - lastname: scope.userFormData.lastname, - email: scope.userFormData.email, - officeId: scope.userFormData.office.id, - sendPasswordToEmail: scope.userFormData.sendPasswordToEmail, - roles: _.map( - _.keys(scope.userFormData.selectedRoles), function(roleId) {return parseInt(roleId, 10);} - ) - }; + scope.submitUserForm = function () { + scope.formInError = false; + scope.errors = []; + var userData = { + username: scope.userFormData.username, + firstname: scope.userFormData.firstname, + lastname: scope.userFormData.lastname, + email: scope.userFormData.email, + officeId: scope.userFormData.office.id, + sendPasswordToEmail: scope.userFormData.sendPasswordToEmail, + roles: _.map( + _.keys(scope.userFormData.selectedRoles), function (roleId) { + return parseInt(roleId, 10); + } + ) + }; - scope.$emit('SubmitUserFormStart'); - new resourceFactory.userResource(userData).$save({}, - function(data) { - userData.id = data.resourceId; - scope.users.push(userData); - scope.$emit('SubmitUserFormSuccess'); - }, - function(response) { - scope.formInError = true; - scope.errors = response.data.errors; - scope.$emit('SubmitUserFormError'); - } - ); - }; + scope.$emit('SubmitUserFormStart'); + new resourceFactory.userResource(userData).$save({}, + function (data) { + userData.id = data.resourceId; + scope.users.push(userData); + scope.$emit('SubmitUserFormSuccess'); + }, + function (response) { + scope.formInError = true; + scope.errors = response.data.errors; + scope.$emit('SubmitUserFormError'); + } + ); + }; - scope.cancelUserForm = function() { - scope.$emit('CloseUserForm'); - }; - } - }); - mifosX.ng.application.controller('UserFormController', ['$scope', 'ResourceFactory', mifosX.controllers.UserFormController]).run(function($log) { - $log.info("UserFormController initialized"); - }); + scope.cancelUserForm = function () { + scope.$emit('CloseUserForm'); + }; + } + }); + mifosX.ng.application.controller('UserFormController', ['$scope', 'ResourceFactory', mifosX.controllers.UserFormController]).run(function ($log) { + $log.info("UserFormController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/user/UserListController.js b/app/scripts/controllers/user/UserListController.js index 78739d2f..474324e2 100644 --- a/app/scripts/controllers/user/UserListController.js +++ b/app/scripts/controllers/user/UserListController.js @@ -1,16 +1,16 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - UserListController: function(scope, resourceFactory,location) { - scope.users = []; - scope.routeTo = function(id){ - location.path('/viewuser/' + id); - }; - resourceFactory.userListResource.getAllUsers(function(data) { - scope.users = data; - }); - } - }); - mifosX.ng.application.controller('UserListController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.UserListController]).run(function($log) { - $log.info("UserListController initialized"); - }); +(function (module) { + mifosX.controllers = _.extend(module, { + UserListController: function (scope, resourceFactory, location) { + scope.users = []; + scope.routeTo = function (id) { + location.path('/viewuser/' + id); + }; + resourceFactory.userListResource.getAllUsers(function (data) { + scope.users = data; + }); + } + }); + mifosX.ng.application.controller('UserListController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.UserListController]).run(function ($log) { + $log.info("UserListController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/user/UserSettingController.js b/app/scripts/controllers/user/UserSettingController.js index 3fba9d85..5ea943c6 100644 --- a/app/scripts/controllers/user/UserSettingController.js +++ b/app/scripts/controllers/user/UserSettingController.js @@ -1,41 +1,41 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - UserSettingController: function(scope, translate,localStorageService) { - if(localStorageService.get('Language')){ - var temp=localStorageService.get('Language'); - for(var i in mifosX.models.Langs){ - if(mifosX.models.Langs[i].code == temp.code){ - scope.optlang = mifosX.models.Langs[i]; +(function (module) { + mifosX.controllers = _.extend(module, { + UserSettingController: function (scope, translate, localStorageService) { + if (localStorageService.get('Language')) { + var temp = localStorageService.get('Language'); + for (var i in mifosX.models.Langs) { + if (mifosX.models.Langs[i].code == temp.code) { + scope.optlang = mifosX.models.Langs[i]; + } } + } else { + scope.optlang = scope.langs[0]; } - }else{ - scope.optlang = scope.langs[0]; + translate.uses(scope.optlang.code); + scope.dates = [ + 'dd MMMM yyyy', + 'dd/MMMM/yyyy', + 'dd-MMMM-yyyy', + 'MMMM-dd-yyyy', + 'MMMM dd yyyy', + 'MMMM/dd/yyyy' + ]; + scope.$watch(function () { + return scope.dateformat; + }, function () { + localStorageService.add('dateformat', scope.dateformat); + scope.df = scope.dateformat; + }); + scope.langs = mifosX.models.Langs; + scope.changeLang = function (lang) { + translate.uses(lang.code); + localStorageService.add('Language', scope.optlang); + }; + } - translate.uses(scope.optlang.code); - scope.dates = [ - 'dd MMMM yyyy', - 'dd/MMMM/yyyy', - 'dd-MMMM-yyyy', - 'MMMM-dd-yyyy', - 'MMMM dd yyyy', - 'MMMM/dd/yyyy' - ]; - scope.$watch(function() { - return scope.dateformat; - }, function() { - localStorageService.add('dateformat',scope.dateformat); - scope.df = scope.dateformat; - }); - scope.langs = mifosX.models.Langs; - scope.changeLang = function (lang) { - translate.uses(lang.code); - localStorageService.add('Language',scope.optlang); - }; + }); - } - }); - - mifosX.ng.application.controller('UserSettingController', ['$scope', '$translate','localStorageService', mifosX.controllers.UserSettingController]).run(function($log) { - $log.info("UserSettingController initialized"); - }); + mifosX.ng.application.controller('UserSettingController', ['$scope', '$translate', 'localStorageService', mifosX.controllers.UserSettingController]).run(function ($log) { + $log.info("UserSettingController initialized"); + }); }(mifosX.controllers || {})); \ No newline at end of file diff --git a/app/scripts/controllers/user/ViewUserController.js b/app/scripts/controllers/user/ViewUserController.js index 9365d4c1..f127b8dd 100644 --- a/app/scripts/controllers/user/ViewUserController.js +++ b/app/scripts/controllers/user/ViewUserController.js @@ -1,51 +1,51 @@ -(function(module) { - mifosX.controllers = _.extend(module, { - ViewUserController: function(scope, routeParams, route, location, resourceFactory, $modal ) { - scope.user = []; - resourceFactory.userListResource.get({userId: routeParams.id} , function(data) { - scope.user = data; - }); - scope.open = function () { - $modal.open({ - templateUrl: 'password.html', - controller: ModalInstanceCtrl +(function (module) { + mifosX.controllers = _.extend(module, { + ViewUserController: function (scope, routeParams, route, location, resourceFactory, $modal) { + scope.user = []; + resourceFactory.userListResource.get({userId: routeParams.id}, function (data) { + scope.user = data; }); - }; - scope.deleteuser = function (){ - $modal.open({ - templateUrl: 'deleteuser.html', - controller: UserDeleteCtrl - }); - }; - var ModalInstanceCtrl = function ($scope, $modalInstance) { - $scope.save = function (staffId) { - resourceFactory.userListResource.update({'userId': routeParams.id},this.formData,function(data){ - route.reload(); + scope.open = function () { + $modal.open({ + templateUrl: 'password.html', + controller: ModalInstanceCtrl }); - $modalInstance.close('activate'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }; - - var UserDeleteCtrl = function ($scope, $modalInstance) { - $scope.delete = function () { - resourceFactory.userListResource.delete({userId: routeParams.id} , {} , function(data) { - location.path('/users'); - // added dummy request param because Content-Type header gets removed - // if the request does not contain any data (a request body) + scope.deleteuser = function () { + $modal.open({ + templateUrl: 'deleteuser.html', + controller: UserDeleteCtrl }); - $modalInstance.close('delete'); }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); + var ModalInstanceCtrl = function ($scope, $modalInstance) { + $scope.save = function (staffId) { + resourceFactory.userListResource.update({'userId': routeParams.id}, this.formData, function (data) { + route.reload(); + }); + $modalInstance.close('activate'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; }; - }; - } - }); - mifosX.ng.application.controller('ViewUserController', ['$scope', '$routeParams','$route', '$location', 'ResourceFactory','$modal', mifosX.controllers.ViewUserController]).run(function($log) { - $log.info("ViewUserController initialized"); - }); + var UserDeleteCtrl = function ($scope, $modalInstance) { + $scope.delete = function () { + resourceFactory.userListResource.delete({userId: routeParams.id}, {}, function (data) { + location.path('/users'); + // added dummy request param because Content-Type header gets removed + // if the request does not contain any data (a request body) + }); + $modalInstance.close('delete'); + }; + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + + } + }); + mifosX.ng.application.controller('ViewUserController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', '$modal', mifosX.controllers.ViewUserController]).run(function ($log) { + $log.info("ViewUserController initialized"); + }); }(mifosX.controllers || {})); diff --git a/app/scripts/directives/ActivitiesDisplayPanelDirective.js b/app/scripts/directives/ActivitiesDisplayPanelDirective.js index 4b019df1..d481847c 100644 --- a/app/scripts/directives/ActivitiesDisplayPanelDirective.js +++ b/app/scripts/directives/ActivitiesDisplayPanelDirective.js @@ -1,6 +1,6 @@ -(function(module) { +(function (module) { mifosX.directives = _.extend(module, { - ActivitiesDisplayPanelDirective: function() { + ActivitiesDisplayPanelDirective: function () { return { restrict: "E", transclude: true, @@ -8,17 +8,16 @@ title: "@" }, - template: - "
" + - "
" + - "
{{title}}
" + - "
" + template: "
" + + "
" + + "
{{title}}
" + + "
" }; } }); }(mifosX.directives || {})); -mifosX.ng.application.directive("ngDisplaypanel", [mifosX.directives.ActivitiesDisplayPanelDirective]).run(function($log) { +mifosX.ng.application.directive("ngDisplaypanel", [mifosX.directives.ActivitiesDisplayPanelDirective]).run(function ($log) { $log.info("ActivitiesDisplayPanelDirective initialized"); }); \ No newline at end of file diff --git a/app/scripts/directives/ApiValidationDirective.js b/app/scripts/directives/ApiValidationDirective.js index 71817944..08460386 100644 --- a/app/scripts/directives/ApiValidationDirective.js +++ b/app/scripts/directives/ApiValidationDirective.js @@ -1,17 +1,17 @@ -(function(module) { +(function (module) { mifosX.directives = _.extend(module, { - ApiValidationDirective: function($compile) { + ApiValidationDirective: function ($compile) { return { restrict: 'E', require: '?ngmodel', - link: function(scope, elm, attr, ctrl) { - var template = '
'+ - ''+ - ''+ - '
TitleDimensionValue
' + this.tagName + '' + context + '
\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " 0\">\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - "
#{{label | translate}}
{{ getWeekNumber(row) }}\n" + - " \n" + - "
\n" , + template: "\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " 0\">\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
#{{label | translate}}
{{ getWeekNumber(row) }}\n" + + " \n" + + "
\n", scope: { dateDisabled: '&' }, require: ['datepick', '?^ngModel'], controller: 'DatepickController', - link: function(scope, element, attrs, ctrls) { + link: function (scope, element, attrs, ctrls) { var datepickerCtrl = ctrls[0], ngModel = ctrls[1]; if (!ngModel) { @@ -246,8 +245,8 @@ angular.module('modified.datepicker', ['strap.position']) var mode = 0, selected = new Date(), showWeeks = datepickerConf.showWeeks; if (attrs.showWeeks) { - scope.$parent.$watch($parse(attrs.showWeeks), function(value) { - showWeeks = !! value; + scope.$parent.$watch($parse(attrs.showWeeks), function (value) { + showWeeks = !!value; updateShowWeekNumbers(); }); } else { @@ -255,13 +254,13 @@ angular.module('modified.datepicker', ['strap.position']) } if (attrs.min) { - scope.$parent.$watch($parse(attrs.min), function(value) { + scope.$parent.$watch($parse(attrs.min), function (value) { datepickerCtrl.minDate = value ? new Date(value) : null; refill(); }); } if (attrs.max) { - scope.$parent.$watch($parse(attrs.max), function(value) { + scope.$parent.$watch($parse(attrs.max), function (value) { datepickerCtrl.maxDate = value ? new Date(value) : null; refill(); }); @@ -280,23 +279,23 @@ angular.module('modified.datepicker', ['strap.position']) return arrays; } - function refill( updateSelected ) { + function refill(updateSelected) { var date = null, valid = true; - if ( ngModel.$modelValue ) { - date = new Date( ngModel.$modelValue ); + if (ngModel.$modelValue) { + date = new Date(ngModel.$modelValue); - if ( isNaN(date) ) { + if (isNaN(date)) { valid = false; $log.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.'); - } else if ( updateSelected ) { + } else if (updateSelected) { selected = date; } } ngModel.$setValidity('date', valid); var currentMode = datepickerCtrl.modes[mode], data = currentMode.getVisibleDates(selected, date); - angular.forEach(data.objects, function(obj) { + angular.forEach(data.objects, function (obj) { obj.disabled = datepickerCtrl.isDisabled(obj.date, mode); }); @@ -313,31 +312,31 @@ angular.module('modified.datepicker', ['strap.position']) refill(); } - ngModel.$render = function() { - refill( true ); + ngModel.$render = function () { + refill(true); }; - scope.select = function( date ) { - if ( mode === 0 ) { - var dt = new Date( ngModel.$modelValue ); - dt.setFullYear( date.getFullYear(), date.getMonth(), date.getDate() ); - ngModel.$setViewValue( dt ); - refill( true ); + scope.select = function (date) { + if (mode === 0) { + var dt = new Date(ngModel.$modelValue); + dt.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); + ngModel.$setViewValue(dt); + refill(true); } else { selected = date; - setMode( mode - 1 ); + setMode(mode - 1); } }; - scope.move = function(direction) { + scope.move = function (direction) { var step = datepickerCtrl.modes[mode].step; - selected.setMonth( selected.getMonth() + direction * (step.months || 0) ); - selected.setFullYear( selected.getFullYear() + direction * (step.years || 0) ); + selected.setMonth(selected.getMonth() + direction * (step.months || 0)); + selected.setFullYear(selected.getFullYear() + direction * (step.years || 0)); refill(); }; - scope.toggleMode = function() { - setMode( (mode + 1) % datepickerCtrl.modes.length ); + scope.toggleMode = function () { + setMode((mode + 1) % datepickerCtrl.modes.length); }; - scope.getWeekNumber = function(row) { + scope.getWeekNumber = function (row) { return ( mode === 0 && scope.showWeekNumbers && row.length === 7 ) ? getISO8601WeekNumber(row[0].date) : null; }; @@ -363,25 +362,26 @@ angular.module('modified.datepicker', ['strap.position']) return { restrict: 'EA', require: 'ngModel', - link: function(originalScope, element, attrs, ngModel) { + link: function (originalScope, element, attrs, ngModel) { var closeOnDateSelection = angular.isDefined(attrs.closeOnDateSelection) ? scope.$eval(attrs.closeOnDateSelection) : datepickerPopConfig.closeOnDateSelection; var dateFormat = attrs.datepickerPop || datepickerPopConfig.dateFormat; // create a child scope for the datepicker directive so we are not polluting original scope var scope = originalScope.$new(); - originalScope.$on('$destroy', function() { + originalScope.$on('$destroy', function () { scope.$destroy(); }); function formatDate(value) { return (value) ? dateFilter(value, dateFormat) : null; } + ngModel.$formatters.push(formatDate); // TODO: reverse from dateFilter string to Date object function parseDate(value) { - if ( value ) { + if (value) { var date = new Date(value); if (!isNaN(date)) { return date; @@ -389,20 +389,21 @@ angular.module('modified.datepicker', ['strap.position']) } return value; } + ngModel.$parsers.push(parseDate); var getIsOpen, setIsOpen; - if ( attrs.open ) { + if (attrs.open) { getIsOpen = $parse(attrs.open); setIsOpen = getIsOpen.assign; originalScope.$watch(getIsOpen, function updateOpen(value) { - scope.isOpen = !! value; + scope.isOpen = !!value; }); } scope.isOpen = getIsOpen ? getIsOpen(originalScope) : false; // Initial state - function setOpen( value ) { + function setOpen(value) { if (setIsOpen) { setIsOpen(originalScope, !!value); } else { @@ -410,17 +411,17 @@ angular.module('modified.datepicker', ['strap.position']) } } - var documentClickBind = function(event) { + var documentClickBind = function (event) { if (scope.isOpen && event.target !== element[0]) { - scope.$apply(function() { + scope.$apply(function () { setOpen(false); }); } }; - var elementFocusBind = function() { - scope.$apply(function() { - setOpen( true ); + var elementFocusBind = function () { + scope.$apply(function () { + setOpen(true); }); }; @@ -438,17 +439,17 @@ angular.module('modified.datepicker', ['strap.position']) var $setModelValue = $parse(attrs.ngModel).assign; // Inner change - scope.dateSelection = function() { + scope.dateSelection = function () { $setModelValue(originalScope, scope.date); if (closeOnDateSelection) { - setOpen( false ); + setOpen(false); } }; // Outter change - scope.$watch(function() { + scope.$watch(function () { return ngModel.$modelValue; - }, function(value) { + }, function (value) { if (angular.isString(value)) { var date = parseDate(value); @@ -465,12 +466,13 @@ angular.module('modified.datepicker', ['strap.position']) function addWatchableAttribute(attribute, scopeProperty, datepickerAttribute) { if (attribute) { - originalScope.$watch($parse(attribute), function(value){ + originalScope.$watch($parse(attribute), function (value) { scope[scopeProperty] = value; }); datepickerEl.attr(datepickerAttribute || scopeProperty, scopeProperty); } } + addWatchableAttribute(attrs.min, 'min'); addWatchableAttribute(attrs.max, 'max'); if (attrs.showWeeks) { @@ -488,7 +490,7 @@ angular.module('modified.datepicker', ['strap.position']) scope.position.top = scope.position.top + element.prop('offsetHeight'); } - scope.$watch('isOpen', function(value) { + scope.$watch('isOpen', function (value) { if (value) { updatePosition(); $document.bind('click', documentClickBind); @@ -499,15 +501,15 @@ angular.module('modified.datepicker', ['strap.position']) element.bind('focus', elementFocusBind); } - if ( setIsOpen ) { + if (setIsOpen) { setIsOpen(originalScope, value); } }); - scope.today = function() { + scope.today = function () { $setModelValue(originalScope, new Date()); }; - scope.clear = function() { + scope.clear = function () { $setModelValue(originalScope, null); }; @@ -516,17 +518,16 @@ angular.module('modified.datepicker', ['strap.position']) }; }]) - .directive('datepickerPopWrap', [function() { + .directive('datepickerPopWrap', [function () { return { - restrict:'E', + restrict: 'E', replace: true, transclude: true, - template: - "
    \n" + - "
  • \n" + - "
", - link:function (scope, element, attrs) { - element.bind('click', function(event) { + template: "
    \n" + + "
  • \n" + + "
", + link: function (scope, element, attrs) { + element.bind('click', function (event) { event.preventDefault(); event.stopPropagation(); }); diff --git a/app/scripts/modules/localstorage.js b/app/scripts/modules/localstorage.js index 6f23c6a5..661622eb 100644 --- a/app/scripts/modules/localstorage.js +++ b/app/scripts/modules/localstorage.js @@ -1,270 +1,270 @@ -(function() { -/* Start angularLocalStorage */ +(function () { + /* Start angularLocalStorage */ -var angularLocalStorage = angular.module('LocalStorageModule', []); + var angularLocalStorage = angular.module('LocalStorageModule', []); // You should set a prefix to avoid overwriting any local storage variables from the rest of your app // e.g. angularLocalStorage.constant('prefix', 'youAppName'); -angularLocalStorage.value('prefix', 'ls'); + angularLocalStorage.value('prefix', 'ls'); // Cookie options (usually in case of fallback) // expiry = Number of days before cookies expire // 0 = Does not expire // path = The web path the cookie represents -angularLocalStorage.constant('cookie', { expiry:30, path: '/'}); -angularLocalStorage.constant('notify', { setItem: true, removeItem: false} ); + angularLocalStorage.constant('cookie', { expiry: 30, path: '/'}); + angularLocalStorage.constant('notify', { setItem: true, removeItem: false}); -angularLocalStorage.service('localStorageService', [ - '$rootScope', - 'prefix', - 'cookie', - 'notify', - function($rootScope, prefix, cookie, notify) { + angularLocalStorage.service('localStorageService', [ + '$rootScope', + 'prefix', + 'cookie', + 'notify', + function ($rootScope, prefix, cookie, notify) { - // If there is a prefix set in the config lets use that with an appended period for readability - //var prefix = angularLocalStorage.constant; - if (prefix.substr(-1)!=='.') { - prefix = !!prefix ? prefix + '.' : ''; - } + // If there is a prefix set in the config lets use that with an appended period for readability + //var prefix = angularLocalStorage.constant; + if (prefix.substr(-1) !== '.') { + prefix = !!prefix ? prefix + '.' : ''; + } - // Checks the browser to see if local storage is supported - var browserSupportsLocalStorage = function () { - try { - return ('localStorage' in window && window['localStorage'] !== null); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return false; - } - }; + // Checks the browser to see if local storage is supported + var browserSupportsLocalStorage = function () { + try { + return ('localStorage' in window && window['localStorage'] !== null); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }; - // Directly adds a value to local storage - // If local storage is not available in the browser use cookies - // Example use: localStorageService.add('library','angular'); - var addToLocalStorage = function (key, value) { + // Directly adds a value to local storage + // If local storage is not available in the browser use cookies + // Example use: localStorageService.add('library','angular'); + var addToLocalStorage = function (key, value) { - // If this browser does not support local storage use cookies - if (!browserSupportsLocalStorage()) { - $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); - if (notify.setItem) { - $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); - } - return addToCookies(key, value); - } + // If this browser does not support local storage use cookies + if (!browserSupportsLocalStorage()) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'cookie'}); + } + return addToCookies(key, value); + } - // Let's convert undefined values to null to get the value consistent - if (typeof value == "undefined") { - value = null; - } + // Let's convert undefined values to null to get the value consistent + if (typeof value == "undefined") { + value = null; + } - try { - if (angular.isObject(value) || angular.isArray(value)) { - value = angular.toJson(value); - } - localStorage.setItem(prefix+key, value); - if (notify.setItem) { - $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'localStorage'}); - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return addToCookies(key, value); - } - return true; - }; + try { + if (angular.isObject(value) || angular.isArray(value)) { + value = angular.toJson(value); + } + localStorage.setItem(prefix + key, value); + if (notify.setItem) { + $rootScope.$broadcast('LocalStorageModule.notification.setitem', {key: key, newvalue: value, storageType: 'localStorage'}); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return addToCookies(key, value); + } + return true; + }; - // Directly get a value from local storage - // Example use: localStorageService.get('library'); // returns 'angular' - var getFromLocalStorage = function (key) { - if (!browserSupportsLocalStorage()) { - $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); - return getFromCookies(key); - } + // Directly get a value from local storage + // Example use: localStorageService.get('library'); // returns 'angular' + var getFromLocalStorage = function (key) { + if (!browserSupportsLocalStorage()) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return getFromCookies(key); + } - var item = localStorage.getItem(prefix+key); - // angular.toJson will convert null to 'null', so a proper conversion is needed - // FIXME not a perfect solution, since a valid 'null' string can't be stored - if (!item || item === 'null') return null; + var item = localStorage.getItem(prefix + key); + // angular.toJson will convert null to 'null', so a proper conversion is needed + // FIXME not a perfect solution, since a valid 'null' string can't be stored + if (!item || item === 'null') return null; - if (item.charAt(0) === "{" || item.charAt(0) === "[") { - return angular.fromJson(item); - } - return item; - }; + if (item.charAt(0) === "{" || item.charAt(0) === "[") { + return angular.fromJson(item); + } + return item; + }; - // Remove an item from local storage - // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' - var removeFromLocalStorage = function (key) { - if (!browserSupportsLocalStorage()) { - $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); - if (notify.removeItem) { - $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); - } - return removeFromCookies(key); - } + // Remove an item from local storage + // Example use: localStorageService.remove('library'); // removes the key/value pair of library='angular' + var removeFromLocalStorage = function (key) { + if (!browserSupportsLocalStorage()) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'cookie'}); + } + return removeFromCookies(key); + } - try { - localStorage.removeItem(prefix+key); - if (notify.removeItem) { - $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'localStorage'}); - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return removeFromCookies(key); - } - return true; - }; + try { + localStorage.removeItem(prefix + key); + if (notify.removeItem) { + $rootScope.$broadcast('LocalStorageModule.notification.removeitem', {key: key, storageType: 'localStorage'}); + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return removeFromCookies(key); + } + return true; + }; - // Return array of keys for local storage - // Example use: var keys = localStorageService.keys() - var getKeysForLocalStorage = function () { + // Return array of keys for local storage + // Example use: var keys = localStorageService.keys() + var getKeysForLocalStorage = function () { - if (!browserSupportsLocalStorage()) { - $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); - return false; - } + if (!browserSupportsLocalStorage()) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return false; + } - var prefixLength = prefix.length; - var keys = []; - for (var key in localStorage) { - // Only return keys that are for this app - if (key.substr(0,prefixLength) === prefix) { - try { - keys.push(key.substr(prefixLength)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.Description); - return []; - } - } - } - return keys; - }; + var prefixLength = prefix.length; + var keys = []; + for (var key in localStorage) { + // Only return keys that are for this app + if (key.substr(0, prefixLength) === prefix) { + try { + keys.push(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.Description); + return []; + } + } + } + return keys; + }; - // Remove all data for this app from local storage - // Example use: localStorageService.clearAll(); - // Should be used mostly for development purposes - var clearAllFromLocalStorage = function () { + // Remove all data for this app from local storage + // Example use: localStorageService.clearAll(); + // Should be used mostly for development purposes + var clearAllFromLocalStorage = function () { - if (!browserSupportsLocalStorage()) { - $rootScope.$broadcast('LocalStorageModule.notification.warning','LOCAL_STORAGE_NOT_SUPPORTED'); - return clearAllFromCookies(); - } + if (!browserSupportsLocalStorage()) { + $rootScope.$broadcast('LocalStorageModule.notification.warning', 'LOCAL_STORAGE_NOT_SUPPORTED'); + return clearAllFromCookies(); + } - var prefixLength = prefix.length; + var prefixLength = prefix.length; - for (var key in localStorage) { - // Only remove items that are for this app - if (key.substr(0,prefixLength) === prefix) { - try { - removeFromLocalStorage(key.substr(prefixLength)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return clearAllFromCookies(); - } - } - } - return true; - }; + for (var key in localStorage) { + // Only remove items that are for this app + if (key.substr(0, prefixLength) === prefix) { + try { + removeFromLocalStorage(key.substr(prefixLength)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return clearAllFromCookies(); + } + } + } + return true; + }; - // Checks the browser to see if cookies are supported - var browserSupportsCookies = function() { - try { - return navigator.cookieEnabled || - ("cookie" in document && (document.cookie.length > 0 || - (document.cookie = "test").indexOf.call(document.cookie, "test") > -1)); - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return false; - } - }; + // Checks the browser to see if cookies are supported + var browserSupportsCookies = function () { + try { + return navigator.cookieEnabled || + ("cookie" in document && (document.cookie.length > 0 || + (document.cookie = "test").indexOf.call(document.cookie, "test") > -1)); + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + }; - // Directly adds a value to cookies - // Typically used as a fallback is local storage is not available in the browser - // Example use: localStorageService.cookie.add('library','angular'); - var addToCookies = function (key, value) { + // Directly adds a value to cookies + // Typically used as a fallback is local storage is not available in the browser + // Example use: localStorageService.cookie.add('library','angular'); + var addToCookies = function (key, value) { - if (typeof value == "undefined") { - return false; - } + if (typeof value == "undefined") { + return false; + } - if (!browserSupportsCookies()) { - $rootScope.$broadcast('LocalStorageModule.notification.error','COOKIES_NOT_SUPPORTED'); - return false; - } + if (!browserSupportsCookies()) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } - try { - var expiry = '', expiryDate = new Date(); - if (value === null) { - // Mark that the cookie has expired one day ago - expiryDate.setTime(expiryDate.getTime() + (-1 * 24*60*60*1000)); - expiry = "; expires="+expiryDate.toGMTString(); + try { + var expiry = '', expiryDate = new Date(); + if (value === null) { + // Mark that the cookie has expired one day ago + expiryDate.setTime(expiryDate.getTime() + (-1 * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); - value = ''; - } else if (cookie.expiry !== 0) { - expiryDate.setTime(expiryDate.getTime() + (cookie.expiry*24*60*60*1000)); - expiry = "; expires="+expiryDate.toGMTString(); - } - if (!!key) { - document.cookie = prefix + key + "=" + encodeURIComponent(value) + expiry + "; path="+cookie.path; - } - } catch (e) { - $rootScope.$broadcast('LocalStorageModule.notification.error',e.message); - return false; - } - return true; - }; + value = ''; + } else if (cookie.expiry !== 0) { + expiryDate.setTime(expiryDate.getTime() + (cookie.expiry * 24 * 60 * 60 * 1000)); + expiry = "; expires=" + expiryDate.toGMTString(); + } + if (!!key) { + document.cookie = prefix + key + "=" + encodeURIComponent(value) + expiry + "; path=" + cookie.path; + } + } catch (e) { + $rootScope.$broadcast('LocalStorageModule.notification.error', e.message); + return false; + } + return true; + }; - // Directly get a value from a cookie - // Example use: localStorageService.cookie.get('library'); // returns 'angular' - var getFromCookies = function (key) { - if (!browserSupportsCookies()) { - $rootScope.$broadcast('LocalStorageModule.notification.error','COOKIES_NOT_SUPPORTED'); - return false; - } + // Directly get a value from a cookie + // Example use: localStorageService.cookie.get('library'); // returns 'angular' + var getFromCookies = function (key) { + if (!browserSupportsCookies()) { + $rootScope.$broadcast('LocalStorageModule.notification.error', 'COOKIES_NOT_SUPPORTED'); + return false; + } - var cookies = document.cookie.split(';'); - for(var i=0;i < cookies.length;i++) { - var thisCookie = cookies[i]; - while (thisCookie.charAt(0)==' ') { - thisCookie = thisCookie.substring(1,thisCookie.length); - } - if (thisCookie.indexOf(prefix+key+'=') === 0) { - return decodeURIComponent(thisCookie.substring(prefix.length+key.length+1,thisCookie.length)); - } - } - return null; - }; + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var thisCookie = cookies[i]; + while (thisCookie.charAt(0) == ' ') { + thisCookie = thisCookie.substring(1, thisCookie.length); + } + if (thisCookie.indexOf(prefix + key + '=') === 0) { + return decodeURIComponent(thisCookie.substring(prefix.length + key.length + 1, thisCookie.length)); + } + } + return null; + }; - var removeFromCookies = function (key) { - addToCookies(key,null); - }; + var removeFromCookies = function (key) { + addToCookies(key, null); + }; - var clearAllFromCookies = function () { - var thisCookie = null, thisKey = null; - var prefixLength = prefix.length; - var cookies = document.cookie.split(';'); - for(var i=0;i < cookies.length;i++) { - thisCookie = cookies[i]; - while (thisCookie.charAt(0)==' ') { - thisCookie = thisCookie.substring(1,thisCookie.length); - } - key = thisCookie.substring(prefixLength,thisCookie.indexOf('=')); - removeFromCookies(key); - } - }; + var clearAllFromCookies = function () { + var thisCookie = null, thisKey = null; + var prefixLength = prefix.length; + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + thisCookie = cookies[i]; + while (thisCookie.charAt(0) == ' ') { + thisCookie = thisCookie.substring(1, thisCookie.length); + } + key = thisCookie.substring(prefixLength, thisCookie.indexOf('=')); + removeFromCookies(key); + } + }; - return { - isSupported: browserSupportsLocalStorage, - set: addToLocalStorage, - add: addToLocalStorage, //DEPRECATED - get: getFromLocalStorage, - keys: getKeysForLocalStorage, - remove: removeFromLocalStorage, - clearAll: clearAllFromLocalStorage, - cookie: { - set: addToCookies, - add: addToCookies, //DEPRECATED - get: getFromCookies, - remove: removeFromCookies, - clearAll: clearAllFromCookies - } - }; + return { + isSupported: browserSupportsLocalStorage, + set: addToLocalStorage, + add: addToLocalStorage, //DEPRECATED + get: getFromLocalStorage, + keys: getKeysForLocalStorage, + remove: removeFromLocalStorage, + clearAll: clearAllFromLocalStorage, + cookie: { + set: addToCookies, + add: addToCookies, //DEPRECATED + get: getFromCookies, + remove: removeFromCookies, + clearAll: clearAllFromCookies + } + }; -}]); + }]); }).call(this); diff --git a/app/scripts/modules/notificationWidget.js b/app/scripts/modules/notificationWidget.js index 8ef34702..906b2ecb 100644 --- a/app/scripts/modules/notificationWidget.js +++ b/app/scripts/modules/notificationWidget.js @@ -11,144 +11,146 @@ // Declare module which depends on filters, and services angular.module('notificationWidget', []) // Declare an http interceptor that will signal the start and end of each request -.config(['$httpProvider', function ($httpProvider) { - var $http, - interceptor = ['$q', '$injector', '$location', '$rootScope', function ($q, $injector, $location, $rootScope) { - var notificationChannel; + .config(['$httpProvider', function ($httpProvider) { + var $http, + interceptor = ['$q', '$injector', '$location', '$rootScope', function ($q, $injector, $location, $rootScope) { + var notificationChannel; - function removeErrors() { - var $inputs = $(':input'); - $inputs.each(function() { - $(this).removeClass("validationerror"); - }); - } - - function success(response) { - // clear previous errors for a success request. - delete $rootScope.errorStatus; - delete $rootScope.errorDetails; - removeErrors(); - // get $http via $injector because of circular dependency problem - $http = $http || $injector.get('$http'); - // don't send notification until all requests are complete - if ($http.pendingRequests.length < 1) { - // get requestNotificationChannel via $injector because of circular dependency problem - notificationChannel = notificationChannel || $injector.get('requestNotificationChannel'); - // send a notification requests are complete - notificationChannel.requestEnded(); + function removeErrors() { + var $inputs = $(':input'); + $inputs.each(function () { + $(this).removeClass("validationerror"); + }); } - if(response.config && response.config.method=="GET"){ - return response; - }else { - if (response.data && response.data.commandId) { - //Maker checker is enabled or performing actions of maker checker - if (response.config.url.indexOf('makercheckers/') > 0) { - //return response for maker checker actions(approve or delete) - return response; - } else{ - //redirect if maker checker is enabled - $location.path('/viewMakerCheckerTask/'+response.data.commandId); - } - } else{ - //when no maker checker enabled + + function success(response) { + // clear previous errors for a success request. + delete $rootScope.errorStatus; + delete $rootScope.errorDetails; + removeErrors(); + // get $http via $injector because of circular dependency problem + $http = $http || $injector.get('$http'); + // don't send notification until all requests are complete + if ($http.pendingRequests.length < 1) { + // get requestNotificationChannel via $injector because of circular dependency problem + notificationChannel = notificationChannel || $injector.get('requestNotificationChannel'); + // send a notification requests are complete + notificationChannel.requestEnded(); + } + if (response.config && response.config.method == "GET") { return response; - }; + } else { + if (response.data && response.data.commandId) { + //Maker checker is enabled or performing actions of maker checker + if (response.config.url.indexOf('makercheckers/') > 0) { + //return response for maker checker actions(approve or delete) + return response; + } else { + //redirect if maker checker is enabled + $location.path('/viewMakerCheckerTask/' + response.data.commandId); + } + } else { + //when no maker checker enabled + return response; + } + ; + } } - } - function error(response) { - // get $http via $injector because of circular dependency problem - $http = $http || $injector.get('$http'); - removeErrors(); - // don't send notification until all requests are complete - if ($http.pendingRequests.length < 1) { + function error(response) { + // get $http via $injector because of circular dependency problem + $http = $http || $injector.get('$http'); + removeErrors(); + // don't send notification until all requests are complete + if ($http.pendingRequests.length < 1) { + // get requestNotificationChannel via $injector because of circular dependency problem + notificationChannel = notificationChannel || $injector.get('requestNotificationChannel'); + // send a notification requests are complete + notificationChannel.requestEnded(); + } + if (response.status === 0) { + $rootScope.errorStatus = 'No connection. Verify application is running.'; + } else if (response.status == 401) { + $rootScope.errorStatus = 'Unauthorized'; + } else if (response.status == 404) { + $rootScope.errorStatus = 'Requested page not found. [404]'; + } else if (response.status == 405) { + $rootScope.errorStatus = 'HTTP verb not supported [405]'; + } else if (response.status == 500) { + $rootScope.errorStatus = 'Internal Server Error [500].'; + } else { + var jsonErrors = JSON.parse(JSON.stringify(response.data)); + var valErrors = jsonErrors.errors; + var errorArray = new Array(); + var arrayIndex = 0; + for (var i in valErrors) { + var temp = valErrors[i]; + // add error class to input in dialog + var fieldId = '#' + temp.parameterName; + $(fieldId).addClass("validationerror"); + + var errorObj = new Object(); + errorObj.field = temp.parameterName; + errorObj.code = temp.userMessageGlobalisationCode; + errorObj.args = {params: []}; + for (var j in temp.args) { + errorObj.args.params.push({value: temp.args[j].value}); + } + + errorArray[arrayIndex] = errorObj; + arrayIndex++; + } + ; + $rootScope.errorDetails = errorArray; + } + return $q.reject(response); + } + + return function (promise) { // get requestNotificationChannel via $injector because of circular dependency problem notificationChannel = notificationChannel || $injector.get('requestNotificationChannel'); // send a notification requests are complete - notificationChannel.requestEnded(); + notificationChannel.requestStarted(); + return promise.then(success, error); } - if (response.status === 0) { - $rootScope.errorStatus='No connection. Verify application is running.'; - } else if (response.status == 401) { - $rootScope.errorStatus='Unauthorized'; - } else if (response.status == 404) { - $rootScope.errorStatus='Requested page not found. [404]'; - } else if (response.status == 405) { - $rootScope.errorStatus='HTTP verb not supported [405]'; - } else if (response.status == 500) { - $rootScope.errorStatus='Internal Server Error [500].'; - } else { - var jsonErrors = JSON.parse(JSON.stringify(response.data)); - var valErrors = jsonErrors.errors; - var errorArray = new Array(); - var arrayIndex = 0; - for(var i in valErrors) { - var temp = valErrors[i]; - // add error class to input in dialog - var fieldId = '#' + temp.parameterName; - $(fieldId).addClass("validationerror"); + }]; - var errorObj = new Object(); - errorObj.field = temp.parameterName; - errorObj.code = temp.userMessageGlobalisationCode; - errorObj.args = {params:[]}; - for(var j in temp.args) { - errorObj.args.params.push({value : temp.args[j].value}); - } - - errorArray[arrayIndex] = errorObj; - arrayIndex++; - }; - $rootScope.errorDetails = errorArray; - } - return $q.reject(response); - } - - return function (promise) { - // get requestNotificationChannel via $injector because of circular dependency problem - notificationChannel = notificationChannel || $injector.get('requestNotificationChannel'); - // send a notification requests are complete - notificationChannel.requestStarted(); - return promise.then(success, error); - } - }]; - - $httpProvider.responseInterceptors.push(interceptor); -}]) + $httpProvider.responseInterceptors.push(interceptor); + }]) // declare the notification pub/sub channel -.factory('requestNotificationChannel', ['$rootScope', function($rootScope){ - // private notification messages - var _START_REQUEST_ = '_START_REQUEST_'; - var _END_REQUEST_ = '_END_REQUEST_'; - // publish start request notification - var requestStarted = function() { - $rootScope.$broadcast(_START_REQUEST_); - $rootScope.blockUI = true; - }; - // publish end request notification - var requestEnded = function() { - $rootScope.$broadcast(_END_REQUEST_); - $rootScope.blockUI = false; - }; - // subscribe to start request notification - var onRequestStarted = function($scope, handler){ - $scope.$on(_START_REQUEST_, function(event){ - handler(); - }); - }; - // subscribe to end request notification - var onRequestEnded = function($scope, handler){ - $scope.$on(_END_REQUEST_, function(event){ - handler(); - }); - }; + .factory('requestNotificationChannel', ['$rootScope', function ($rootScope) { + // private notification messages + var _START_REQUEST_ = '_START_REQUEST_'; + var _END_REQUEST_ = '_END_REQUEST_'; + // publish start request notification + var requestStarted = function () { + $rootScope.$broadcast(_START_REQUEST_); + $rootScope.blockUI = true; + }; + // publish end request notification + var requestEnded = function () { + $rootScope.$broadcast(_END_REQUEST_); + $rootScope.blockUI = false; + }; + // subscribe to start request notification + var onRequestStarted = function ($scope, handler) { + $scope.$on(_START_REQUEST_, function (event) { + handler(); + }); + }; + // subscribe to end request notification + var onRequestEnded = function ($scope, handler) { + $scope.$on(_END_REQUEST_, function (event) { + handler(); + }); + }; - return { - requestStarted: requestStarted, - requestEnded: requestEnded, - onRequestStarted: onRequestStarted, - onRequestEnded: onRequestEnded - }; -}]) + return { + requestStarted: requestStarted, + requestEnded: requestEnded, + onRequestStarted: onRequestStarted, + onRequestEnded: onRequestEnded + }; + }]) diff --git a/app/scripts/routes.js b/app/scripts/routes.js index 26219bb1..c2271186 100644 --- a/app/scripts/routes.js +++ b/app/scripts/routes.js @@ -1,520 +1,519 @@ - -(function(mifosX) { - var defineRoutes = function($routeProvider, $locationProvider) { - $routeProvider - .when('/', { - templateUrl: 'views/start.html' - }) - .when('/login', { - templateUrl: 'views/login.html' - }) - .when('/home', { - templateUrl: 'views/home.html' - }) - .when('/products', { - templateUrl: 'views/products/products.html' - }) - .when('/templates', { - templateUrl: 'views/templates/templates.html' - }) - .when('/createtemplate', { - templateUrl: 'views/templates/createtemplate.html' - }) - .when('/viewtemplate/:id', { - templateUrl: 'views/templates/viewtemplate.html' - }) - .when('/edittemplate/:id', { - templateUrl: 'views/templates/edittemplate.html' - }) - .when('/createloanproduct', { - templateUrl: 'views/products/createloanproduct.html' - }) - .when('/editloanproduct/:id', { - templateUrl: 'views/products/editloanproduct.html' - }) - .when('/createsavingproduct', { - templateUrl: 'views/products/createsavingproduct.html' - }) - .when('/editsavingproduct/:id', { - templateUrl: 'views/products/editsavingproduct.html' - }) - .when('/admin/viewrole/:id', { - templateUrl: 'views/administration/viewrole.html' - }) - .when('/admin/roles', { - templateUrl: 'views/administration/roles.html' - }) - .when('/admin/addrole', { - templateUrl: 'views/administration/addrole.html' - }) - .when('/admin/viewmctasks', { - templateUrl: 'views/administration/makerchecker.html' - }) - .when('/admin/users', { - templateUrl: 'views/administration/users.html' - }) - .when('/clients', { - templateUrl: 'views/clients/clients.html' - }) - .when('/createclient', { - templateUrl: 'views/clients/createclient.html' - }) - .when('/editclient/:id', { - templateUrl : 'views/clients/editclient.html' - }) - .when('/viewclient/:id', { - templateUrl: 'views/clients/viewclient.html' - }) - .when('/clientscreenreport/:clientId', { - templateUrl: 'views/clients/clientscreenreport.html' - }) - .when('/client/:id/:action', { - templateUrl: 'views/clients/clientactions.html' - }) - .when('/transferclient/:id', { - templateUrl: 'views/clients/transferclient.html' - }) - .when('/addclientdocument/:clientId', { - templateUrl: 'views/clients/addclientdocument.html' - }) - .when('/clientclosedloanaccount/:clientId', { - templateUrl: 'views/clients/clientclosedloanaccount.html' - }) - .when('/clientclosedsavingaccount/:clientId', { - templateUrl: 'views/clients/clientclosedsavingaccount.html' - }) - .when('/addclientidentifier/:clientId', { - templateUrl: 'views/clients/addclientidentifier.html' - }) - .when('/addclientidentifierdocument/:clientId/:resourceId', { - templateUrl: 'views/clients/addclientidentifierdocument.html' - }) - .when('/newclientloanaccount/:clientId', { - templateUrl: 'views/loans/newloanaccount.html' - }) - .when('/newgrouploanaccount/:groupId', { - templateUrl: 'views/loans/newloanaccount.html' - }) - .when('/newjlgloanaccount/:groupId', { - templateUrl: 'views/loans/newjlgloanaccount.html' - }) - .when('/viewloanaccount/:id', { - templateUrl: 'views/loans/viewloanaccountdetails.html' - }) - .when('/loanaccount/:id/:action', { - templateUrl: 'views/loans/loanaccountactions.html' - }) - .when('/loanaccountcharge/:id/:action/:chargeId', { - templateUrl: 'views/loans/loanaccountactions.html' - }) - .when('/loandisbursedetail/:id/:action/:disbursementId', { - templateUrl: 'views/loans/loanaccountactions.html' - }) - .when('/editloanaccount/:id', { - templateUrl: 'views/loans/editloanaccount.html' - }) - .when('/loanscreenreport/:loanId', { - templateUrl: 'views/loans/loanscreenreport.html' - }) - .when('/addloancharge/:id', { - templateUrl: 'views/loans/addloancharge.html' - }) - .when('/addcollateral/:id', { - templateUrl: 'views/loans/addloancollateral.html' - }) - .when('/loan/:loanId/editcollateral/:id', { - templateUrl: 'views/loans/editloancollateral.html' - }) - .when('/loan/:loanId/viewcollateral/:id', { - templateUrl: 'views/loans/viewloancollateral.html' - }) - .when('/loan/:loanId/viewcharge/:id', { - templateUrl: 'views/loans/viewloancharge.html' - }) - .when('/loan/:loanId/editcharge/:id', { - templateUrl: 'views/loans/editloancharge.html' - }) - .when('/assignloanofficer/:id', { - templateUrl: 'views/loans/assignloanofficer.html' - }) - .when('/addloandocument/:loanId', { - templateUrl: 'views/loans/addloandocument.html' - }) - .when('/viewloantrxn/:accountId/trxnId/:id', { - templateUrl: 'views/loans/view_loan_transaction.html' - }) - .when('/organization', { - templateUrl: 'views/administration/organization.html' - }) - .when('/system', { - templateUrl: 'views/administration/system.html' - }) - .when('/loanproducts', { - templateUrl: 'views/products/loanproducts.html' - }) - .when('/charges', { - templateUrl: 'views/products/charges.html' - }) - .when('/viewcharge/:id', { - templateUrl: 'views/products/viewcharge.html' - }) - .when('/savingproducts', { - templateUrl: 'views/products/savingproducts.html' - }) - .when('/viewsavingproduct/:id', { - templateUrl: 'views/products/viewsavingproduct.html' - }) - .when('/offices', { - templateUrl: 'views/organization/offices.html' - }) - .when('/createoffice', { - templateUrl: 'views/organization/createoffice.html' - }) - .when('/viewoffice/:id', { - templateUrl: 'views/organization/viewoffice.html' - }) - .when('/editoffice/:id', { - templateUrl: 'views/organization/editoffice.html' - }) - .when('/tasks', { - templateUrl: 'views/tasks.html' - }) - .when('/currconfig', { - templateUrl: 'views/organization/currencyconfig.html' - }) - .when('/search/:query', { - templateUrl: 'views/search/glresults.html' - }) - .when('/viewloanproduct/:id', { - templateUrl: 'views/products/viewloanproduct.html' - }) - .when('/usersetting', { - templateUrl: 'views/administration/usersettings.html' - }) - .when('/users/', { - templateUrl: 'views/administration/userslist.html' - }) - .when('/createuser/', { - templateUrl: 'views/administration/createuser.html' - }) - .when('/viewuser/:id', { - templateUrl: 'views/administration/viewuser.html' - }) - .when('/edituser/:id', { - templateUrl: 'views/administration/edituser.html' - }) - .when('/employees', { - templateUrl: 'views/organization/employees.html' - }) - .when('/viewemployee/:id', { - templateUrl: 'views/organization/viewemployee.html' - }) - .when('/editemployee/:id', { - templateUrl: 'views/organization/editemployee.html' - }) - .when('/createemployee/', { - templateUrl: 'views/organization/createemployee.html' - }) - .when('/managefunds/', { - templateUrl: 'views/organization/managefunds.html' - }) - .when('/nav/offices', { - templateUrl: 'views/navigation/offices.html' - }) - .when('/accounting', { - templateUrl: 'views/accounting/accounting.html' - }) - .when('/accounting_coa', { - templateUrl: 'views/accounting/accounting_coa.html' - }) - .when('/createglaccount', { - templateUrl: 'views/accounting/createglaccounting.html' - }) - .when('/viewglaccount/:id', { - templateUrl: 'views/accounting/viewglaccounting.html' - }) - .when('/editglaccount/:id', { - templateUrl: 'views/accounting/editglaccounting.html' - }) - .when('/freqposting', { - templateUrl: 'views/accounting/freqposting.html' - }) - .when('/viewtransactions/:transactionId', { - templateUrl: 'views/accounting/view_transactions.html' - }) - .when('/journalentry', { - templateUrl: 'views/accounting/journalentry_posting.html' - }) - .when('/searchtransaction', { - templateUrl: 'views/accounting/search_transaction.html' - }) - .when('/accounts_closure', { - templateUrl: 'views/accounting/accounts_closure.html' - }) - .when('/view_close_accounting/:id', { - templateUrl: 'views/accounting/view_close_accounting.html' - }) - .when('/accounting_rules', { - templateUrl: 'views/accounting/accounting_rules.html' - }) - .when('/viewaccrule/:id', { - templateUrl: 'views/accounting/view_acc_rule.html' - }) - .when('/add_accrule', { - templateUrl: 'views/accounting/add_acc_rule.html' - }) - .when('/editaccrule/:id', { - templateUrl: 'views/accounting/edit_acc_rule.html' - }) - .when('/viewcode/:id', { - templateUrl: 'views/system/viewcode.html' - }) - .when('/datatables', { - templateUrl: 'views/system/datatables.html' - }) - .when('/viewdatatable/:tableName', { - templateUrl: 'views/system/viewdatatable.html' - }) - .when('/createdatatable', { - templateUrl: 'views/system/createdatatable.html' - }) - .when('/editdatatable/:tableName', { - templateUrl: 'views/system/editdatatable.html' - }) - .when('/makedatatableentry/:tableName/:entityId', { - templateUrl: 'views/system/makedatatableentry.html' - }) - .when('/viewdatatableentry/:tableName/:entityId/:resourceId', { - templateUrl: 'views/system/viewdatatableentry.html' - }) - .when('/addcode', { - templateUrl: 'views/system/addcode.html' - }) - .when('/jobs', { - templateUrl: 'views/system/schedulerjobs.html' - }) - .when('/viewschedulerjob/:id', { - templateUrl: 'views/system/viewschedulerjob.html' - }) - .when('/editschedulerjob/:id', { - templateUrl: 'views/system/editschedulerjob.html' - }) - .when('/viewhistory/:id', { - templateUrl: 'views/system/viewschedulerjobhistory.html' - }) - .when('/codes', { - templateUrl: 'views/system/codes.html' - }) - .when('/editcode/:id', { - templateUrl: 'views/system/editcode.html' - }) - .when('/reports', { - templateUrl: 'views/system/reports.html' - }) - .when('/system/viewreport/:id', { - templateUrl: 'views/system/viewreport.html' - }) - .when('/createreport', { - templateUrl: 'views/system/createreport.html' - }) - .when('/editreport/:id', { - templateUrl: 'views/system/editreport.html' - }) - .when('/holidays', { - templateUrl: 'views/organization/holidays.html' - }) - .when('/createholiday', { - templateUrl: 'views/organization/createholiday.html' - }) - .when('/viewholiday/:id', { - templateUrl: 'views/organization/viewholiday.html' - }) - .when('/editholiday/:id', { - templateUrl: 'views/organization/editholiday.html' - }) - .when('/reports/:type', { - templateUrl: 'views/reports/view_reports.html' - }) - .when('/run_report/:name', { - templateUrl: 'views/reports/run_reports.html' - }) - .when('/xbrl', { - templateUrl: 'views/reports/xbrl.html' - }) - .when('/xbrlreport', { - templateUrl: 'views/reports/xbrlreport.html' - }) - .when('/new_client_saving_application/:clientId', { - templateUrl: 'views/savings/new_saving_account_application.html' - }) - .when('/new_group_saving_application/:groupId', { - templateUrl: 'views/savings/new_saving_account_application.html' - }) - .when('/new_group_saving_application/:groupId/:centerEntity', { - templateUrl: 'views/savings/new_saving_account_application.html' - }) - .when('/new_jlg_saving_application/:groupId/:clientId', { - templateUrl: 'views/savings/new_saving_account_application.html' - }) - .when('/viewsavingaccount/:id', { - templateUrl: 'views/savings/view_saving_account_details.html' - }) - .when('/groups', { - templateUrl: 'views/groups/groups.html' - }) - .when('/creategroup', { - templateUrl: 'views/groups/creategroup.html' - }) - .when('/attachmeeting/:id/:entityType', { - templateUrl: 'views/groups/attachmeeting.html' - }) - .when('/editcalendar/:entityType/:groupOrCenterId/:calendarId', { - templateUrl: 'views/groups/editmeeting.html' - }) - .when('/editsavingaccount/:id', { - templateUrl: 'views/savings/edit_saving_account_application.html' - }) - .when('/savingaccount/:id/:action', { - templateUrl: 'views/savings/saving_account_actions.html' - }) - .when('/savingaccountcharge/:id/:action/:chargeId', { - templateUrl: 'views/savings/saving_account_actions.html' - }) - .when('/savingaccounts/:id/charges', { - templateUrl: 'views/savings/addnewsavingscharge.html' - }) - .when('/viewaccounttransfers/:id', { - templateUrl: 'views/accounttransfers/view_accounttransfer.html' - }) - .when('/accounttransfers/:accountType/:accountId', { - templateUrl: 'views/accounttransfers/make_accounttransfer.html' - }) - .when('/viewsavingtrxn/:accountId/trxnId/:id', { - templateUrl: 'views/savings/view_saving_transaction.html' - }) - .when('/viewgroup/:id', { - templateUrl: 'views/groups/viewgroup.html' - }) - .when('/editgroup/:id', { - templateUrl: 'views/groups/editgroup.html' - }) - .when('/addmember', { - templateUrl: 'views/groups/addmember.html' - }) - .when('/groupattendance', { - templateUrl: 'views/groups/groupattendance.html' - }) - .when('/closegroup/:id', { - templateUrl: 'views/groups/closegroup.html' - }) - .when('/groupclosedloanaccount/:groupId', { - templateUrl: 'views/groups/groupclosedloanaccount.html' - }) - .when('/groupclosedsavingaccount/:groupId', { - templateUrl: 'views/groups/groupclosedsavingaccount.html' - }) - .when('/addrole/:id', { - templateUrl: 'views/groups/addrole.html' - }) - .when('/membermanage/:id', { - templateUrl: 'views/groups/membermanage.html' - }) - .when('/transferclients/:id', { - templateUrl: 'views/groups/transferclients.html' - }) - .when('/centers', { - templateUrl: 'views/centers/centers.html' - }) - .when('/viewcenter/:id', { - templateUrl:'views/centers/viewcenter.html' - }) - .when('/createcenter', { - templateUrl: 'views/centers/createcenter.html' - }) - .when('/editcenter/:id', { - templateUrl: 'views/centers/editcenter.html' - }) - .when('/closecenter/:id', { - templateUrl: 'views/centers/closecenter.html' - }) - .when('/addgroup', { - templateUrl: 'views/centers/addgroup.html' - }) - .when('/centerattendance', { - templateUrl: 'views/centers/centerattendance.html' - }) - .when('/createcharge', { - templateUrl: 'views/products/createcharge.html' - }) - .when('/editcharge/:id', { - templateUrl: 'views/products/editcharge.html' - }) - .when('/productivesheet/:officeId/:officeName/:meetingDate/:staffId', { - templateUrl: 'views/collection/productivecollectionsheet.html' - }) - .when('/entercollectionsheet', { - templateUrl: 'views/collection/collectionsheet.html' - }) - .when('/assignstaff/:id/:entityType', { - templateUrl: 'views/groups/assignstaff.html' - }) - .when('/global', { - templateUrl: 'views/administration/global.html' - }) - .when('/productmix', { - templateUrl: 'views/products/productmix/productmix.html' - }) - .when('/viewproductmix/:id', { - templateUrl: 'views/products/productmix/viewproductmix.html' - }) - .when('/editproductmix/:id', { - templateUrl: 'views/products/productmix/editproductmix.html' - }) - .when('/addproductmix', { - templateUrl: 'views/products/productmix/addproductmix.html' - }) - .when('/bulkloan', { - templateUrl: 'views/organization/bulkloan.html' - }) - .when('/audit', { - templateUrl: 'views/system/audit.html' - }) - .when('/viewaudit/:id', { - templateUrl: 'views/system/viewaudit.html' - }) - .when('/createclosure', { - templateUrl: 'views/accounting/createclosure.html' - }) - .when('/guarantor/:id', { - templateUrl: 'views/loans/guarantor.html' - }) - .when('/viewcheckerinbox/:id',{ - templateUrl: 'views/system/viewcheckerinbox.html' - }) - .when('/editguarantor/:id/:loanId',{ - templateUrl: 'views/loans/editguarantor.html' - }) - .when('/expertsearch',{ - templateUrl: 'views/expertsearch.html' - }) - .when('/profile',{ - templateUrl: 'views/profile.html' - }) - .when('/viewMakerCheckerTask/:commandId',{ - templateUrl: 'views/system/viewMakerCheckerTask.html' - }) - .when('/help',{ - templateUrl: 'views/help.html' - }) - .when('/checkeractionperformed',{ - templateUrl: 'views/system/checkerActionPerformed.html' - }) - .when('/advsearch',{ - templateUrl: 'views/search/advsearch.html' - }); - $locationProvider.html5Mode(false); - }; - mifosX.ng.application.config(defineRoutes).run(function($log) { - $log.info("Routes definition completed"); - }); +(function (mifosX) { + var defineRoutes = function ($routeProvider, $locationProvider) { + $routeProvider + .when('/', { + templateUrl: 'views/start.html' + }) + .when('/login', { + templateUrl: 'views/login.html' + }) + .when('/home', { + templateUrl: 'views/home.html' + }) + .when('/products', { + templateUrl: 'views/products/products.html' + }) + .when('/templates', { + templateUrl: 'views/templates/templates.html' + }) + .when('/createtemplate', { + templateUrl: 'views/templates/createtemplate.html' + }) + .when('/viewtemplate/:id', { + templateUrl: 'views/templates/viewtemplate.html' + }) + .when('/edittemplate/:id', { + templateUrl: 'views/templates/edittemplate.html' + }) + .when('/createloanproduct', { + templateUrl: 'views/products/createloanproduct.html' + }) + .when('/editloanproduct/:id', { + templateUrl: 'views/products/editloanproduct.html' + }) + .when('/createsavingproduct', { + templateUrl: 'views/products/createsavingproduct.html' + }) + .when('/editsavingproduct/:id', { + templateUrl: 'views/products/editsavingproduct.html' + }) + .when('/admin/viewrole/:id', { + templateUrl: 'views/administration/viewrole.html' + }) + .when('/admin/roles', { + templateUrl: 'views/administration/roles.html' + }) + .when('/admin/addrole', { + templateUrl: 'views/administration/addrole.html' + }) + .when('/admin/viewmctasks', { + templateUrl: 'views/administration/makerchecker.html' + }) + .when('/admin/users', { + templateUrl: 'views/administration/users.html' + }) + .when('/clients', { + templateUrl: 'views/clients/clients.html' + }) + .when('/createclient', { + templateUrl: 'views/clients/createclient.html' + }) + .when('/editclient/:id', { + templateUrl: 'views/clients/editclient.html' + }) + .when('/viewclient/:id', { + templateUrl: 'views/clients/viewclient.html' + }) + .when('/clientscreenreport/:clientId', { + templateUrl: 'views/clients/clientscreenreport.html' + }) + .when('/client/:id/:action', { + templateUrl: 'views/clients/clientactions.html' + }) + .when('/transferclient/:id', { + templateUrl: 'views/clients/transferclient.html' + }) + .when('/addclientdocument/:clientId', { + templateUrl: 'views/clients/addclientdocument.html' + }) + .when('/clientclosedloanaccount/:clientId', { + templateUrl: 'views/clients/clientclosedloanaccount.html' + }) + .when('/clientclosedsavingaccount/:clientId', { + templateUrl: 'views/clients/clientclosedsavingaccount.html' + }) + .when('/addclientidentifier/:clientId', { + templateUrl: 'views/clients/addclientidentifier.html' + }) + .when('/addclientidentifierdocument/:clientId/:resourceId', { + templateUrl: 'views/clients/addclientidentifierdocument.html' + }) + .when('/newclientloanaccount/:clientId', { + templateUrl: 'views/loans/newloanaccount.html' + }) + .when('/newgrouploanaccount/:groupId', { + templateUrl: 'views/loans/newloanaccount.html' + }) + .when('/newjlgloanaccount/:groupId', { + templateUrl: 'views/loans/newjlgloanaccount.html' + }) + .when('/viewloanaccount/:id', { + templateUrl: 'views/loans/viewloanaccountdetails.html' + }) + .when('/loanaccount/:id/:action', { + templateUrl: 'views/loans/loanaccountactions.html' + }) + .when('/loanaccountcharge/:id/:action/:chargeId', { + templateUrl: 'views/loans/loanaccountactions.html' + }) + .when('/loandisbursedetail/:id/:action/:disbursementId', { + templateUrl: 'views/loans/loanaccountactions.html' + }) + .when('/editloanaccount/:id', { + templateUrl: 'views/loans/editloanaccount.html' + }) + .when('/loanscreenreport/:loanId', { + templateUrl: 'views/loans/loanscreenreport.html' + }) + .when('/addloancharge/:id', { + templateUrl: 'views/loans/addloancharge.html' + }) + .when('/addcollateral/:id', { + templateUrl: 'views/loans/addloancollateral.html' + }) + .when('/loan/:loanId/editcollateral/:id', { + templateUrl: 'views/loans/editloancollateral.html' + }) + .when('/loan/:loanId/viewcollateral/:id', { + templateUrl: 'views/loans/viewloancollateral.html' + }) + .when('/loan/:loanId/viewcharge/:id', { + templateUrl: 'views/loans/viewloancharge.html' + }) + .when('/loan/:loanId/editcharge/:id', { + templateUrl: 'views/loans/editloancharge.html' + }) + .when('/assignloanofficer/:id', { + templateUrl: 'views/loans/assignloanofficer.html' + }) + .when('/addloandocument/:loanId', { + templateUrl: 'views/loans/addloandocument.html' + }) + .when('/viewloantrxn/:accountId/trxnId/:id', { + templateUrl: 'views/loans/view_loan_transaction.html' + }) + .when('/organization', { + templateUrl: 'views/administration/organization.html' + }) + .when('/system', { + templateUrl: 'views/administration/system.html' + }) + .when('/loanproducts', { + templateUrl: 'views/products/loanproducts.html' + }) + .when('/charges', { + templateUrl: 'views/products/charges.html' + }) + .when('/viewcharge/:id', { + templateUrl: 'views/products/viewcharge.html' + }) + .when('/savingproducts', { + templateUrl: 'views/products/savingproducts.html' + }) + .when('/viewsavingproduct/:id', { + templateUrl: 'views/products/viewsavingproduct.html' + }) + .when('/offices', { + templateUrl: 'views/organization/offices.html' + }) + .when('/createoffice', { + templateUrl: 'views/organization/createoffice.html' + }) + .when('/viewoffice/:id', { + templateUrl: 'views/organization/viewoffice.html' + }) + .when('/editoffice/:id', { + templateUrl: 'views/organization/editoffice.html' + }) + .when('/tasks', { + templateUrl: 'views/tasks.html' + }) + .when('/currconfig', { + templateUrl: 'views/organization/currencyconfig.html' + }) + .when('/search/:query', { + templateUrl: 'views/search/glresults.html' + }) + .when('/viewloanproduct/:id', { + templateUrl: 'views/products/viewloanproduct.html' + }) + .when('/usersetting', { + templateUrl: 'views/administration/usersettings.html' + }) + .when('/users/', { + templateUrl: 'views/administration/userslist.html' + }) + .when('/createuser/', { + templateUrl: 'views/administration/createuser.html' + }) + .when('/viewuser/:id', { + templateUrl: 'views/administration/viewuser.html' + }) + .when('/edituser/:id', { + templateUrl: 'views/administration/edituser.html' + }) + .when('/employees', { + templateUrl: 'views/organization/employees.html' + }) + .when('/viewemployee/:id', { + templateUrl: 'views/organization/viewemployee.html' + }) + .when('/editemployee/:id', { + templateUrl: 'views/organization/editemployee.html' + }) + .when('/createemployee/', { + templateUrl: 'views/organization/createemployee.html' + }) + .when('/managefunds/', { + templateUrl: 'views/organization/managefunds.html' + }) + .when('/nav/offices', { + templateUrl: 'views/navigation/offices.html' + }) + .when('/accounting', { + templateUrl: 'views/accounting/accounting.html' + }) + .when('/accounting_coa', { + templateUrl: 'views/accounting/accounting_coa.html' + }) + .when('/createglaccount', { + templateUrl: 'views/accounting/createglaccounting.html' + }) + .when('/viewglaccount/:id', { + templateUrl: 'views/accounting/viewglaccounting.html' + }) + .when('/editglaccount/:id', { + templateUrl: 'views/accounting/editglaccounting.html' + }) + .when('/freqposting', { + templateUrl: 'views/accounting/freqposting.html' + }) + .when('/viewtransactions/:transactionId', { + templateUrl: 'views/accounting/view_transactions.html' + }) + .when('/journalentry', { + templateUrl: 'views/accounting/journalentry_posting.html' + }) + .when('/searchtransaction', { + templateUrl: 'views/accounting/search_transaction.html' + }) + .when('/accounts_closure', { + templateUrl: 'views/accounting/accounts_closure.html' + }) + .when('/view_close_accounting/:id', { + templateUrl: 'views/accounting/view_close_accounting.html' + }) + .when('/accounting_rules', { + templateUrl: 'views/accounting/accounting_rules.html' + }) + .when('/viewaccrule/:id', { + templateUrl: 'views/accounting/view_acc_rule.html' + }) + .when('/add_accrule', { + templateUrl: 'views/accounting/add_acc_rule.html' + }) + .when('/editaccrule/:id', { + templateUrl: 'views/accounting/edit_acc_rule.html' + }) + .when('/viewcode/:id', { + templateUrl: 'views/system/viewcode.html' + }) + .when('/datatables', { + templateUrl: 'views/system/datatables.html' + }) + .when('/viewdatatable/:tableName', { + templateUrl: 'views/system/viewdatatable.html' + }) + .when('/createdatatable', { + templateUrl: 'views/system/createdatatable.html' + }) + .when('/editdatatable/:tableName', { + templateUrl: 'views/system/editdatatable.html' + }) + .when('/makedatatableentry/:tableName/:entityId', { + templateUrl: 'views/system/makedatatableentry.html' + }) + .when('/viewdatatableentry/:tableName/:entityId/:resourceId', { + templateUrl: 'views/system/viewdatatableentry.html' + }) + .when('/addcode', { + templateUrl: 'views/system/addcode.html' + }) + .when('/jobs', { + templateUrl: 'views/system/schedulerjobs.html' + }) + .when('/viewschedulerjob/:id', { + templateUrl: 'views/system/viewschedulerjob.html' + }) + .when('/editschedulerjob/:id', { + templateUrl: 'views/system/editschedulerjob.html' + }) + .when('/viewhistory/:id', { + templateUrl: 'views/system/viewschedulerjobhistory.html' + }) + .when('/codes', { + templateUrl: 'views/system/codes.html' + }) + .when('/editcode/:id', { + templateUrl: 'views/system/editcode.html' + }) + .when('/reports', { + templateUrl: 'views/system/reports.html' + }) + .when('/system/viewreport/:id', { + templateUrl: 'views/system/viewreport.html' + }) + .when('/createreport', { + templateUrl: 'views/system/createreport.html' + }) + .when('/editreport/:id', { + templateUrl: 'views/system/editreport.html' + }) + .when('/holidays', { + templateUrl: 'views/organization/holidays.html' + }) + .when('/createholiday', { + templateUrl: 'views/organization/createholiday.html' + }) + .when('/viewholiday/:id', { + templateUrl: 'views/organization/viewholiday.html' + }) + .when('/editholiday/:id', { + templateUrl: 'views/organization/editholiday.html' + }) + .when('/reports/:type', { + templateUrl: 'views/reports/view_reports.html' + }) + .when('/run_report/:name', { + templateUrl: 'views/reports/run_reports.html' + }) + .when('/xbrl', { + templateUrl: 'views/reports/xbrl.html' + }) + .when('/xbrlreport', { + templateUrl: 'views/reports/xbrlreport.html' + }) + .when('/new_client_saving_application/:clientId', { + templateUrl: 'views/savings/new_saving_account_application.html' + }) + .when('/new_group_saving_application/:groupId', { + templateUrl: 'views/savings/new_saving_account_application.html' + }) + .when('/new_group_saving_application/:groupId/:centerEntity', { + templateUrl: 'views/savings/new_saving_account_application.html' + }) + .when('/new_jlg_saving_application/:groupId/:clientId', { + templateUrl: 'views/savings/new_saving_account_application.html' + }) + .when('/viewsavingaccount/:id', { + templateUrl: 'views/savings/view_saving_account_details.html' + }) + .when('/groups', { + templateUrl: 'views/groups/groups.html' + }) + .when('/creategroup', { + templateUrl: 'views/groups/creategroup.html' + }) + .when('/attachmeeting/:id/:entityType', { + templateUrl: 'views/groups/attachmeeting.html' + }) + .when('/editcalendar/:entityType/:groupOrCenterId/:calendarId', { + templateUrl: 'views/groups/editmeeting.html' + }) + .when('/editsavingaccount/:id', { + templateUrl: 'views/savings/edit_saving_account_application.html' + }) + .when('/savingaccount/:id/:action', { + templateUrl: 'views/savings/saving_account_actions.html' + }) + .when('/savingaccountcharge/:id/:action/:chargeId', { + templateUrl: 'views/savings/saving_account_actions.html' + }) + .when('/savingaccounts/:id/charges', { + templateUrl: 'views/savings/addnewsavingscharge.html' + }) + .when('/viewaccounttransfers/:id', { + templateUrl: 'views/accounttransfers/view_accounttransfer.html' + }) + .when('/accounttransfers/:accountType/:accountId', { + templateUrl: 'views/accounttransfers/make_accounttransfer.html' + }) + .when('/viewsavingtrxn/:accountId/trxnId/:id', { + templateUrl: 'views/savings/view_saving_transaction.html' + }) + .when('/viewgroup/:id', { + templateUrl: 'views/groups/viewgroup.html' + }) + .when('/editgroup/:id', { + templateUrl: 'views/groups/editgroup.html' + }) + .when('/addmember', { + templateUrl: 'views/groups/addmember.html' + }) + .when('/groupattendance', { + templateUrl: 'views/groups/groupattendance.html' + }) + .when('/closegroup/:id', { + templateUrl: 'views/groups/closegroup.html' + }) + .when('/groupclosedloanaccount/:groupId', { + templateUrl: 'views/groups/groupclosedloanaccount.html' + }) + .when('/groupclosedsavingaccount/:groupId', { + templateUrl: 'views/groups/groupclosedsavingaccount.html' + }) + .when('/addrole/:id', { + templateUrl: 'views/groups/addrole.html' + }) + .when('/membermanage/:id', { + templateUrl: 'views/groups/membermanage.html' + }) + .when('/transferclients/:id', { + templateUrl: 'views/groups/transferclients.html' + }) + .when('/centers', { + templateUrl: 'views/centers/centers.html' + }) + .when('/viewcenter/:id', { + templateUrl: 'views/centers/viewcenter.html' + }) + .when('/createcenter', { + templateUrl: 'views/centers/createcenter.html' + }) + .when('/editcenter/:id', { + templateUrl: 'views/centers/editcenter.html' + }) + .when('/closecenter/:id', { + templateUrl: 'views/centers/closecenter.html' + }) + .when('/addgroup', { + templateUrl: 'views/centers/addgroup.html' + }) + .when('/centerattendance', { + templateUrl: 'views/centers/centerattendance.html' + }) + .when('/createcharge', { + templateUrl: 'views/products/createcharge.html' + }) + .when('/editcharge/:id', { + templateUrl: 'views/products/editcharge.html' + }) + .when('/productivesheet/:officeId/:officeName/:meetingDate/:staffId', { + templateUrl: 'views/collection/productivecollectionsheet.html' + }) + .when('/entercollectionsheet', { + templateUrl: 'views/collection/collectionsheet.html' + }) + .when('/assignstaff/:id/:entityType', { + templateUrl: 'views/groups/assignstaff.html' + }) + .when('/global', { + templateUrl: 'views/administration/global.html' + }) + .when('/productmix', { + templateUrl: 'views/products/productmix/productmix.html' + }) + .when('/viewproductmix/:id', { + templateUrl: 'views/products/productmix/viewproductmix.html' + }) + .when('/editproductmix/:id', { + templateUrl: 'views/products/productmix/editproductmix.html' + }) + .when('/addproductmix', { + templateUrl: 'views/products/productmix/addproductmix.html' + }) + .when('/bulkloan', { + templateUrl: 'views/organization/bulkloan.html' + }) + .when('/audit', { + templateUrl: 'views/system/audit.html' + }) + .when('/viewaudit/:id', { + templateUrl: 'views/system/viewaudit.html' + }) + .when('/createclosure', { + templateUrl: 'views/accounting/createclosure.html' + }) + .when('/guarantor/:id', { + templateUrl: 'views/loans/guarantor.html' + }) + .when('/viewcheckerinbox/:id', { + templateUrl: 'views/system/viewcheckerinbox.html' + }) + .when('/editguarantor/:id/:loanId', { + templateUrl: 'views/loans/editguarantor.html' + }) + .when('/expertsearch', { + templateUrl: 'views/expertsearch.html' + }) + .when('/profile', { + templateUrl: 'views/profile.html' + }) + .when('/viewMakerCheckerTask/:commandId', { + templateUrl: 'views/system/viewMakerCheckerTask.html' + }) + .when('/help', { + templateUrl: 'views/help.html' + }) + .when('/checkeractionperformed', { + templateUrl: 'views/system/checkerActionPerformed.html' + }) + .when('/advsearch', { + templateUrl: 'views/search/advsearch.html' + }); + $locationProvider.html5Mode(false); + }; + mifosX.ng.application.config(defineRoutes).run(function ($log) { + $log.info("Routes definition completed"); + }); }(mifosX || {})); diff --git a/app/scripts/services/AuthenticationService.js b/app/scripts/services/AuthenticationService.js index 59c326a4..fa672391 100644 --- a/app/scripts/services/AuthenticationService.js +++ b/app/scripts/services/AuthenticationService.js @@ -1,26 +1,26 @@ -(function(module) { - mifosX.services = _.extend(module, { - AuthenticationService: function(scope, httpService,localStorageService) { - var onSuccess = function(data) { - scope.$broadcast("UserAuthenticationSuccessEvent", data); - localStorageService.add('userData',data); - }; +(function (module) { + mifosX.services = _.extend(module, { + AuthenticationService: function (scope, httpService, localStorageService) { + var onSuccess = function (data) { + scope.$broadcast("UserAuthenticationSuccessEvent", data); + localStorageService.add('userData', data); + }; - var onFailure = function(data) { - scope.$broadcast("UserAuthenticationFailureEvent", data); - }; + var onFailure = function (data) { + scope.$broadcast("UserAuthenticationFailureEvent", data); + }; - var apiVer = '/mifosng-provider/api/v1'; + var apiVer = '/mifosng-provider/api/v1'; - this.authenticateWithUsernamePassword = function(credentials) { - scope.$broadcast("UserAuthenticationStartEvent"); - httpService.post(apiVer + "/authentication?username=" + credentials.username + "&password=" + credentials.password) - .success(onSuccess) - .error(onFailure); - }; - } - }); - mifosX.ng.services.service('AuthenticationService', ['$rootScope', 'HttpService','localStorageService', mifosX.services.AuthenticationService]).run(function($log) { - $log.info("AuthenticationService initialized"); - }); + this.authenticateWithUsernamePassword = function (credentials) { + scope.$broadcast("UserAuthenticationStartEvent"); + httpService.post(apiVer + "/authentication?username=" + credentials.username + "&password=" + credentials.password) + .success(onSuccess) + .error(onFailure); + }; + } + }); + mifosX.ng.services.service('AuthenticationService', ['$rootScope', 'HttpService', 'localStorageService', mifosX.services.AuthenticationService]).run(function ($log) { + $log.info("AuthenticationService initialized"); + }); }(mifosX.services || {})); diff --git a/app/scripts/services/HttpServiceProvider.js b/app/scripts/services/HttpServiceProvider.js index cf6ff316..bd4a81c6 100644 --- a/app/scripts/services/HttpServiceProvider.js +++ b/app/scripts/services/HttpServiceProvider.js @@ -1,55 +1,59 @@ -(function(module) { - mifosX.services = _.extend(module, { - HttpServiceProvider: function() { - var requestInterceptors = {}; +(function (module) { + mifosX.services = _.extend(module, { + HttpServiceProvider: function () { + var requestInterceptors = {}; - this.addRequestInterceptor = function(id, interceptorFn) { - requestInterceptors[id] = interceptorFn; - }; - - this.removeRequestInterceptor = function(id) { - delete requestInterceptors[id]; - }; - - this.$get = ['$http', function(http) { - var HttpService = function() { - var getConfig = function(config) { - return _.reduce(_.values(requestInterceptors), function(c, i) { return i(c); }, config); - }; - - var self = this; - _.each(['get', 'delete', 'head'], function(method) { - self[method] = function(url) { - var config = getConfig({ - method: method.toUpperCase(), - url: url - }); - return http(config); + this.addRequestInterceptor = function (id, interceptorFn) { + requestInterceptors[id] = interceptorFn; }; - }); - _.each(['post', 'put'], function(method) { - self[method] = function(url, data) { - var config = getConfig({ - method: method.toUpperCase(), - url: url, - data: data - }); - return http(config); - }; - }); - this.setAuthorization = function(key) { - http.defaults.headers.common.Authorization = "Basic " + key; - }; - this.cancelAuthorization = function() { - delete http.defaults.headers.common.Authorization; - }; - }; - return new HttpService(); - }]; - } - }); - mifosX.ng.services.config(function($provide) { - $provide.provider('HttpService', mifosX.services.HttpServiceProvider); - }).run(function($log) { $log.info("HttpService initialized"); }); + this.removeRequestInterceptor = function (id) { + delete requestInterceptors[id]; + }; + + this.$get = ['$http', function (http) { + var HttpService = function () { + var getConfig = function (config) { + return _.reduce(_.values(requestInterceptors), function (c, i) { + return i(c); + }, config); + }; + + var self = this; + _.each(['get', 'delete', 'head'], function (method) { + self[method] = function (url) { + var config = getConfig({ + method: method.toUpperCase(), + url: url + }); + return http(config); + }; + }); + _.each(['post', 'put'], function (method) { + self[method] = function (url, data) { + var config = getConfig({ + method: method.toUpperCase(), + url: url, + data: data + }); + return http(config); + }; + }); + this.setAuthorization = function (key) { + http.defaults.headers.common.Authorization = "Basic " + key; + }; + + this.cancelAuthorization = function () { + delete http.defaults.headers.common.Authorization; + }; + }; + return new HttpService(); + }]; + } + }); + mifosX.ng.services.config(function ($provide) { + $provide.provider('HttpService', mifosX.services.HttpServiceProvider); + }).run(function ($log) { + $log.info("HttpService initialized"); + }); }(mifosX.services || {})); diff --git a/app/scripts/services/Paginator.js b/app/scripts/services/Paginator.js index ddb39dde..c41472a3 100644 --- a/app/scripts/services/Paginator.js +++ b/app/scripts/services/Paginator.js @@ -1,46 +1,46 @@ -(function(module) { - mifosX.services = _.extend(module, { - PaginatorService: function(scope, httpService) { - - this.paginate = function(fetchFunction, pageSize) { - var paginator = { - hasNextVar: false, - next: function() { - if (this.hasNextVar) { - this.currentOffset += pageSize; - this._load(); - } - }, - _load: function() { - var self = this; - fetchFunction(this.currentOffset, pageSize, function(items) { - self.currentPageItems = items.pageItems; - self.hasNextVar = items.pageItems.length === pageSize; - }); - }, - hasNext: function() { - return this.hasNextVar; - }, - previous: function() { - if(this.hasPrevious()) { - this.currentOffset -= pageSize; - this._load(); - } - }, - hasPrevious: function() { - return this.currentOffset !== 0; - }, - currentPageItems: [], - currentOffset: 0 - }; - // Load the first page - paginator._load(); - return paginator; - }; +(function (module) { + mifosX.services = _.extend(module, { + PaginatorService: function (scope, httpService) { - } - }); - mifosX.ng.services.service('PaginatorService', ['$rootScope', 'HttpService', mifosX.services.PaginatorService]).run(function($log) { - $log.info("PaginatorService initialized"); - }); + this.paginate = function (fetchFunction, pageSize) { + var paginator = { + hasNextVar: false, + next: function () { + if (this.hasNextVar) { + this.currentOffset += pageSize; + this._load(); + } + }, + _load: function () { + var self = this; + fetchFunction(this.currentOffset, pageSize, function (items) { + self.currentPageItems = items.pageItems; + self.hasNextVar = items.pageItems.length === pageSize; + }); + }, + hasNext: function () { + return this.hasNextVar; + }, + previous: function () { + if (this.hasPrevious()) { + this.currentOffset -= pageSize; + this._load(); + } + }, + hasPrevious: function () { + return this.currentOffset !== 0; + }, + currentPageItems: [], + currentOffset: 0 + }; + // Load the first page + paginator._load(); + return paginator; + }; + + } + }); + mifosX.ng.services.service('PaginatorService', ['$rootScope', 'HttpService', mifosX.services.PaginatorService]).run(function ($log) { + $log.info("PaginatorService initialized"); + }); }(mifosX.services || {})); diff --git a/app/scripts/services/ResourceFactoryProvider.js b/app/scripts/services/ResourceFactoryProvider.js index 9a094700..79717883 100644 --- a/app/scripts/services/ResourceFactoryProvider.js +++ b/app/scripts/services/ResourceFactoryProvider.js @@ -1,323 +1,325 @@ -(function(module) { - mifosX.services = _.extend(module, { - ResourceFactoryProvider: function() { - var baseUrl = "" , apiVer = "/mifosng-provider/api/v1", tenantIdentifier = ""; - this.setBaseUrl = function(url) { - baseUrl = url; - }; +(function (module) { + mifosX.services = _.extend(module, { + ResourceFactoryProvider: function () { + var baseUrl = "" , apiVer = "/mifosng-provider/api/v1", tenantIdentifier = ""; + this.setBaseUrl = function (url) { + baseUrl = url; + }; - this.setTenantIdenetifier = function(tenant) { - tenantIdentifier = tenant; - } - this.$get = ['$resource','$rootScope', function(resource,$rootScope) { - var defineResource = function(url, paramDefaults, actions) { - var tempUrl = baseUrl; - $rootScope.hostUrl = tempUrl; - $rootScope.tenantIdentifier = tenantIdentifier; - return resource(baseUrl + url, paramDefaults, actions); - }; - return { - userResource: defineResource(apiVer + "/users/:userId", {userId:'@userId'}, { - getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}, - getUser: {method:'GET',params:{}} - }), - roleResource: defineResource(apiVer + "/roles/:roleId", {}, { - getAllRoles: {method: 'GET', params: {}, isArray: true} - }), - rolePermissionResource: defineResource(apiVer + "/roles/:roleId/permissions", {roleId:'@roleId'}, { - get: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - permissionResource: defineResource(apiVer + "/permissions", {}, { - get: {method: 'GET', params: {}, isArray: true}, - update: {method: 'PUT'} - }), - officeResource: defineResource(apiVer + "/offices/:officeId", {officeId:"@officeId"}, { - getAllOffices: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT'} - }), - clientResource: defineResource(apiVer + "/clients/:clientId/:anotherresource", {clientId:'@clientId',anotherresource:'@anotherresource'}, { - getAllClients: {method: 'GET', params: {}}, - getClientClosureReasons: {method: 'GET', params: {}}, - getAllClientDocuments: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT'} - }), - clientIdentifierResource: defineResource(apiVer + "/client_identifiers/:clientIdentityId/documents", {clientIdentityId:'@clientIdentityId'}, { - get: {method: 'GET', params: {}, isArray:true} - }), - clientDocumentsResource: defineResource(apiVer + "/clients/:clientId/documents/:documentId", {clientId:'@clientId',documentId:'@documentId'}, { - getAllClientDocuments: {method: 'GET', params: {}, isArray: true} - }), - clientAccountResource: defineResource(apiVer + "/clients/:clientId/accounts", {clientId:'@clientId'}, { - getAllClients: {method: 'GET', params: {}} - }), - clientNotesResource: defineResource(apiVer + "/clients/:clientId/notes", {clientId:'@clientId'}, { - getAllNotes: {method: 'GET', params: {}, isArray:true} - }), - clientTemplateResource: defineResource(apiVer + "/clients/template", {}, { - get: {method: 'GET', params: {}} - }), - clientIdenfierTemplateResource: defineResource(apiVer + "/clients/:clientId/identifiers/template", {clientId:'@clientId'}, { - get: {method: 'GET', params: {}} - }), - clientIdenfierResource: defineResource(apiVer + "/clients/:clientId/identifiers/:id", {clientId:'@clientId', id: '@id'}, { - get: {method: 'GET', params: {}} - }), - groupResource: defineResource(apiVer + "/groups/:groupId/:anotherresource", {groupId:'@groupId',anotherresource:'@anotherresource'}, { - get: {method: 'GET', params: {}}, - getAllGroups: {method: 'GET', params: {}, isArray:true}, - update: { method: 'PUT'} - }), - groupSummaryResource: defineResource(apiVer + "/runreports/:reportSource",{reportSource: '@reportSource'}, { - getSummary: {method: 'GET', params: {}} - }), - groupAccountResource: defineResource(apiVer + "/groups/:groupId/accounts", {groupId:'@groupId'}, { - getAll: {method: 'GET', params: {}} - }), - groupNotesResource: defineResource(apiVer + "/groups/:groupId/notes/:noteId", {groupId:'@groupId',noteId:'@noteId'}, { - getAllNotes: {method: 'GET', params: {}, isArray:true} - }), - groupTemplateResource: defineResource(apiVer + "/groups/template", {}, { - get: {method: 'GET', params: {}} - }), - groupMeetingResource:defineResource(apiVer + "/groups/:groupId/meetings/:templateSource", {groupId:'@groupId',templateSource:'@templateSource'}, { - getMeetingInfo: {method:'GET', params: {}} - }), - attachMeetingResource:defineResource(apiVer + "/:groupOrCenter/:groupOrCenterId/calendars/:templateSource", {groupOrCenter:'@groupOrCenter', groupOrCenterId:'@groupOrCenterId', - templateSource:'@templateSource'}, { - update: {method: 'PUT'} - }), - runReportsResource: defineResource(apiVer + "/runreports/:reportSource", {reportSource : '@reportSource'}, { - get: {method: 'GET', params: {}, isArray:true}, - getReport: {method: 'GET', params: {}} - }), - reportsResource: defineResource(apiVer + "/reports/:id/:resourceType", {id:'@id', resourceType:'@resourceType'}, { - get: {method: 'GET', params: {id:'@id'}}, - getReport: {method: 'GET', params: {id:'@id'}, isArray:true}, - getReportDetails: {method: 'GET', params: {id:'@id'}}, - update: {method: 'PUT', params: {}} - }), - xbrlMixtaxonomyResource: defineResource(apiVer + "/mixtaxonomy", {}, { - get: {method: 'GET', params: {}, isArray:true} - }), - xbrlMixMappingResource: defineResource(apiVer + "/mixmapping", {}, { - get: {method: 'GET', params: {}, isArray:true}, - update: {method: 'PUT', params: {}} - }), - DataTablesResource: defineResource(apiVer + "/datatables/:datatablename/:entityId/:resourceId", {datatablename:'@datatablename',entityId:'@entityId', resourceId:'@resourceId'}, { - getAllDataTables: {method: 'GET', params: {}, isArray:true}, - getTableDetails: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - loanProductResource: defineResource(apiVer + "/loanproducts/:loanProductId/:resourceType", {resourceType:'@resourceType', loanProductId:'@loanProductId'}, { - getAllLoanProducts: {method: 'GET', params: {}, isArray:true}, - getProductmix: {method: 'GET', params: {}}, - put: {method: 'PUT', params: {}} - }), - chargeResource: defineResource(apiVer + "/charges/:chargeId", {chargeId:'@chargeId'}, { - getAllCharges: {method: 'GET', params: {}, isArray:true}, - getCharge: {method: 'GET', params: {}}, - update: {method: 'PUT', params: {}} - }), - chargeTemplateResource: defineResource(apiVer + "/charges/template", { - get: {method: 'GET', params: {}, isArray:true}, - getChargeTemplates: {method: 'GET', params: {}}, - }), - savingProductResource: defineResource(apiVer + "/savingsproducts/:savingProductId/:resourceType", {savingProductId:'@savingProductId', resourceType:'@resourceType'}, { - getAllSavingProducts: {method: 'GET', params: {}, isArray:true}, - update: {method: 'PUT', params: {}} - }), - loanResource: defineResource(apiVer + "/loans/:loanId/:resourceType/:resourceId", {resourceType:'@resourceType', loanId:'@loanId', resourceId:'@resourceId'}, { - getAllLoans: {method: 'GET', params: {}}, - put: {method: 'PUT', params: {}} - }), - loanChargeTemplateResource: defineResource(apiVer + "/loans/:loanId/charges/template", {loanId:'@loanId'}, { - get: {method: 'GET', params: {}} - }), - loanChargesResource: defineResource(apiVer + "/loans/:loanId/charges/:chargeId", {loanId:'@loanId',chargeId:'@chargeId'}, { - }), - loanCollateralTemplateResource: defineResource(apiVer + "/loans/:loanId/collaterals/template", {loanId:'@loanId'}, { - get: {method: 'GET', params: {}} - }), - loanTrxnsTemplateResource: defineResource(apiVer + "/loans/:loanId/transactions/template", {loanId:'@loanId'}, { - get: {method: 'GET', params: {}} - }), - loanTrxnsResource: defineResource(apiVer + "/loans/:loanId/transactions/:transactionId", {loanId:'@loanId', transactionId:'@transactionId'}, { - get: {method: 'GET', params: {}} - }), - LoanAccountResource: defineResource(apiVer + "/loans/:loanId/:resourceType/:chargeId", {loanId:'@loanId', resourceType:'@resourceType', chargeId:'@chargeId'}, { - getLoanAccountDetails: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - LoanEditDisburseResource: defineResource(apiVer + "/loans/:loanId/disbursements/:disbursementId", {loanId:'@loanId', disbursementId:'@disbursementId'}, { - getLoanAccountDetails: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - LoanDocumentResource: defineResource(apiVer + "/loans/:loanId/documents/:documentId", {loanId:'@loanId',documentId:'@documentId'}, { - getLoanDocuments: {method: 'GET', params: {} , isArray: true} - }), - currencyConfigResource: defineResource(apiVer + "/currencies", {}, { - get: {method: 'GET', params: {}}, - update: { method: 'PUT'}, - upd: { method: 'PUT', params:{}, isArray:true} - }), - userListResource: defineResource(apiVer + "/users/:userId", {userId:'@userId'}, { - getAllUsers: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT' } - }), - userTemplateResource: defineResource(apiVer + "/users/template", {}, { - get: {method: 'GET', params: {}} - }), - employeeResource: defineResource(apiVer + "/staff/:staffId", {staffId:'@staffId'}, { - getAllEmployees: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT' } - }), - globalSearch: defineResource(apiVer + "/search", {query:'@query'}, { - search: { method: 'GET', - params: { query: '@query'} , - isArray:true - } - }), - globalSearchTemplateResource: defineResource(apiVer + "/search/template", {}, { - get: {method: 'GET', params: {}} - }), - globalAdHocSearchResource: defineResource(apiVer + "/search/advance", {}, { - get: {method: 'GET', params: {}}, - search: { method: 'POST', isArray:true } - }), - fundsResource: defineResource(apiVer + "/funds/:fundId", {fundId:'@fundId'}, { - getAllFunds: {method: 'GET', params: {}, isArray: true}, - getFund: {method:'GET', params: {}}, - update: {method: 'PUT', params: {}} - }), - accountingRulesResource: defineResource(apiVer + "/accountingrules/:accountingRuleId", {accountingRuleId:'@accountingRuleId'}, { - getAllRules: {method: 'GET', params: {associations : 'all'}, isArray: true}, - getById: {method: 'GET', params: {accountingRuleId:'@accountingRuleId'}}, - get: {method: 'GET', params: {}, isArray: true}, - update: {method: 'PUT'} - }), - accountingRulesTemplateResource: defineResource(apiVer + "/accountingrules/template", {}, { - get: {method: 'GET', params: {}} - }), - accountCoaResource: defineResource(apiVer + "/glaccounts/:glAccountId", {glAccountId:'@glAccountId'}, { - getAllAccountCoas: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT' } - }), - accountCoaTemplateResource: defineResource(apiVer + "/glaccounts/template", {}, { - get: {method: 'GET', params: {}} - }), - journalEntriesResource: defineResource(apiVer + "/journalentries/:trxid", {trxid:'@transactionId'}, { - get: {method: 'GET', params: {transactionId:'@transactionId'}}, - reverse: {method: 'POST', params:{command:'reverse'}}, - search:{method: 'GET', params: {}} - }), - accountingClosureResource: defineResource(apiVer + "/glclosures/:accId", {accId:"@accId"}, { - get: {method: 'GET', params: {}, isArray:true}, - getView: {method: 'GET', params: {}} - }) , - codeResources: defineResource(apiVer + "/codes/:codeId", {codeId:"@codeId"}, { - getAllCodes: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT', params: {}, isArray:true } - }), - codeValueResource: defineResource(apiVer + "/codes/:codeId/codevalues/:codevalueId", {codeId:'@codeId',codevalueId:'@codevalueId'}, { - getAllCodeValues: {method: 'GET', params: {}, isArray:true}, - update: { method: 'PUT', params: {}, isArray:true } - }), - holResource: defineResource(apiVer + "/holidays", {}, { - getAllHols: {method: 'GET', params: {}, isArray: true} - }), - holValueResource: defineResource(apiVer + "/holidays/:holId", {holId:'@holId'}, { - getholvalues: {method: 'GET', params: {}}, - update: { method: 'PUT', params: {}, isArray:true } - }), - savingsTemplateResource: defineResource(apiVer + "/savingsaccounts/template", {}, { - get: {method: 'GET', params: {}} - }), - savingsResource: defineResource(apiVer + "/savingsaccounts/:accountId/:resourceType/:chargeId", - {accountId:'@accountId', resourceType:'@resourceType', chargeId:'@chargeId'}, { - get: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - savingsChargeResource: defineResource(apiVer + "/savingsaccounts/:accountId/charges/:resourceType",{accountId:'@accountId', resourceType:'@resourceType'}, { - get: {method: 'GET', params: {}}, - update: {method: 'PUT'} - }), - savingsTrxnsTemplateResource: defineResource(apiVer + "/savingsaccounts/:savingsId/transactions/template", {savingsId:'@savingsId'}, { - get: {method: 'GET', params: {savingsId:'@savingsId'}} - }), - savingsTrxnsResource: defineResource(apiVer + "/savingsaccounts/:savingsId/transactions/:transactionId", {savingsId:'@savingsId', transactionId:'@transactionId'}, { - get: {method: 'GET', params: {savingsId:'@savingsId', transactionId:'@transactionId'}} - }), - accountTransferResource: defineResource(apiVer + "/accounttransfers/:transferId", {transferId:'@transferId'}, { - get: {method: 'GET', params: {transferId:'@transferId'}} - }), - accountTransfersTemplateResource: defineResource(apiVer + "/accounttransfers/template", {}, { - get: {method: 'GET', params: {}} - }), - centerAccountResource: defineResource(apiVer + "/centers/:centerId/accounts", {centerId:'@centerId'}, { - getAll: {method: 'GET', params: {}, isArray: true} - }), - centerResource: defineResource(apiVer + "/centers/:centerId/:anotherresource", {centerId:'@centerId',anotherresource:'@anotherresource'}, { - get: {method: 'GET', params: {}}, - getAllCenters: {method: 'GET', params: {}, isArray: true}, - getAllMeetingFallCenters: {method: 'GET', params: {}, isArray: true}, - update: { method: 'PUT'} - }), - centerMeetingResource:defineResource(apiVer + "/centers/:centerId/meetings/:templateSource", {centerId:'@centerId',templateSource:'@templateSource'}, { - getMeetingInfo: {method:'GET', params: {}} - }), - centerTemplateResource: defineResource(apiVer + "/centers/template", {}, { - get: {method: 'GET', params: {}} - }), - jobsResource: defineResource(apiVer + "/jobs/:jobId/:resourceType", {jobId : '@jobId',resourceType : '@resourceType'}, { - get: {method: 'GET', params: {}, isArray: true}, - getJobDetails: {method: 'GET', params: {}}, - getJobHistory: {method: 'GET', params: {}}, - update: {method: 'PUT', params: {}}, - }), - schedulerResource: defineResource(apiVer + "/scheduler", {}, { - get: {method: 'GET', params: {}} - }), - assignStaffResource:defineResource(apiVer + "/groups/:groupOrCenterId", {groupOrCenterId:'@groupOrCenterId'}, { - get: {method: 'GET', params: {}} - }), - configurationResource:defineResource(apiVer + "/configurations/:id", {id: '@id'}, { - get: {method: 'GET', params: {}}, - update: {method: 'PUT', params: {}} - }), - cacheResource:defineResource(apiVer + "/caches",{}, { - get: {method: 'GET', params: {}, isArray:true}, - update: {method: 'PUT', params: {}} - }), - templateResource:defineResource(apiVer + "/templates/:templateId/:resourceType",{templateId: '@templateId', resourceType:'@resourceType'}, { - get: {method: 'GET', params: {}, isArray:true}, - getTemplateDetails: {method: 'GET', params: {}}, - update: {method: 'PUT', params: {}}, - }), - loanProductTemplateResource: defineResource(apiVer + "/loanproducts/template", {}, { - get: {method: 'GET', params: {}} - }), - loanReassignmentResource: defineResource(apiVer + "/loans/loanreassignment/:templateSource", {templateSource:'@templateSource'}, { - get: {method: 'GET', params: {}} - }), - auditResource: defineResource(apiVer + "/audits/:templateResource", {templateResource:'@templateResource'}, { - get: {method: 'GET', params: {}}, - search: {method: 'GET', params: {},isArray:true} - }), - guarantorResource: defineResource(apiVer + "/loans/:loanId/guarantors/:templateResource", {loanId:'@loanId',templateResource:'@templateResource'}, { - get: {method: 'GET', params: {}}, - update: {method: 'PUT', params: {}} - }), - checkerInboxResource: defineResource(apiVer + "/makercheckers/:templateResource", {templateResource:'@templateResource'}, { - get: {method: 'GET', params: {}}, - search: {method: 'GET', params: {},isArray:true} - }) + this.setTenantIdenetifier = function (tenant) { + tenantIdentifier = tenant; + } + this.$get = ['$resource', '$rootScope', function (resource, $rootScope) { + var defineResource = function (url, paramDefaults, actions) { + var tempUrl = baseUrl; + $rootScope.hostUrl = tempUrl; + $rootScope.tenantIdentifier = tenantIdentifier; + return resource(baseUrl + url, paramDefaults, actions); + }; + return { + userResource: defineResource(apiVer + "/users/:userId", {userId: '@userId'}, { + getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}, + getUser: {method: 'GET', params: {}} + }), + roleResource: defineResource(apiVer + "/roles/:roleId", {}, { + getAllRoles: {method: 'GET', params: {}, isArray: true} + }), + rolePermissionResource: defineResource(apiVer + "/roles/:roleId/permissions", {roleId: '@roleId'}, { + get: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + permissionResource: defineResource(apiVer + "/permissions", {}, { + get: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT'} + }), + officeResource: defineResource(apiVer + "/offices/:officeId", {officeId: "@officeId"}, { + getAllOffices: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT'} + }), + clientResource: defineResource(apiVer + "/clients/:clientId/:anotherresource", {clientId: '@clientId', anotherresource: '@anotherresource'}, { + getAllClients: {method: 'GET', params: {}}, + getClientClosureReasons: {method: 'GET', params: {}}, + getAllClientDocuments: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT'} + }), + clientIdentifierResource: defineResource(apiVer + "/client_identifiers/:clientIdentityId/documents", {clientIdentityId: '@clientIdentityId'}, { + get: {method: 'GET', params: {}, isArray: true} + }), + clientDocumentsResource: defineResource(apiVer + "/clients/:clientId/documents/:documentId", {clientId: '@clientId', documentId: '@documentId'}, { + getAllClientDocuments: {method: 'GET', params: {}, isArray: true} + }), + clientAccountResource: defineResource(apiVer + "/clients/:clientId/accounts", {clientId: '@clientId'}, { + getAllClients: {method: 'GET', params: {}} + }), + clientNotesResource: defineResource(apiVer + "/clients/:clientId/notes", {clientId: '@clientId'}, { + getAllNotes: {method: 'GET', params: {}, isArray: true} + }), + clientTemplateResource: defineResource(apiVer + "/clients/template", {}, { + get: {method: 'GET', params: {}} + }), + clientIdenfierTemplateResource: defineResource(apiVer + "/clients/:clientId/identifiers/template", {clientId: '@clientId'}, { + get: {method: 'GET', params: {}} + }), + clientIdenfierResource: defineResource(apiVer + "/clients/:clientId/identifiers/:id", {clientId: '@clientId', id: '@id'}, { + get: {method: 'GET', params: {}} + }), + groupResource: defineResource(apiVer + "/groups/:groupId/:anotherresource", {groupId: '@groupId', anotherresource: '@anotherresource'}, { + get: {method: 'GET', params: {}}, + getAllGroups: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT'} + }), + groupSummaryResource: defineResource(apiVer + "/runreports/:reportSource", {reportSource: '@reportSource'}, { + getSummary: {method: 'GET', params: {}} + }), + groupAccountResource: defineResource(apiVer + "/groups/:groupId/accounts", {groupId: '@groupId'}, { + getAll: {method: 'GET', params: {}} + }), + groupNotesResource: defineResource(apiVer + "/groups/:groupId/notes/:noteId", {groupId: '@groupId', noteId: '@noteId'}, { + getAllNotes: {method: 'GET', params: {}, isArray: true} + }), + groupTemplateResource: defineResource(apiVer + "/groups/template", {}, { + get: {method: 'GET', params: {}} + }), + groupMeetingResource: defineResource(apiVer + "/groups/:groupId/meetings/:templateSource", {groupId: '@groupId', templateSource: '@templateSource'}, { + getMeetingInfo: {method: 'GET', params: {}} + }), + attachMeetingResource: defineResource(apiVer + "/:groupOrCenter/:groupOrCenterId/calendars/:templateSource", {groupOrCenter: '@groupOrCenter', groupOrCenterId: '@groupOrCenterId', + templateSource: '@templateSource'}, { + update: {method: 'PUT'} + }), + runReportsResource: defineResource(apiVer + "/runreports/:reportSource", {reportSource: '@reportSource'}, { + get: {method: 'GET', params: {}, isArray: true}, + getReport: {method: 'GET', params: {}} + }), + reportsResource: defineResource(apiVer + "/reports/:id/:resourceType", {id: '@id', resourceType: '@resourceType'}, { + get: {method: 'GET', params: {id: '@id'}}, + getReport: {method: 'GET', params: {id: '@id'}, isArray: true}, + getReportDetails: {method: 'GET', params: {id: '@id'}}, + update: {method: 'PUT', params: {}} + }), + xbrlMixtaxonomyResource: defineResource(apiVer + "/mixtaxonomy", {}, { + get: {method: 'GET', params: {}, isArray: true} + }), + xbrlMixMappingResource: defineResource(apiVer + "/mixmapping", {}, { + get: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT', params: {}} + }), + DataTablesResource: defineResource(apiVer + "/datatables/:datatablename/:entityId/:resourceId", {datatablename: '@datatablename', entityId: '@entityId', resourceId: '@resourceId'}, { + getAllDataTables: {method: 'GET', params: {}, isArray: true}, + getTableDetails: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + loanProductResource: defineResource(apiVer + "/loanproducts/:loanProductId/:resourceType", {resourceType: '@resourceType', loanProductId: '@loanProductId'}, { + getAllLoanProducts: {method: 'GET', params: {}, isArray: true}, + getProductmix: {method: 'GET', params: {}}, + put: {method: 'PUT', params: {}} + }), + chargeResource: defineResource(apiVer + "/charges/:chargeId", {chargeId: '@chargeId'}, { + getAllCharges: {method: 'GET', params: {}, isArray: true}, + getCharge: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}} + }), + chargeTemplateResource: defineResource(apiVer + "/charges/template", { + get: {method: 'GET', params: {}, isArray: true}, + getChargeTemplates: {method: 'GET', params: {}}, + }), + savingProductResource: defineResource(apiVer + "/savingsproducts/:savingProductId/:resourceType", {savingProductId: '@savingProductId', resourceType: '@resourceType'}, { + getAllSavingProducts: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT', params: {}} + }), + loanResource: defineResource(apiVer + "/loans/:loanId/:resourceType/:resourceId", {resourceType: '@resourceType', loanId: '@loanId', resourceId: '@resourceId'}, { + getAllLoans: {method: 'GET', params: {}}, + put: {method: 'PUT', params: {}} + }), + loanChargeTemplateResource: defineResource(apiVer + "/loans/:loanId/charges/template", {loanId: '@loanId'}, { + get: {method: 'GET', params: {}} + }), + loanChargesResource: defineResource(apiVer + "/loans/:loanId/charges/:chargeId", {loanId: '@loanId', chargeId: '@chargeId'}, { + }), + loanCollateralTemplateResource: defineResource(apiVer + "/loans/:loanId/collaterals/template", {loanId: '@loanId'}, { + get: {method: 'GET', params: {}} + }), + loanTrxnsTemplateResource: defineResource(apiVer + "/loans/:loanId/transactions/template", {loanId: '@loanId'}, { + get: {method: 'GET', params: {}} + }), + loanTrxnsResource: defineResource(apiVer + "/loans/:loanId/transactions/:transactionId", {loanId: '@loanId', transactionId: '@transactionId'}, { + get: {method: 'GET', params: {}} + }), + LoanAccountResource: defineResource(apiVer + "/loans/:loanId/:resourceType/:chargeId", {loanId: '@loanId', resourceType: '@resourceType', chargeId: '@chargeId'}, { + getLoanAccountDetails: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + LoanEditDisburseResource: defineResource(apiVer + "/loans/:loanId/disbursements/:disbursementId", {loanId: '@loanId', disbursementId: '@disbursementId'}, { + getLoanAccountDetails: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + LoanDocumentResource: defineResource(apiVer + "/loans/:loanId/documents/:documentId", {loanId: '@loanId', documentId: '@documentId'}, { + getLoanDocuments: {method: 'GET', params: {}, isArray: true} + }), + currencyConfigResource: defineResource(apiVer + "/currencies", {}, { + get: {method: 'GET', params: {}}, + update: { method: 'PUT'}, + upd: { method: 'PUT', params: {}, isArray: true} + }), + userListResource: defineResource(apiVer + "/users/:userId", {userId: '@userId'}, { + getAllUsers: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT' } + }), + userTemplateResource: defineResource(apiVer + "/users/template", {}, { + get: {method: 'GET', params: {}} + }), + employeeResource: defineResource(apiVer + "/staff/:staffId", {staffId: '@staffId'}, { + getAllEmployees: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT' } + }), + globalSearch: defineResource(apiVer + "/search", {query: '@query'}, { + search: { method: 'GET', + params: { query: '@query'}, + isArray: true + } + }), + globalSearchTemplateResource: defineResource(apiVer + "/search/template", {}, { + get: {method: 'GET', params: {}} + }), + globalAdHocSearchResource: defineResource(apiVer + "/search/advance", {}, { + get: {method: 'GET', params: {}}, + search: { method: 'POST', isArray: true } + }), + fundsResource: defineResource(apiVer + "/funds/:fundId", {fundId: '@fundId'}, { + getAllFunds: {method: 'GET', params: {}, isArray: true}, + getFund: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}} + }), + accountingRulesResource: defineResource(apiVer + "/accountingrules/:accountingRuleId", {accountingRuleId: '@accountingRuleId'}, { + getAllRules: {method: 'GET', params: {associations: 'all'}, isArray: true}, + getById: {method: 'GET', params: {accountingRuleId: '@accountingRuleId'}}, + get: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT'} + }), + accountingRulesTemplateResource: defineResource(apiVer + "/accountingrules/template", {}, { + get: {method: 'GET', params: {}} + }), + accountCoaResource: defineResource(apiVer + "/glaccounts/:glAccountId", {glAccountId: '@glAccountId'}, { + getAllAccountCoas: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT' } + }), + accountCoaTemplateResource: defineResource(apiVer + "/glaccounts/template", {}, { + get: {method: 'GET', params: {}} + }), + journalEntriesResource: defineResource(apiVer + "/journalentries/:trxid", {trxid: '@transactionId'}, { + get: {method: 'GET', params: {transactionId: '@transactionId'}}, + reverse: {method: 'POST', params: {command: 'reverse'}}, + search: {method: 'GET', params: {}} + }), + accountingClosureResource: defineResource(apiVer + "/glclosures/:accId", {accId: "@accId"}, { + get: {method: 'GET', params: {}, isArray: true}, + getView: {method: 'GET', params: {}} + }), + codeResources: defineResource(apiVer + "/codes/:codeId", {codeId: "@codeId"}, { + getAllCodes: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT', params: {}, isArray: true } + }), + codeValueResource: defineResource(apiVer + "/codes/:codeId/codevalues/:codevalueId", {codeId: '@codeId', codevalueId: '@codevalueId'}, { + getAllCodeValues: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT', params: {}, isArray: true } + }), + holResource: defineResource(apiVer + "/holidays", {}, { + getAllHols: {method: 'GET', params: {}, isArray: true} + }), + holValueResource: defineResource(apiVer + "/holidays/:holId", {holId: '@holId'}, { + getholvalues: {method: 'GET', params: {}}, + update: { method: 'PUT', params: {}, isArray: true } + }), + savingsTemplateResource: defineResource(apiVer + "/savingsaccounts/template", {}, { + get: {method: 'GET', params: {}} + }), + savingsResource: defineResource(apiVer + "/savingsaccounts/:accountId/:resourceType/:chargeId", + {accountId: '@accountId', resourceType: '@resourceType', chargeId: '@chargeId'}, { + get: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + savingsChargeResource: defineResource(apiVer + "/savingsaccounts/:accountId/charges/:resourceType", {accountId: '@accountId', resourceType: '@resourceType'}, { + get: {method: 'GET', params: {}}, + update: {method: 'PUT'} + }), + savingsTrxnsTemplateResource: defineResource(apiVer + "/savingsaccounts/:savingsId/transactions/template", {savingsId: '@savingsId'}, { + get: {method: 'GET', params: {savingsId: '@savingsId'}} + }), + savingsTrxnsResource: defineResource(apiVer + "/savingsaccounts/:savingsId/transactions/:transactionId", {savingsId: '@savingsId', transactionId: '@transactionId'}, { + get: {method: 'GET', params: {savingsId: '@savingsId', transactionId: '@transactionId'}} + }), + accountTransferResource: defineResource(apiVer + "/accounttransfers/:transferId", {transferId: '@transferId'}, { + get: {method: 'GET', params: {transferId: '@transferId'}} + }), + accountTransfersTemplateResource: defineResource(apiVer + "/accounttransfers/template", {}, { + get: {method: 'GET', params: {}} + }), + centerAccountResource: defineResource(apiVer + "/centers/:centerId/accounts", {centerId: '@centerId'}, { + getAll: {method: 'GET', params: {}, isArray: true} + }), + centerResource: defineResource(apiVer + "/centers/:centerId/:anotherresource", {centerId: '@centerId', anotherresource: '@anotherresource'}, { + get: {method: 'GET', params: {}}, + getAllCenters: {method: 'GET', params: {}, isArray: true}, + getAllMeetingFallCenters: {method: 'GET', params: {}, isArray: true}, + update: { method: 'PUT'} + }), + centerMeetingResource: defineResource(apiVer + "/centers/:centerId/meetings/:templateSource", {centerId: '@centerId', templateSource: '@templateSource'}, { + getMeetingInfo: {method: 'GET', params: {}} + }), + centerTemplateResource: defineResource(apiVer + "/centers/template", {}, { + get: {method: 'GET', params: {}} + }), + jobsResource: defineResource(apiVer + "/jobs/:jobId/:resourceType", {jobId: '@jobId', resourceType: '@resourceType'}, { + get: {method: 'GET', params: {}, isArray: true}, + getJobDetails: {method: 'GET', params: {}}, + getJobHistory: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}}, + }), + schedulerResource: defineResource(apiVer + "/scheduler", {}, { + get: {method: 'GET', params: {}} + }), + assignStaffResource: defineResource(apiVer + "/groups/:groupOrCenterId", {groupOrCenterId: '@groupOrCenterId'}, { + get: {method: 'GET', params: {}} + }), + configurationResource: defineResource(apiVer + "/configurations/:id", {id: '@id'}, { + get: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}} + }), + cacheResource: defineResource(apiVer + "/caches", {}, { + get: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT', params: {}} + }), + templateResource: defineResource(apiVer + "/templates/:templateId/:resourceType", {templateId: '@templateId', resourceType: '@resourceType'}, { + get: {method: 'GET', params: {}, isArray: true}, + getTemplateDetails: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}}, + }), + loanProductTemplateResource: defineResource(apiVer + "/loanproducts/template", {}, { + get: {method: 'GET', params: {}} + }), + loanReassignmentResource: defineResource(apiVer + "/loans/loanreassignment/:templateSource", {templateSource: '@templateSource'}, { + get: {method: 'GET', params: {}} + }), + auditResource: defineResource(apiVer + "/audits/:templateResource", {templateResource: '@templateResource'}, { + get: {method: 'GET', params: {}}, + search: {method: 'GET', params: {}, isArray: true} + }), + guarantorResource: defineResource(apiVer + "/loans/:loanId/guarantors/:templateResource", {loanId: '@loanId', templateResource: '@templateResource'}, { + get: {method: 'GET', params: {}}, + update: {method: 'PUT', params: {}} + }), + checkerInboxResource: defineResource(apiVer + "/makercheckers/:templateResource", {templateResource: '@templateResource'}, { + get: {method: 'GET', params: {}}, + search: {method: 'GET', params: {}, isArray: true} + }) - }; - }]; - } - }); - mifosX.ng.services.config(function($provide) { - $provide.provider('ResourceFactory', mifosX.services.ResourceFactoryProvider); - }).run(function($log) { $log.info("ResourceFactory initialized"); }); + }; + }]; + } + }); + mifosX.ng.services.config(function ($provide) { + $provide.provider('ResourceFactory', mifosX.services.ResourceFactoryProvider); + }).run(function ($log) { + $log.info("ResourceFactory initialized"); + }); }(mifosX.services || {})); diff --git a/app/scripts/services/SessionManager.js b/app/scripts/services/SessionManager.js index c17212de..7828fd67 100644 --- a/app/scripts/services/SessionManager.js +++ b/app/scripts/services/SessionManager.js @@ -1,40 +1,40 @@ -(function(module) { - mifosX.services = _.extend(module, { - SessionManager: function(webStorage, httpService, resourceFactory) { - var EMPTY_SESSION = {}; +(function (module) { + mifosX.services = _.extend(module, { + SessionManager: function (webStorage, httpService, resourceFactory) { + var EMPTY_SESSION = {}; - this.get = function(data) { - webStorage.add("sessionData", {userId: data.userId, authenticationKey: data.base64EncodedAuthenticationKey, userPermissions:data.permissions}); - httpService.setAuthorization(data.base64EncodedAuthenticationKey); - return {user: new mifosX.models.LoggedInUser(data)}; - } + this.get = function (data) { + webStorage.add("sessionData", {userId: data.userId, authenticationKey: data.base64EncodedAuthenticationKey, userPermissions: data.permissions}); + httpService.setAuthorization(data.base64EncodedAuthenticationKey); + return {user: new mifosX.models.LoggedInUser(data)}; + } - this.clear = function() { - webStorage.remove("sessionData"); - httpService.cancelAuthorization(); - return EMPTY_SESSION; - }; + this.clear = function () { + webStorage.remove("sessionData"); + httpService.cancelAuthorization(); + return EMPTY_SESSION; + }; - this.restore = function(handler) { - var sessionData = webStorage.get('sessionData'); - if (sessionData !== null) { - httpService.setAuthorization(sessionData.authenticationKey); - resourceFactory.userResource.get({userId: sessionData.userId}, function(userData) { - userData.userPermissions = sessionData.userPermissions; - handler({user: new mifosX.models.LoggedInUser(userData)}); - }); - } else { - handler(EMPTY_SESSION); + this.restore = function (handler) { + var sessionData = webStorage.get('sessionData'); + if (sessionData !== null) { + httpService.setAuthorization(sessionData.authenticationKey); + resourceFactory.userResource.get({userId: sessionData.userId}, function (userData) { + userData.userPermissions = sessionData.userPermissions; + handler({user: new mifosX.models.LoggedInUser(userData)}); + }); + } else { + handler(EMPTY_SESSION); + } + }; } - }; - } - }); - mifosX.ng.services.service('SessionManager', [ - 'webStorage', - 'HttpService', - 'ResourceFactory', - mifosX.services.SessionManager - ]).run(function($log) { - $log.info("SessionManager initialized"); - }); + }); + mifosX.ng.services.service('SessionManager', [ + 'webStorage', + 'HttpService', + 'ResourceFactory', + mifosX.services.SessionManager + ]).run(function ($log) { + $log.info("SessionManager initialized"); + }); }(mifosX.services || {})); diff --git a/app/scripts/webstorage-configuration.js b/app/scripts/webstorage-configuration.js index 55c503cd..fe1f9e96 100644 --- a/app/scripts/webstorage-configuration.js +++ b/app/scripts/webstorage-configuration.js @@ -1,15 +1,15 @@ -define(['angular', 'webstorage'], function(angular) { - angular.module('webStorageModule') - .constant('prefix', 'mifosX') - .run(function($log, webStorage) { - if (webStorage.isSupported) { - if (webStorage.local.isSupported) { - $log.info('Using local storage'); - } else if (webStorage.session.isSupported) { - $log.info('Using session storage'); - } else { - $log.warn('Using memory storage: a page reload will clear all stored data'); - } - } - }); +define(['angular', 'webstorage'], function (angular) { + angular.module('webStorageModule') + .constant('prefix', 'mifosX') + .run(function ($log, webStorage) { + if (webStorage.isSupported) { + if (webStorage.local.isSupported) { + $log.info('Using local storage'); + } else if (webStorage.session.isSupported) { + $log.info('Using session storage'); + } else { + $log.warn('Using memory storage: a page reload will clear all stored data'); + } + } + }); }); diff --git a/app/views/accounting/accounting.html b/app/views/accounting/accounting.html index 306fcebc..ae721db9 100644 --- a/app/views/accounting/accounting.html +++ b/app/views/accounting/accounting.html @@ -1,32 +1,45 @@
- - + +
\ No newline at end of file diff --git a/app/views/accounting/accounting_coa.html b/app/views/accounting/accounting_coa.html index 0b32f364..60d0671b 100644 --- a/app/views/accounting/accounting_coa.html +++ b/app/views/accounting/accounting_coa.html @@ -1,55 +1,60 @@
- +

{{'label.heading.chartofaccounts' | translate}}

+
- - - - - - - - - - - - - - - - - - - - - - -
{{'label.heading.account' | translate}}{{'label.heading.glcode' | translate}}{{'label.heading.acctype' | translate}}{{'label.heading.disabled' | translate}}?{{'label.heading.manualentriesallowed' | translate}}{{'label.heading.usedas' | translate}}
- {{coadata.name}} - - {{coadata.glCode}} - {{coadata.type.value}}{{coadata.disabled}}{{coadata.manualEntriesAllowed}}{{coadata.usage.value}}
+ + + + + + + + + + + + + + + + + + + + + + +
{{'label.heading.account' | translate}}{{'label.heading.glcode' | translate}}{{'label.heading.acctype' | translate}}{{'label.heading.disabled' | translate}}?{{'label.heading.manualentriesallowed' | translate}}{{'label.heading.usedas' | translate}}
+ {{coadata.name}} + + {{coadata.glCode}} + {{coadata.type.value}}{{coadata.disabled}}{{coadata.manualEntriesAllowed}}{{coadata.usage.value}}
-
-
+
+
\ No newline at end of file diff --git a/app/views/accounting/accounting_rules.html b/app/views/accounting/accounting_rules.html index 4d16b14b..adb4870d 100644 --- a/app/views/accounting/accounting_rules.html +++ b/app/views/accounting/accounting_rules.html @@ -1,26 +1,27 @@
- - + +
- +
- - - - + + + + - - - - + + + +
{{'label.heading.name' | translate}}{{'label.heading.office' | translate}}
{{'label.heading.name' | translate}}{{'label.heading.office' | translate}}
{{rule.name}}{{rule.officeName}}
{{rule.name}}{{rule.officeName}}
\ No newline at end of file diff --git a/app/views/accounting/accounts_closure.html b/app/views/accounting/accounts_closure.html index e5b40a94..64f1feea 100644 --- a/app/views/accounting/accounts_closure.html +++ b/app/views/accounting/accounts_closure.html @@ -4,10 +4,11 @@
  • {{'label.anchor.accountsclosure' | translate}}
  • -
    +
    {{ 'label.heading.closedaccountingdetails' | translate }}
    diff --git a/app/views/accounting/add_acc_rule.html b/app/views/accounting/add_acc_rule.html index 2d0326a1..7a1e3c12 100644 --- a/app/views/accounting/add_acc_rule.html +++ b/app/views/accounting/add_acc_rule.html @@ -1,96 +1,120 @@ -
    -
    - {{ 'label.heading.accountingruletitle' | translate }} -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - - - - - - - -
    - {{ 'label.input.credit' | translate }} - - {{ 'label.input.debit' | translate }} -
    - {{ 'label.input.creditruletype' | translate }}   - {{ 'label.input.account' | translate}}     - {{ 'label.input.tags' | translate}} - - {{ 'label.input.debitruletype' | translate }}  - {{ 'label.input.account' | translate}}     - {{ 'label.input.tags' | translate}} -
    -
    - -
    -
    - - -     -
    -
    - -   -
    -
    -
    -
    - -
    -
    - - -     -
    -
    - -   -
    -
    -
    -
    -
    -
    - - -
    -
    + +
    + {{ 'label.heading.accountingruletitle' | translate }} +
    + + +
    + + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + + + + + + + + + + + + + +
    + {{ 'label.input.credit' | translate }} + + {{ 'label.input.debit' | translate }} +
    + {{ 'label.input.creditruletype' | translate }}   + {{ + 'label.input.account' | translate}}     + {{ + 'label.input.tags' | translate}} + + {{ 'label.input.debitruletype' | translate }}  + {{ + 'label.input.account' | translate}}     + {{ + 'label.input.tags' | translate}} +
    +
    + +
    +
    + + +     +
    + +
    + +   +
    +
    +
    +
    + +
    +
    + + +     +
    + +
    + +   +
    +
    +
    +
    +
    +
    + + + + +
    +
    diff --git a/app/views/accounting/createclosure.html b/app/views/accounting/createclosure.html index 00370d09..e1446882 100644 --- a/app/views/accounting/createclosure.html +++ b/app/views/accounting/createclosure.html @@ -1,17 +1,22 @@ -
    + {{ 'label.heading.createclosure' | translate }}
    +
    - {{ 'label.input.previouslyclosedon' | translate }} - {{lastClosed | DateFormat}} @@ -20,19 +25,24 @@
    +
    - +
    +
    \ No newline at end of file diff --git a/app/views/accounting/createglaccounting.html b/app/views/accounting/createglaccounting.html index 0c1a2e13..ad0f8a9d 100644 --- a/app/views/accounting/createglaccounting.html +++ b/app/views/accounting/createglaccounting.html @@ -17,6 +17,7 @@
    +
    diff --git a/app/views/accounting/edit_acc_rule.html b/app/views/accounting/edit_acc_rule.html index 1eb8033a..fdba8ab9 100644 --- a/app/views/accounting/edit_acc_rule.html +++ b/app/views/accounting/edit_acc_rule.html @@ -1,100 +1,124 @@ -
    -
    +
    + - -
    -
    - {{ 'label.heading.editaccountingrule' | translate }} -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - - - - - - - - - - - - -
    - {{ 'label.input.credit' | translate }} - - {{ 'label.input.debit' | translate }} -
    - {{ 'label.input.creditruletype' | translate }}   - {{ 'label.input.account' | translate}}     - {{ 'label.input.tags' | translate}} - - {{ 'label.input.debitruletype' | translate }}  - {{ 'label.input.account' | translate}}     - {{ 'label.input.tags' | translate}} -
    -
    - -
    -
    - - -     -
    -
    - -   -
    -
    -
    -
    - -
    -
    - - -     -
    -
    - -   -
    -
    -
    -
    -
    -
    - - -
    -
    -
    + +
    +
    + {{ 'label.heading.editaccountingrule' | translate }} +
    + + +
    + + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + + + + + + + + + + + + + +
    + {{ 'label.input.credit' | translate }} + + {{ 'label.input.debit' | translate }} +
    + {{ 'label.input.creditruletype' | translate }}   + {{ 'label.input.account' | translate}}     + {{ + 'label.input.tags' | translate}} + + {{ 'label.input.debitruletype' | translate }}  + {{ + 'label.input.account' | translate}}     + {{ + 'label.input.tags' | translate}} +
    +
    + +
    +
    + + +     +
    + +
    + +   +
    +
    +
    +
    + +
    +
    + + +     +
    + +
    + +   +
    +
    +
    +
    +
    +
    + + + + +
    +
    +
    +
    diff --git a/app/views/accounting/editglaccounting.html b/app/views/accounting/editglaccounting.html index df16c894..ad52efd8 100644 --- a/app/views/accounting/editglaccounting.html +++ b/app/views/accounting/editglaccounting.html @@ -1,111 +1,135 @@
    -
    - -
    - -
    -
    - {{'label.heading.editglaccount' | translate}} - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    - - -
    +
    + +
    + + +
    + {{'label.heading.editglaccount' | translate}} + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    + + +
    +
    +
    +
    + + +
    + + +
    +
    +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    +
    + + +
    +
    +
    + + +
    + +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    + + + +
    -
    -
    - -
    - - -
    -
    -
    -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    -
    + +
    \ No newline at end of file diff --git a/app/views/accounting/freqposting.html b/app/views/accounting/freqposting.html index 2630cd4e..731b6a84 100644 --- a/app/views/accounting/freqposting.html +++ b/app/views/accounting/freqposting.html @@ -1,113 +1,141 @@ -
    - -
    +
    + +
    -
    - -
    - {{ 'label.heading.addjournalentry' | translate }} -
    + + +
    + {{ 'label.heading.addjournalentry' | translate }} +
    +
    - +
    -
    -
    +
    +
    +
    - - + +
    -
    -
    - +
    +
    + +
    - - + +
    -
    -
    - +
    +
    + +
    - - - - - - - + +
    - {{ 'label.input.credit' | translate }} - - {{ 'label.input.debit' | translate }} -
    -
    - -   -     - + + + + + + + - + - -
    + {{ 'label.input.credit' | translate }} + + {{ 'label.input.debit' | translate }} +
    +
    + +   +     + {{'label.requiredfield' | translate}} -
    -
    -
    - - {{allowDebitEntries}} -   -
    -
    -
    - -   -     - +
    +
    + +
    + + {{allowDebitEntries}} +   +
    +
    +
    + +   +     + {{'label.requiredfield' | translate}} -
    -
    -
    - - -   -
    -
    +
    +
    + +
    + + +   +
    +
    -
    -
    +
    +
    +
    - +
    -
    -
    - +
    +
    + +
    - +
    -
    -
    - +
    +
    + +
    - +
    -
    - +
    + + + -
    -
    - +
    +
    + diff --git a/app/views/accounting/journalentry_posting.html b/app/views/accounting/journalentry_posting.html index 99dd42db..dc192125 100644 --- a/app/views/accounting/journalentry_posting.html +++ b/app/views/accounting/journalentry_posting.html @@ -1,161 +1,193 @@ -
    - -
    -
    - -
    - {{ 'label.heading.addjournalentry' | translate }} -
    +
    + +
    + + +
    + {{ 'label.heading.addjournalentry' | translate }} +
    +
    - +
    -
    -
    - +
    +
    + +
    - - + +
    -
    -
    - +
    +
    + +
    - -

    {{ 'label.input.credit' | translate }}

    - - + + +
    -
    - -   -     - - + +

    {{ 'label.input.credit' | translate }}

    + + - - -
    +
    + +   +     + + {{'label.'+labelcrediterror | translate}} -
    -
    -
    -    - -    -
    -
    -
    - -

    {{ 'label.input.debit' | translate }}

    - - + + +
    -
    - -   -     - - +
    +
    + +
    +    + +    +
    +
    +
    + +

    {{ 'label.input.debit' | translate }}

    + + - - -
    +
    + +   +     + + {{'label.'+labeldebiterror | translate}} -
    -
    -
    -    - -    -
    -
    -
    - -
    - -
    - -
    -
    + +
    -
    - -
    - -
    -
    -
    - -
    +
    +    + +    +
    +
    +
    +
    +
    + + +
    + +
    +
    + +
    + + +
    + +
    +
    +
    + + + -
    -
    -
    +
    +
    +
    +
    +
    - +
    -
    -
    +
    +
    +
    - +
    -
    -
    +
    +
    +
    - +
    -
    -
    +
    +
    +
    - +
    -
    -
    +
    +
    +
    - +
    -
    -
    -
    +
    +
    +
    +
    - +
    -
    -
    +
    +
    +
    - +
    -
    - +
    + + + -
    -
    -
    +
    + + diff --git a/app/views/accounting/search_transaction.html b/app/views/accounting/search_transaction.html index c7431194..32a00f28 100644 --- a/app/views/accounting/search_transaction.html +++ b/app/views/accounting/search_transaction.html @@ -1,86 +1,113 @@
    - -

    -
    - - + +
    +
    + +
    + + - +

    - + +
    +
    - +
    +
    - +
    - + -
    - {{'label.button.advancesearch' | translate}} +
    + {{'label.button.advancesearch' | translate}}
    - +
    - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + +
    {{'label.heading.entryid' | translate}}{{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.transactionid' | translate}}{{'label.heading.type' | translate}}{{'label.heading.createdby' | translate}}{{'label.heading.account' | translate}}{{'label.heading.debit' | translate}}{{'label.heading.credit' | translate}}
    {{'label.heading.entryid' | translate}}{{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.transactionid' | translate}}{{'label.heading.type' | translate}}{{'label.heading.createdby' | translate}}{{'label.heading.account' | translate}}{{'label.heading.debit' | translate}}{{'label.heading.credit' | translate}}
    {{transaction.id}}{{transaction.officeName}}{{transaction.transactionDate | DateFormat}}{{transaction.transactionId}}{{transaction.glAccountType.value}}{{transaction.createdByUserName}}{{transaction.glAccountName}}({{transaction.glAccountCode}}) -
    - {{transaction.currency.displaySymbol}} {{transaction.amount}} -
    -
    -
    - {{transaction.currency.displaySymbol}} {{transaction.amount}} -
    -
    {{transaction.id}}{{transaction.officeName}}{{transaction.transactionDate | + DateFormat}} + {{transaction.transactionId}} + + {{transaction.glAccountType.value}} + + {{transaction.createdByUserName}} + + {{transaction.glAccountName}}({{transaction.glAccountCode}}) + +
    + {{transaction.currency.displaySymbol}} {{transaction.amount}} +
    +
    +
    + {{transaction.currency.displaySymbol}} {{transaction.amount}} +
    +
    \ No newline at end of file diff --git a/app/views/accounting/view_acc_rule.html b/app/views/accounting/view_acc_rule.html index 44186bdf..3402f5f6 100644 --- a/app/views/accounting/view_acc_rule.html +++ b/app/views/accounting/view_acc_rule.html @@ -1,19 +1,23 @@ -
    - -
    -
    -
    - {{'label.button.edit' | translate}} - -
    -
    -
    +
    + +
    +
    +
    + {{'label.button.edit' + | translate}} + +
    +
    +
    -
    -

    {{rule.name}}

    - - -
    - - - - - - - - - - - -
    {{ 'label.heading.creditaccountdetails' | translate }}{{ 'label.heading.debitaccountdetails' | translate }}
    - - - - - - - -
    {{crAccount.name}}({{crAccount.glCode}})
    {{creditTag.tag.name}}
    -
    - - - - - - - -
    {{dbAccount.name}}({{dbAccount.glCode}})
    {{debitTag.tag.name}}
    -
    -
    +
    +

    {{rule.name}}

    + + +
    + + + + + + + + + + + +
    {{ 'label.heading.creditaccountdetails' | translate }}{{ 'label.heading.debitaccountdetails' | translate }}
    + + + + + + + +
    {{crAccount.name}}({{crAccount.glCode}})
    {{creditTag.tag.name}}
    +
    + + + + + + + +
    {{dbAccount.name}}({{dbAccount.glCode}})
    {{debitTag.tag.name}}
    +
    +
    \ No newline at end of file diff --git a/app/views/accounting/view_close_accounting.html b/app/views/accounting/view_close_accounting.html index db9ba26f..9a733774 100644 --- a/app/views/accounting/view_close_accounting.html +++ b/app/views/accounting/view_close_accounting.html @@ -2,12 +2,15 @@
    - +
    - +
    - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + +
    {{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.type' | translate}}{{'label.heading.account' | translate}}{{'label.heading.debit' | translate}}{{'label.heading.credit' | translate}}
    {{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.type' | translate}}{{'label.heading.account' | translate}}{{'label.heading.debit' | translate}}{{'label.heading.credit' | translate}}
    {{transaction.officeName}}{{transaction.transactionDate | DateFormat}}{{transaction.glAccountType.value}}{{transaction.glAccountName}}({{transaction.glAccountCode}}) -
    - {{transaction.currency.displaySymbol}} {{transaction.amount}} -
    -
    -
    - {{transaction.currency.displaySymbol}} {{transaction.amount}} -
    -
    {{transaction.officeName}}{{transaction.transactionDate | DateFormat}}{{transaction.glAccountType.value}}{{transaction.glAccountName}}({{transaction.glAccountCode}}) +
    + {{transaction.currency.displaySymbol}} {{transaction.amount}} +
    +
    +
    + {{transaction.currency.displaySymbol}} {{transaction.amount}} +
    +
    diff --git a/app/views/accounting/viewglaccounting.html b/app/views/accounting/viewglaccounting.html index f6469b2b..d5685586 100644 --- a/app/views/accounting/viewglaccounting.html +++ b/app/views/accounting/viewglaccounting.html @@ -1,23 +1,28 @@
    - - - - -
    -

    {{glaccount.name}}

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.glcode' | translate }}{{glaccount.glCode}}
    {{ 'label.heading.acctype' | translate }}{{glaccount.type.value}}
    {{ 'label.heading.parentaccountname' | translate }}{{glaccount.parentName}}
    {{ 'label.heading.tag' | translate }}{{glaccount.tagId.name}}
    {{ 'label.heading.accountusage' | translate }}{{glaccount.usage.value}}
    {{ 'label.heading.manualentriesallowed' | translate }}{{glaccount.manualEntriesAllowed}}
    {{ 'label.heading.description' | translate }}{{glaccount.description}}
    -
    +
    +

    {{glaccount.name}}

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.glcode' | translate }}{{glaccount.glCode}}
    {{ 'label.heading.acctype' | translate }}{{glaccount.type.value}}
    {{ 'label.heading.parentaccountname' | translate }}{{glaccount.parentName}}
    {{ 'label.heading.tag' | translate }}{{glaccount.tagId.name}}
    {{ 'label.heading.accountusage' | translate }}{{glaccount.usage.value}}
    {{ 'label.heading.manualentriesallowed' | translate }}{{glaccount.manualEntriesAllowed}}
    {{ 'label.heading.description' | translate }}{{glaccount.description}}
    +
    \ No newline at end of file diff --git a/app/views/accounttransfers/make_accounttransfer.html b/app/views/accounttransfers/make_accounttransfer.html index 36d5b34b..9aaada5e 100644 --- a/app/views/accounttransfers/make_accounttransfer.html +++ b/app/views/accounttransfers/make_accounttransfer.html @@ -1,99 +1,127 @@ -
    -
    - -
    - -
    -
    - {{ 'label.heading.accounttransfers' | translate }} -
    - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.applicant' | translate}}{{transfer.fromClient.displayName}}{{'label.heading.office' | translate}}{{transfer.fromOffice.name}}
    {{'label.heading.fromaccount' | translate}}{{transfer.fromAccount.productName}} - #{{transfer.fromAccount.accountNo}}{{'label.heading.fromaccounttype' | translate}}{{transfer.fromAccountType.value}}
    {{'label.heading.currency' | translate}}{{transfer.currency.name}}
    -
    -
    - -
    - -
    - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - -
    -
    -
    - - -
    -
    -
    +
    +
    + +
    + +
    +
    + {{ 'label.heading.accounttransfers' | translate }} +
    + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.applicant' | translate}}{{transfer.fromClient.displayName}}{{'label.heading.office' | translate}}{{transfer.fromOffice.name}}
    {{'label.heading.fromaccount' | translate}}{{transfer.fromAccount.productName}} - #{{transfer.fromAccount.accountNo}}{{'label.heading.fromaccounttype' | translate}}{{transfer.fromAccountType.value}}
    {{'label.heading.currency' | translate}}{{transfer.currency.name}}
    +
    +
    + + +
    + + +
    + + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + + +
    +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/app/views/accounttransfers/view_accounttransfer.html b/app/views/accounttransfers/view_accounttransfer.html index 144eadb5..128956f3 100644 --- a/app/views/accounttransfers/view_accounttransfer.html +++ b/app/views/accounttransfers/view_accounttransfer.html @@ -1,76 +1,79 @@
    -
    - -
    -

    {{ 'label.heading.viewaccounttransferdetails' | translate}}

    - -
    -
    - {{ 'label.heading.transactiondetails' | translate}} - - - - - - - - - - - - - - -
    {{ 'label.heading.transactionamount' | translate }}{{transferData.transferAmount}}
    {{ 'label.heading.transactiondate' | translate }}{{transferData.transferDate}}
    {{ 'label.heading.description' | translate }}{{transferData.transferDescription}}
    - {{ 'label.heading.transferredfrom' | translate}} - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.office' | translate }}{{transferData.fromOffice.name}}
    {{ 'label.heading.client' | translate }}{{transferData.fromClient.displayName}}
    {{ 'label.heading.accounttype' | translate }}{{transferData.fromAccountType.value}}
    {{ 'label.heading.accnum' | translate }}{{transferData.fromAccount.accountNo}}
    - {{ 'label.heading.transferredto' | translate}} - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.office' | translate }}{{transferData.toOffice.name}}
    {{ 'label.heading.client' | translate }}{{transferData.toClient.displayName}}
    {{ 'label.heading.accounttype' | translate }}{{transferData.toAccountType.value}}
    {{ 'label.heading.accnum' | translate }}{{transferData.toAccount.accountNo}}
    -
    -
    +
    + +
    +

    {{ 'label.heading.viewaccounttransferdetails' | translate}}

    + + +
    +
    + {{ 'label.heading.transactiondetails' | translate}} + + + + + + + + + + + + + + +
    {{ 'label.heading.transactionamount' | translate }}{{transferData.transferAmount}}
    {{ 'label.heading.transactiondate' | translate }}{{transferData.transferDate}}
    {{ 'label.heading.description' | translate }}{{transferData.transferDescription}}
    + {{ 'label.heading.transferredfrom' | translate}} + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.office' | translate }}{{transferData.fromOffice.name}}
    {{ 'label.heading.client' | translate }}{{transferData.fromClient.displayName}}
    {{ 'label.heading.accounttype' | translate }}{{transferData.fromAccountType.value}}
    {{ 'label.heading.accnum' | translate }}{{transferData.fromAccount.accountNo}}
    + {{ 'label.heading.transferredto' | translate}} + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.office' | translate }}{{transferData.toOffice.name}}
    {{ 'label.heading.client' | translate }}{{transferData.toClient.displayName}}
    {{ 'label.heading.accounttype' | translate }}{{transferData.toAccountType.value}}
    {{ 'label.heading.accnum' | translate }}{{transferData.toAccount.accountNo}}
    +
    +
    \ No newline at end of file diff --git a/app/views/administration/addrole.html b/app/views/administration/addrole.html index b6fd1521..83f0d39d 100644 --- a/app/views/administration/addrole.html +++ b/app/views/administration/addrole.html @@ -1,36 +1,43 @@
    -
    - -
    -
    - -
    - {{'label.heading.addrole' | translate}} +
    + +
    + + +
    + {{'label.heading.addrole' | translate}} -
    - -
    - - -
    -
    +
    + -
    - -
    - - -
    -
    +
    + + +
    +
    -
    - - -
    -
    - +
    + + +
    + + +
    +
    + +
    + + + + +
    +
    +
    \ No newline at end of file diff --git a/app/views/administration/createuser.html b/app/views/administration/createuser.html index 1abe1937..f43efd39 100644 --- a/app/views/administration/createuser.html +++ b/app/views/administration/createuser.html @@ -1,97 +1,123 @@ -
    - -
    -
    - -
    - {{'label.heading.createuser' | translate}} -
    - +
    + +
    + + +
    + {{'label.heading.createuser' | translate}} +
    + +
    - - + +
    -
    -
    - +
    +
    + +
    - - + +
    -
    -
    - +
    +
    + +
    - - + +
    -
    -
    -
    -
    - +
    +
    +
    +
    + +
    - - + +
    -
    -
    -
    -
    +
    +
    +
    +
    +
    -
    -
    -
    -
    - -
    - +
    -
    -
    +
    +
    + + +
    + +
    +
    +
    - -
    - - -
    + + +
    + + +
    - -
    - - -
    + + +
    + + +
    -
    -
    +
    +
    +
    - +
    -
    -
    - +
    +
    + +
    - - + +
    -
    - +
    + + + -
    -
    - +
    +
    + diff --git a/app/views/administration/edituser.html b/app/views/administration/edituser.html index da33c519..ff9c99b2 100644 --- a/app/views/administration/edituser.html +++ b/app/views/administration/edituser.html @@ -1,69 +1,90 @@ -
    -
    +
    +
    -
    -
    +
    +
    - {{'label.heading.edituser' | translate}} - -
    - -
    - - -
    -
    - -
    - -
    - - -
    -
    + {{'label.heading.edituser' | translate}} -
    - -
    - - -
    -
    +
    + -
    - -
    - - +
    + + +
    -
    -
    - -
    - +
    + + +
    + + +
    -
    -
    - -
    - - +
    + + +
    + + +
    -
    -
    - - -
    +
    + + +
    + + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    + + +
    +
    + +
    + + + + +
    - -
    + +
    diff --git a/app/views/administration/global.html b/app/views/administration/global.html index ad5e459a..eb01f312 100644 --- a/app/views/administration/global.html +++ b/app/views/administration/global.html @@ -4,7 +4,8 @@
    - + @@ -17,8 +18,11 @@ - diff --git a/app/views/administration/makerchecker.html b/app/views/administration/makerchecker.html index f511d02b..5c108d03 100644 --- a/app/views/administration/makerchecker.html +++ b/app/views/administration/makerchecker.html @@ -1,45 +1,50 @@ - -
    - -
    -
    - -
    -

    {{'label.heading.makercheckertasks' | translate}}

    - -
    {{config.name}} {{config.enabled}} - + + +
    - - - - -
    - - - - -
    {{formatName(grouping)}}
    -
    - - - - - -
    -
    + +
    + +
    +
    + +
    +

    {{'label.heading.makercheckertasks' | translate}}

    -
    - {{ 'label.button.cancel' | translate}} - -
    + + + + + + +
    + + + + +
    {{formatName(grouping)}}
    +
    + + + + + +
    +
    +
    + +
    + {{ 'label.button.cancel' | translate}} + +
    \ No newline at end of file diff --git a/app/views/administration/organization.html b/app/views/administration/organization.html index 5897c628..7eb58ec8 100644 --- a/app/views/administration/organization.html +++ b/app/views/administration/organization.html @@ -1,34 +1,50 @@
    - - + +
    \ No newline at end of file diff --git a/app/views/administration/roles.html b/app/views/administration/roles.html index 041d6f5c..ed0de483 100644 --- a/app/views/administration/roles.html +++ b/app/views/administration/roles.html @@ -5,21 +5,22 @@
    - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}
    {{role.name}}{{role.description}}
    + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}
    {{role.name}}{{role.description}}
    diff --git a/app/views/administration/system.html b/app/views/administration/system.html index 843daa75..d3a1d840 100644 --- a/app/views/administration/system.html +++ b/app/views/administration/system.html @@ -1,42 +1,59 @@
    - -
    \ No newline at end of file diff --git a/app/views/administration/userFormDialog.html b/app/views/administration/userFormDialog.html index c4d06e54..f8c803c1 100644 --- a/app/views/administration/userFormDialog.html +++ b/app/views/administration/userFormDialog.html @@ -1,46 +1,51 @@
    -
    There were errors submitting the form:
    -
      -
    • - {{error.defaultUserMessage}} -
    • -
    +
    There were errors submitting the form:
    +
      +
    • + {{error.defaultUserMessage}} +
    • +
    - - + +
    - - + +
    - - + +
    - - + +
    - {{'label.input.generatepasswordandemailit' | translate}} + {{'label.input.generatepasswordandemailit' + | translate}}
    - -
    - -
    -
    - {{role.name}} + + +
    +
    + {{role.name}} +
    -
    - - + +
    diff --git a/app/views/administration/users.html b/app/views/administration/users.html index a0090299..6dedc337 100644 --- a/app/views/administration/users.html +++ b/app/views/administration/users.html @@ -1,19 +1,19 @@

    {{'label.heading.systemusers' | translate}}

    -
    -
    {{'label.heading.newuser' | translate}}
    -
    - - - - - - - - -
    {{'label.heading.username' | translate}}{{'label.heading.givenname' | translate}}{{'label.heading.familyname' | translate}}
    -
    +
    +
    {{'label.heading.newuser' | translate}}
    +
    + + + + + + + + +
    {{'label.heading.username' | translate}}{{'label.heading.givenname' | translate}}{{'label.heading.familyname' | translate}}
    +
    diff --git a/app/views/administration/usersettings.html b/app/views/administration/usersettings.html index 006d3021..117322b2 100644 --- a/app/views/administration/usersettings.html +++ b/app/views/administration/usersettings.html @@ -2,12 +2,15 @@
    +
    - +
    +
    diff --git a/app/views/administration/userslist.html b/app/views/administration/userslist.html index 140c82aa..c534f78a 100644 --- a/app/views/administration/userslist.html +++ b/app/views/administration/userslist.html @@ -3,28 +3,30 @@
  • {{'label.anchor.users' | translate}}
  • - - + +
    - - - - - - + + + + + + - - - - - - + + + + + +
    {{'label.heading.firstname' | translate}}{{'label.heading.lastname' | translate}}{{'label.heading.email' | translate}}{{'label.heading.office' | translate}}
    {{'label.heading.firstname' | translate}}{{'label.heading.lastname' | translate}}{{'label.heading.email' | translate}}{{'label.heading.office' | translate}}
    {{user.firstname}}{{user.lastname}}{{user.email}}{{user.officeName}}
    {{user.firstname}}{{user.lastname}}{{user.email}}{{user.officeName}}
    \ No newline at end of file diff --git a/app/views/administration/viewrole.html b/app/views/administration/viewrole.html index e547f5d7..76688b4d 100644 --- a/app/views/administration/viewrole.html +++ b/app/views/administration/viewrole.html @@ -1,61 +1,65 @@ -
    -
    - -
    -
    - -
    - -
    -
    - - - - - - - - - -
    {{'label.heading.name' | translate}}{{role.name}}
    {{'label.heading.description' | translate}}{{role.description}}
    -
    -
    - -

    {{'label.heading.permissions' | translate}}:  {{formatName(previousGrouping)}}

    - - - - - -
    - - - - -
    {{formatName(grouping)}}
    -
    - - - - - -
    -
    -
    - {{ 'label.button.cancel' | translate}} - +
    +
    +
    +
    + +
    + + +
    + + + + + + + + + +
    {{'label.heading.name' | translate}}{{role.name}}
    {{'label.heading.description' | translate}}{{role.description}}
    +
    +
    + +

    {{'label.heading.permissions' | translate}}:  {{formatName(previousGrouping)}} +

    + + + + + +
    + + + + +
    {{formatName(grouping)}}
    +
    + + + + + +
    +
    +
    +
    + {{ 'label.button.cancel' | translate}} + +
    \ No newline at end of file diff --git a/app/views/administration/viewuser.html b/app/views/administration/viewuser.html index b6cf5ccc..1779f872 100644 --- a/app/views/administration/viewuser.html +++ b/app/views/administration/viewuser.html @@ -1,10 +1,10 @@
    -
    - -
    +
    + +
    -
    +
    - {{'label.button.edit' | translate}} - - + {{'label.button.edit' + | translate}} + +
    -

    {{user.firstname}} {{user.lastname}}

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loginname' | translate}}:{{user.username}}
    {{'label.heading.firstname' | translate}}:{{user.firstname}}
    {{'label.heading.lastname' | translate}}:{{user.lastname}}
    {{'label.heading.email' | translate}}:{{user.email}}
    {{'label.heading.office' | translate}}:{{user.officeName}}
    {{'label.heading.roles' | translate}}: - - - - -
    - {{role.name}} -
    -
    -
    +

    {{user.firstname}} {{user.lastname}}

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loginname' | translate}}:{{user.username}}
    {{'label.heading.firstname' | translate}}:{{user.firstname}}
    {{'label.heading.lastname' | translate}}:{{user.lastname}}
    {{'label.heading.email' | translate}}:{{user.email}}
    {{'label.heading.office' | translate}}:{{user.officeName}}
    {{'label.heading.roles' | translate}}: + + + + +
    + {{role.name}} +
    +
    +
    \ No newline at end of file diff --git a/app/views/centers/addgroup.html b/app/views/centers/addgroup.html index 46cfa337..7a2c8e11 100644 --- a/app/views/centers/addgroup.html +++ b/app/views/centers/addgroup.html @@ -1,19 +1,24 @@ - +
    {{'label.heading.addgroup' | translate}}
    +
    - + +
    @@ -22,12 +27,14 @@
    +
    +
    @@ -37,13 +44,17 @@
    -
    - + +
    +
    @@ -51,12 +62,15 @@
    +
    - +
    +
    @@ -64,13 +78,16 @@
    +
    - -
    + +
    diff --git a/app/views/centers/centerattendance.html b/app/views/centers/centerattendance.html index 8ffb8e1c..64b4e5d0 100644 --- a/app/views/centers/centerattendance.html +++ b/app/views/centers/centerattendance.html @@ -3,14 +3,20 @@
    {{'label.heading.attendance' | translate}}
    - + +
    - Next Meeting on:{{meeting.nextTenRecurringDates[0] | DateFormat}} + Next Meeting on:{{meeting.nextTenRecurringDates[0] | + DateFormat}}
    - + + + @@ -22,7 +28,9 @@ @@ -31,7 +39,9 @@
     
     
    {{ 'label.heading.name' | translate }} {{ 'label.heading.attendance' | translate }}
    {{'label.button.cancel' | translate}} - +
    diff --git a/app/views/centers/centers.html b/app/views/centers/centers.html index 1abd30be..97ffd7b8 100644 --- a/app/views/centers/centers.html +++ b/app/views/centers/centers.html @@ -3,11 +3,13 @@
  • {{'label.anchor.centers' | translate}}
  • - + @@ -17,15 +19,20 @@ - + - +
    {{center.name}}{{center.status.value}}{{center.status.value}} + {{center.officeName}}
    \ No newline at end of file diff --git a/app/views/centers/closecenter.html b/app/views/centers/closecenter.html index ec142708..d60ffa8b 100644 --- a/app/views/centers/closecenter.html +++ b/app/views/centers/closecenter.html @@ -2,19 +2,27 @@

    {{ 'label.heading.confirm' | translate }}

    +
    - - + +
    - -

    +
    {{ 'label.button.cancel' | translate }} - +
    \ No newline at end of file diff --git a/app/views/centers/createcenter.html b/app/views/centers/createcenter.html index 4bf5d9df..5b18153d 100644 --- a/app/views/centers/createcenter.html +++ b/app/views/centers/createcenter.html @@ -4,35 +4,45 @@
  • {{'label.anchor.createcenter' | translate}}
  • -
    +
    {{'label.heading.createcenter' | translate}}
    - + +
    - +
    +
    -
    +
    -
    +
    @@ -40,22 +50,27 @@
    +
    - +
    +
    - -
    - -
    + + +
    + +
    {{'label.button.cancel' | translate}} diff --git a/app/views/centers/editcenter.html b/app/views/centers/editcenter.html index 941d6297..6e7aff0a 100644 --- a/app/views/centers/editcenter.html +++ b/app/views/centers/editcenter.html @@ -2,7 +2,8 @@ @@ -12,47 +13,63 @@
    {{'label.heading.editcenter' | translate}}
    - + +
    - +
    +
    - +
    +
    - +
    - + +
    - +
    {{'label.button.cancel' | translate}} - +
    - - + +

    {{'label.button.cancel' | translate}} - +

    diff --git a/app/views/centers/viewcenter.html b/app/views/centers/viewcenter.html index 7a65694e..235d38f5 100644 --- a/app/views/centers/viewcenter.html +++ b/app/views/centers/viewcenter.html @@ -19,7 +19,7 @@
  • | - {{ 'label.heading.office' | translate }} "{{center.officeName}}" + {{ 'label.heading.office' | translate }} "{{center.officeName}}"
  • @@ -29,9 +29,14 @@
    - + -
    +

    {{'label.heading.centerclosed' | translate}}

    @@ -88,17 +98,22 @@ {{ 'label.heading.activationdate' | translate }} - {{center.activationDate | DateFormat}}{{ 'label.notactivated' | translate }} + {{center.activationDate | DateFormat}}{{ 'label.notactivated' | translate }} + {{ 'label.heading.staff' | translate }} - {{center.staffName}}{{ 'label.unassigned' | translate }} + {{center.staffName}}{{ 'label.unassigned' | translate }} + {{ 'label.heading.nextmeetingon' | translate }} {{center.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}  - - {{ 'label.unassigned' | translate }} + + {{ 'label.unassigned' | translate }} @@ -150,6 +165,7 @@

    +
    @@ -159,20 +175,23 @@
    - - - - - - + + + + + + - - - - - - + + + + + +
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.balance' | translate }}{{ 'label.heading.status' | translate }}
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.balance' | translate }}{{ 'label.heading.status' | translate }}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} +
    @@ -181,8 +200,11 @@ @@ -196,20 +218,27 @@ {{group.name}} {{group.officeName}} - {{group.status.value}} + {{group.status.value}} +
    +
    - + +
    - +
    @@ -228,28 +257,35 @@ - + - {{'label.button.deleteall' | translate}} + {{'label.button.deleteall' | translate}} - {{'label.button.add' | translate}} + {{'label.button.add' | translate}}
    -
    + +
    - + - + - + - +
    {{column.columnName}}
    - {{row}} - {{row}} + {{row}} + {{row}} - {{row}} + {{row}}
    @@ -258,8 +294,8 @@
    {{value.value}}
    -
    - +
    +
    diff --git a/app/views/clients/addclientdocument.html b/app/views/clients/addclientdocument.html index efef6bf5..143d874f 100644 --- a/app/views/clients/addclientdocument.html +++ b/app/views/clients/addclientdocument.html @@ -1,39 +1,49 @@ - -
    - -
    - -
    - {{'label.heading.uploadclientdocument' | translate}} -
    - -
    - - -
    -
    + +
    + +
    + +
    + {{'label.heading.uploadclientdocument' | translate}} +
    + -
    - -
    - -
    -
    +
    + + +
    +
    -
    - -
    - -
    -
    +
    + -
    - - -
    -
    +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + + + +
    +
    \ No newline at end of file diff --git a/app/views/clients/addclientidentifier.html b/app/views/clients/addclientidentifier.html index b3ec4447..5b0d9644 100644 --- a/app/views/clients/addclientidentifier.html +++ b/app/views/clients/addclientidentifier.html @@ -1,42 +1,53 @@
    -
    - -
    -
    - -
    - {{'label.heading.addclientidentifier' | translate}} -
    - -
    - -
    -
    +
    + +
    + + +
    + {{'label.heading.addclientidentifier' | translate}} +
    + -
    - -
    - - -
    -
    +
    + +
    +
    -
    - -
    - -
    -
    +
    + -
    - - -
    -
    - +
    + + +
    +
    + +
    + + +
    + +
    +
    + +
    + + + + +
    + +
    \ No newline at end of file diff --git a/app/views/clients/addclientidentifierdocument.html b/app/views/clients/addclientidentifierdocument.html index 199379c9..fa0dc9da 100644 --- a/app/views/clients/addclientidentifierdocument.html +++ b/app/views/clients/addclientidentifierdocument.html @@ -1,38 +1,48 @@
    -
    - -
    -
    - -
    - {{'label.heading.uploadclientdocument' | translate}} -
    - -
    - - +
    + +
    + + +
    + {{'label.heading.uploadclientdocument' | translate}} +
    + + +
    + + - Required Field - + Required Field + -
    -
    +
    +
    -
    - -
    - -
    -
    +
    + -
    - - -
    -
    -
    +
    + +
    +
    + +
    + + + + +
    + +
    \ No newline at end of file diff --git a/app/views/clients/clientactions.html b/app/views/clients/clientactions.html index aeed909b..58fe03dc 100644 --- a/app/views/clients/clientactions.html +++ b/app/views/clients/clientactions.html @@ -1,51 +1,63 @@
    - - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    + + + +
    + -
    - -
    - +
    + +
    -
    +
    + -
    - -
    - +
    + +
    -
    +
    + -
    - - -
    - +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    +
    \ No newline at end of file diff --git a/app/views/clients/clients.html b/app/views/clients/clients.html index 8700a849..d2e47a7b 100644 --- a/app/views/clients/clients.html +++ b/app/views/clients/clients.html @@ -6,31 +6,39 @@
    - - + +
    - - - - - - - + + + + + + + - - - - - - - + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.clientno' | translate}}{{'label.heading.status' | translate}}{{'label.heading.office' | translate}}{{'label.heading.staff' | translate}}
    {{'label.heading.name' | translate}}{{'label.heading.clientno' | translate}}{{'label.heading.status' | translate}}{{'label.heading.office' | translate}}{{'label.heading.staff' | translate}}
    {{client.displayName}}{{client.accountNo}} {{client.status.value}}{{client.officeName}}{{client.staffName}}
    {{client.displayName}}{{client.accountNo}} {{client.status.value}} + {{client.officeName}}{{client.staffName}}
    \ No newline at end of file diff --git a/app/views/clients/clientscreenreport.html b/app/views/clients/clientscreenreport.html index 79a5eb3c..a5eef453 100644 --- a/app/views/clients/clientscreenreport.html +++ b/app/views/clients/clientscreenreport.html @@ -1,19 +1,21 @@ -
    - {{'label.heading.clientscreenreport' | translate}} -
    -
    - - - - -
    - {{templateData.name}} -
    -
    -
    - +
    + {{'label.heading.clientscreenreport' | translate}} +
    +
    + + + + +
    + {{templateData.name}} +
    +
    +
    + - + -
    +
    \ No newline at end of file diff --git a/app/views/clients/createclient.html b/app/views/clients/createclient.html index 73c71f05..2e5c2161 100644 --- a/app/views/clients/createclient.html +++ b/app/views/clients/createclient.html @@ -1,96 +1,122 @@ -
    - -
    - {{'label.heading.createclient' | translate}} -
    - -
    - -
    + + +
    + {{'label.heading.createclient' | translate}} +
    + + +
    +
    -
    - -
    - + -
    -
    - -
    - - -
    +
    +
    + + +
    + +
    -
    - -
    - -
    +
    +
    + + +
    +
    -
    - -
    - - -
    +
    +
    + + +
    + +
    -
    - -
    - +
    +
    + + +
    + {{'label.mustbenumeric' | translate}} -
    -
    -
    - -
    - -
    +
    +
    + -
    - -
    - -
    +
    +
    -
    -
    - -
    - -
    +
    + +
    + + +
    + +
    +
    +
    +
    + + +
    +
    -
    - -
    - -
    +
    +
    + + +
    +
    -
    - - -
    -
    - -
    - +
    +
    + + +
    + -
    -
    - - -
    -
    - +
    +
    + + + + +
    +
    + diff --git a/app/views/clients/editclient.html b/app/views/clients/editclient.html index 8d278269..48d4c90a 100644 --- a/app/views/clients/editclient.html +++ b/app/views/clients/editclient.html @@ -1,140 +1,168 @@ -
    -
    -
    + + + diff --git a/app/views/clients/transferclient.html b/app/views/clients/transferclient.html index 90c8f3cc..49b81de6 100644 --- a/app/views/clients/transferclient.html +++ b/app/views/clients/transferclient.html @@ -1,32 +1,37 @@
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - {{'label.button.cancel' | translate}} - -
    +
    + +
    + + +
    +
    +
    + -
    - +
    + +
    +
    +
    + + +
    + +
    +
    +
    + {{'label.button.cancel' | translate}} + +
    + + +
    \ No newline at end of file diff --git a/app/views/clients/viewclient.html b/app/views/clients/viewclient.html index a19b51a0..b7847433 100644 --- a/app/views/clients/viewclient.html +++ b/app/views/clients/viewclient.html @@ -1,504 +1,558 @@
    - +
    + + +
    +
    +
    - {{button.name | translate}} + {{button.name | translate}} - - + + - {{ 'label.button.more' | translate}} - + {{ 'label.button.more' | translate}} + -
    -
    -
    - - - -
    -
    -
    -

    {{'label.heading.clientclosed' | translate}}

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + +
    {{'label.input.firstname' | translate}}{{client.firstname}}
    {{'label.input.lastname' | translate}}{{client.lastname}}
    {{ 'label.heading.clientno' | translate }}{{client.accountNo}}
    {{ 'label.input.activationdate' | translate }}{{client.activationDate | DateFormat}}{{ 'label.notactivated' | translate }}
    {{ 'label.input.office' | translate }}{{client.officeName}}
    {{ 'label.input.staff' | translate }}{{client.staffName}}{{ 'label.unassigned' | translate }}
    {{ 'label.input.externalid' | translate }}{{client.externalId}}{{ 'label.notprovided' | translate }}
    {{ 'label.heading.memberof' | translate }} - {{ 'label.unassigned' | translate }} + + +
    + + + +
    +
    +
    +

    {{'label.heading.clientclosed' | translate}}

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - -
    {{'label.input.firstname' | translate}}{{client.firstname}}
    {{'label.input.lastname' | translate}}{{client.lastname}}
    {{ 'label.heading.clientno' | translate }}{{client.accountNo}}
    {{ 'label.input.activationdate' | translate }}{{client.activationDate | DateFormat}}{{ 'label.notactivated' | translate }}
    {{ 'label.input.office' | translate }}{{client.officeName}}
    {{ 'label.input.staff' | translate }}{{client.staffName}}{{ 'label.unassigned' | translate }} +
    {{ 'label.input.externalid' | translate }}{{client.externalId}}{{ 'label.notprovided' | translate }} +
    {{ 'label.heading.memberof' | translate }} + {{ 'label.unassigned' | translate }} - {{group.name}} {{ 'label.unassigned' | translate }}| + {{group.name}} {{ 'label.unassigned' | translate }}| -
    {{ 'label.input.mobilenumber' | translate }}{{client.mobileNo}}{{ 'label.notprovided' | translate }}
    {{ 'label.heading.closedate' | translate }}{{client.timeline.closedOnDate | DateFormat}}
    -
    +
    {{ 'label.input.mobilenumber' | translate }}{{client.mobileNo}}{{ 'label.notprovided' | translate }} +
    {{ 'label.heading.closedate' | translate }}{{client.timeline.closedOnDate | DateFormat}}
    +
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.performancehistory' | translate }}
    {{ 'label.heading.numofloancycle' | translate }}{{client.ClientSummary.loanCycle}}
    {{ 'label.lastloanamount' | translate }}{{client.ClientSummary.lastLoanAmount}}
    {{ 'label.numofactiveloans' | translate }}{{client.ClientSummary.activeLoans}}
    {{ 'label.totalsavings' | translate }}{{client.ClientSummary.totalSavings}}
    {{ 'label.numofactivesavings' | translate }}{{client.ClientSummary.activeSavings}}
    -
    -
    -
    -
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.performancehistory' | translate }}
    {{ 'label.heading.numofloancycle' | translate }}{{client.ClientSummary.loanCycle}}
    {{ 'label.lastloanamount' | translate }}{{client.ClientSummary.lastLoanAmount}}
    {{ 'label.numofactiveloans' | translate }}{{client.ClientSummary.activeLoans}}
    {{ 'label.totalsavings' | translate }}{{client.ClientSummary.totalSavings}}
    {{ 'label.numofactivesavings' | translate }}{{client.ClientSummary.activeSavings}}
    +
    +
    +
    +
    - - + + - - + + -
    -
    -
    +
    +
    +
    {{ 'label.heading.loanaccoverview' | translate }} -
    -
    - - - - - - - - - + + + +
    {{'label.heading.loanaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{'label.heading.status' | translate}}
    + +
    + + + + + + + + + - + - - - -
    {{'label.heading.loanaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{'label.heading.status' | translate}}
    - {{loanaccount.productName}} + {{loanaccount.productName}} - + - {{loanaccount.accountNo}} + {{loanaccount.accountNo}} - {{loanaccount.loanType.value}}  {{loanaccount.status.value}}
    - - - - - - - - - - - - - - - -
    {{'label.heading.loanaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{'label.heading.status' | translate}}{{'label.heading.closedate' | translate}}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}} -  {{loanaccount.status.value}} - - {{loanaccount.timeline.closedOnDate | DateFormat}} -
    - -
    -
    +
    {{loanaccount.loanType.value}}  {{loanaccount.status.value}} +
    + + + + + + + + + + + + + + + +
    {{'label.heading.loanaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{'label.heading.status' | translate}}{{'label.heading.closedate' | translate}}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}} +  {{loanaccount.status.value}} + + {{loanaccount.timeline.closedOnDate | DateFormat}} +
    +
    +
    +
    {{'label.heading.savingsaccoverview' | translate }} -
    -
    - - - - - - - - - - - - - -
    {{'label.heading.savingaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.balance' | translate}}{{'label.heading.status' | translate}}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}}  {{savingaccount.status.value}}
    - - - - - - - - - - - - - -
    {{'label.heading.savingaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.status' | translate}}{{'label.heading.closedate' | translate}}
    {{savingaccount.productName}}{{savingaccount.accountNo}} -   {{savingaccount.status.value}} - - {{savingaccount.timeline.closedOnDate | DateFormat}} -
    -
    -
    -
    - - - -
    - - - - - - - - - - - - - - - - + + +
    {{'label.heading.id' | translate}}{{'label.heading.description' | translate}}{{'label.heading.type' | translate}}{{'label.heading.identitydocuments' | translate}}{{'label.heading.actions' | translate}}
    {{document.documentKey}}{{document.description}}{{document.documentType.name}} +
    + + + + + + + + + + + + + +
    {{'label.heading.savingaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.balance' | translate}}{{'label.heading.status' | translate}}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}} +   {{savingaccount.status.value}} +
    + + + + + + + + + + + + + +
    {{'label.heading.savingaccount' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.status' | translate}}{{'label.heading.closedate' | translate}}
    {{savingaccount.productName}}{{savingaccount.accountNo}} +   {{savingaccount.status.value}} + + {{savingaccount.timeline.closedOnDate | DateFormat}} +
    + + + + + + +
    + + + + + + + + + + + + + + + + - + - - -
    {{'label.heading.id' | translate}}{{'label.heading.description' | translate}}{{'label.heading.type' | translate}}{{'label.heading.identitydocuments' | translate}}{{'label.heading.actions' | translate}}
    {{document.documentKey}}{{document.description}}{{document.documentType.name}} {{file.fileName}}   - + -   - +   + -
    -
    - -
    +
    + + +
    + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.filename' | translate}}{{'label.heading.actions' | translate}}
    {{clientdocument.name}}{{clientdocument.description}}{{clientdocument.fileName}} +   + +
    +
    + +
    +
    - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.filename' | translate}}{{'label.heading.actions' | translate}}
    {{clientdocument.name}}{{clientdocument.description}}{{clientdocument.fileName}} -   - -
    - - -
    - -
    -
    -
    - - - - - - - - - -
    {{column.columnName}}
    - - {{row}} - {{row}} - - {{row}} -
    - - - - - -
    {{value.key}}{{value.value}}
    -
    -
    -
    - -
    -
    -
    -
    - -
    - - - -
    -
    -
    -
    -
    -
    -
    -

    {{clientNote.note}}

    - {{clientNote.id}} - {{'label.createdby' | translate}} : {{clientNote.createdByUsername}} - {{'label.createdon' | translate}} : {{clientNote.createdOn | DateFormat}} -
    -
    -
    - -
    - - - +
    - -
    -
    +
    + + + + + + + + + +
    {{column.columnName}}
    + + {{row}} + {{row}} + + {{row}} +
    + + + + + +
    {{value.key}}{{value.value}}
    +
    +
    + + +
    + +
    +
    +
    + + +
    + + + +
    +
    +
    +
    +
    +
    +
    +

    {{clientNote.note}}

    + {{clientNote.id}} + {{'label.createdby' | translate}} : {{clientNote.createdByUsername}} + {{'label.createdon' | translate}} : {{clientNote.createdOn | DateFormat}} +
    +
    +
    + +
    + + + + + +
    +
    - Score comparison + Score comparison
    - Question + Question
    - +
    -
    +
    - -
    -
    + +
    +
    - inventure score + inventure score
    - Question + Question
    -

    Inventure score: {{inventureScore}}

    +

    Inventure score: {{inventureScore}}

    - +
    - - - - - - - - - -
    300-450
    bad
    451-550
    fair
    551-700
    good
    701-850
    excellent
    + + + + + + + + + +
    300-450
    bad
    451-550
    fair
    551-700
    good
    701-850
    excellent
    -
    +
    - -
    -
    + +
    +
    - inventure loan recommend + inventure loan recommend
    - Question + Question
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    loan typecreadit limit₹ (Rs)
    Agriculture{{inventureAgricultureLimit}}
    Fishermen{{inventureFishermenLimit}}
    Housing{{inventureHousingLimit}}
    Business{{inventureBusinessLimit}}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    loan typecreadit limit₹ + (Rs) +
    Agriculture{{inventureAgricultureLimit}}
    Fishermen{{inventureFishermenLimit}}
    Housing{{inventureHousingLimit}}
    Business{{inventureBusinessLimit}}
    -
    - - - -
    -
    + + + + +
    +
    diff --git a/app/views/collection/collectionsheet.html b/app/views/collection/collectionsheet.html index 20203661..6d6d33f9 100644 --- a/app/views/collection/collectionsheet.html +++ b/app/views/collection/collectionsheet.html @@ -1,178 +1,225 @@
    - -

    {{'label.norepaymentsanddisbursalareavailable' | translate}}

    -

    {{'label.savecollectionsheetsuccessfully' | translate}}

    -
    -
    -
    - -
    - - -
    -
    + +

    {{'label.norepaymentsanddisbursalareavailable' | + translate}}

    -
    - -
    - -
    -
    +

    {{'label.savecollectionsheetsuccessfully' | + translate}}

    +
    +
    +
    + -
    - -
    - -
    -
    - -
    - -
    +
    + + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + +
    -
    - -
    - -
    -
    +
    + -
    - -
    - -
    -
    +
    + +
    +
    -
    - -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.borrowername' | translate}}
    - {{'label.heading.groups/clients' | translate}} -
    - {{group.groupName}} -
    - - - - - -
    ({{client.clientId}}){{client.clientName}}
    -
    {{'label.input.grouptotal' | translate}}
    {{'label.input.total' | translate}}Total
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - + + + +
    {{'label.heading.duecollections' | translate}}
    {{loanproduct.name}}/{{'label.heading.charges' | translate}}{{'label.heading.attendance' | translate}}
      
    +
    + + +
    + +
    +
    + +
    + +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.borrowername' | translate}}
    + {{'label.heading.groups/clients' | translate}} +
    + {{group.groupName}} +
    + + + + + +
    ({{client.clientId}}){{client.clientName}}
    +
    + {{'label.input.grouptotal' | translate}} +
    + {{'label.input.total' | translate}}Total +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - -
    {{'label.heading.duecollections' | + translate}} +
    + {{loanproduct.name}}/{{'label.heading.charges' | translate}} + {{'label.heading.attendance' | translate}}
      
    - + - + - - -
    - - - + + +
    + + + -
    +
    - + -
    -
    -
    -
    -
    -
    -
    -

    {{'label.heading.totalduecollections' | translate}}

    -
    - {{loanDueTotalCollection.amount}}   - {{loanDueTotalCollection.currencySymbol}} -
    -
    -
    -
    - - -
    -
    - +
    +
    +
    +
    +
    +
    +
    +

    {{'label.heading.totalduecollections' | translate}}

    +
    + +
    + {{loanDueTotalCollection.amount}}   + {{loanDueTotalCollection.currencySymbol}} +
    +
    +
    +
    + + +
    +
    +
    \ No newline at end of file diff --git a/app/views/collection/productivecollectionsheet.html b/app/views/collection/productivecollectionsheet.html index 7a245ff0..aa3e1f06 100644 --- a/app/views/collection/productivecollectionsheet.html +++ b/app/views/collection/productivecollectionsheet.html @@ -1,72 +1,88 @@
    -
    -
    - +
    +
    +
    -
    -
    - {{'label.heading.branch' | translate}} :{{officeName}} - {{'label.input.meetingdate' | translate}} :{{meetingDate}} -
    - - - - - - - - - - - - - - - - - - + + + +
    {{loanproduct.name}}/{{'label.heading.charges' | translate}}{{'label.heading.attendance' | translate}}
    - {{group.groupName}} -   
    ({{client.clientId}}){{client.clientName}} +
    +
    + {{'label.heading.branch' | translate}} :{{officeName}} + {{'label.input.meetingdate' | translate}} :{{meetingDate}} +
    + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - -
    + {{loanproduct.name}}/{{'label.heading.charges' | translate}} + {{'label.heading.attendance' | translate}}
    + {{group.groupName}} +   
    ({{client.clientId}}){{client.clientName}} - + - + - - -
    {{'label.input.grouptotal' | translate}} + + +
    {{'label.input.grouptotal' | + translate}} + - - + + -
    -
    - - -
    -
    - +
    +
    + + +
    +
    +
    diff --git a/app/views/expertsearch.html b/app/views/expertsearch.html index b2e06c7e..c40626b2 100644 --- a/app/views/expertsearch.html +++ b/app/views/expertsearch.html @@ -2,7 +2,7 @@
    - +
    - - - -
    @@ -27,8 +35,9 @@
    - +

    {{'label.nodata' | translate}}

    +
    -
    - -

    {{'label.nodata' | translate}}

    + +

    {{'label.nodata' | + translate}}

    +
    -
    diff --git a/app/views/footer.html b/app/views/footer.html index 984ffc11..e33b5cb5 100644 --- a/app/views/footer.html +++ b/app/views/footer.html @@ -1 +1 @@ - + diff --git a/app/views/groups/addmember.html b/app/views/groups/addmember.html index 3b880d74..a86a722f 100644 --- a/app/views/groups/addmember.html +++ b/app/views/groups/addmember.html @@ -1,31 +1,41 @@ -
    +
    {{'label.heading.addmember' | translate}}
    +
    - + +
    - +
    +
    - + +
    @@ -33,14 +43,16 @@
    +
    +
    - + {{'label.mustbenumeric' | translate}} @@ -48,14 +60,17 @@
    -
    - -
    - -
    -
    +
    + + +
    + +
    +
    +
    @@ -63,8 +78,10 @@
    +
    - +
    diff --git a/app/views/groups/addrole.html b/app/views/groups/addrole.html index 17d6304b..9a265437 100644 --- a/app/views/groups/addrole.html +++ b/app/views/groups/addrole.html @@ -2,19 +2,25 @@

    {{ 'label.heading.addrole' | translate }}

    +
    -
    - +

    +
    {{ 'label.button.cancel' | translate }} - +

    diff --git a/app/views/groups/assignstaff.html b/app/views/groups/assignstaff.html index fd1933d4..f330b619 100644 --- a/app/views/groups/assignstaff.html +++ b/app/views/groups/assignstaff.html @@ -6,15 +6,19 @@ - -

    +
    +
    {{'label.button.cancel' | translate}} - +
    diff --git a/app/views/groups/attachmeeting.html b/app/views/groups/attachmeeting.html index 4c906973..8d072f1a 100644 --- a/app/views/groups/attachmeeting.html +++ b/app/views/groups/attachmeeting.html @@ -1,13 +1,15 @@
    @@ -15,10 +17,12 @@ @@ -28,41 +32,49 @@
    - + - + - +
    - + + + {{periodValue}} +
    - - + + - - {{periodValue}} -
    - + -
    - {{repeatsOnOption.name}}
    -
    + + + {{repeatsOnOption.name}}
    +
    + {{'label.button.cancel' + | translate}} + {{'label.button.cancel' + | translate}} + +
    \ No newline at end of file diff --git a/app/views/groups/closegroup.html b/app/views/groups/closegroup.html index 54480bdd..1d096969 100644 --- a/app/views/groups/closegroup.html +++ b/app/views/groups/closegroup.html @@ -2,19 +2,27 @@

    {{ 'label.heading.confirm' | translate }}

    +
    - - + +
    - -

    +
    {{ 'label.button.cancel' | translate }} - +

    diff --git a/app/views/groups/creategroup.html b/app/views/groups/creategroup.html index b8fab335..6025ccb5 100644 --- a/app/views/groups/creategroup.html +++ b/app/views/groups/creategroup.html @@ -1,18 +1,24 @@ -
    +
    {{'label.heading.creategroup' | translate}}
    +
    -
    - + +
    @@ -20,31 +26,41 @@
    +
    -
    +
    -
    - + +
    +
    @@ -52,6 +68,7 @@
    +
    @@ -59,23 +76,28 @@
    +
    - +
    +
    - - + +
    - -
    - -
    + + +
    + +
    {{'label.button.cancel' | translate}} diff --git a/app/views/groups/editgroup.html b/app/views/groups/editgroup.html index f07c50f6..af1ef624 100644 --- a/app/views/groups/editgroup.html +++ b/app/views/groups/editgroup.html @@ -1,37 +1,47 @@
    - +
    {{'label.heading.editgroup' | translate}}
    - + +
    - +
    +
    -
    +
    - +
    +
    - +
    -
    +
    {{'label.button.cancel' | translate}} @@ -42,12 +52,16 @@
    - - + +

    {{'label.button.cancel' | translate}} - +

    diff --git a/app/views/groups/editmeeting.html b/app/views/groups/editmeeting.html index 9678c91b..4ed233a3 100644 --- a/app/views/groups/editmeeting.html +++ b/app/views/groups/editmeeting.html @@ -1,13 +1,15 @@
    @@ -15,10 +17,12 @@ @@ -34,33 +38,42 @@
    - + - +
    - + + + {{periodValue}} +
    - - + + - - {{periodValue}} -
    - + -
    - {{repeatsOnOption.name}}
    -
    + + + {{repeatsOnOption.name}}
    +
    + {{'label.button.cancel' + | translate}} + {{'label.button.cancel' + | translate}} + +
    \ No newline at end of file diff --git a/app/views/groups/groupattendance.html b/app/views/groups/groupattendance.html index d4d05a2d..6de73ff1 100644 --- a/app/views/groups/groupattendance.html +++ b/app/views/groups/groupattendance.html @@ -4,14 +4,20 @@
    {{'label.heading.attendance' | translate}}
    - + +
    - {{'label.nextmettingon' | translate}}:{{meeting.nextTenRecurringDates[0] | DateFormat}} + {{'label.nextmettingon' | + translate}}:{{meeting.nextTenRecurringDates[0] | DateFormat}}
    - + + + @@ -22,7 +28,9 @@ @@ -31,7 +39,9 @@
     
     
    {{ 'label.heading.name' | translate }} {{ 'label.heading.attendance' | translate }}{{client.displayName}}*
    -
    {{'label.button.cancel' | translate}} - +
    diff --git a/app/views/groups/groups.html b/app/views/groups/groups.html index a5b353d0..f1cbe11d 100644 --- a/app/views/groups/groups.html +++ b/app/views/groups/groups.html @@ -3,11 +3,13 @@
  • {{'label.anchor.groups' | translate}}
  • - + @@ -17,15 +19,19 @@ - + - +
    {{group.name}} {{group.status.value}} {{group.status.value}} + {{group.officeName}}
    \ No newline at end of file diff --git a/app/views/groups/membermanage.html b/app/views/groups/membermanage.html index ccb4952d..d620f8ed 100644 --- a/app/views/groups/membermanage.html +++ b/app/views/groups/membermanage.html @@ -4,16 +4,22 @@

    {{ 'label.heading.associatemembers' | translate }}

    +

    +
    {{ 'label.button.cancel' | translate }} - +

    @@ -21,16 +27,22 @@

    {{ 'label.heading.disassociatemembers' | translate }}

    +

    +
    - {{ 'label.button.cancel' | translate }} - + {{ 'label.button.cancel' | translate + }} +

    diff --git a/app/views/groups/transferclients.html b/app/views/groups/transferclients.html index 34c04833..df7a426c 100644 --- a/app/views/groups/transferclients.html +++ b/app/views/groups/transferclients.html @@ -1,8 +1,9 @@
    - +

    {{ 'label.heading.transferclientsbetweengroups' | translate }}

    +
    - - @@ -52,11 +57,12 @@

    +
    {{ 'label.button.cancel' | translate }}

    -
    +
    \ No newline at end of file diff --git a/app/views/groups/viewgroup.html b/app/views/groups/viewgroup.html index 16684db4..50574efa 100644 --- a/app/views/groups/viewgroup.html +++ b/app/views/groups/viewgroup.html @@ -1,43 +1,49 @@
    -
    - -
    -
    - - -
    -
    -
    - {{ 'label.button.activate' | translate }} - {{ 'label.button.edit' | translate }} - {{ 'label.button.groupsavingapplication' | translate }} - {{ 'label.button.grouploanapplication' | translate }} - {{ 'label.button.jlgloanapplication' | translate }} +
    + +
    +
    + + +
    + -
    - - -
    -
    -
    -

    {{'label.heading.groupclosed' | translate}}

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{group.name}}
    {{ 'label.heading.activationdate' | translate }}{{group.activationDate | DateFormat}}{{ 'label.notactivated' | translate }}
    {{ 'label.heading.staff' | translate }}{{group.staffName}}{{ 'label.unassigned' | translate }}
    {{ 'label.input.externalid' | translate }}{{group.externalId}}{{ 'label.notprovided' | translate }}
    {{ 'label.heading.nextmeetingon' | translate }}{{group.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}  - - {{ 'label.unassigned' | translate }} -
    {{ 'label.heading.meetingfrequency' | translate }}{{group.collectionMeetingCalendar.humanReadable}}
    {{ 'label.heading.center' | translate }}{{group.centerName}}
    {{ 'label.heading.closedate' | translate }}{{group.timeline.closedOnDate | DateFormat}}
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.summary' | translate }}
    {{ 'label.numofactiveclient' | translate }}{{summary.activeClients}}
    {{ 'label.numofactivegrouploans' | translate }}{{summary.activeGroupLoans}}
    {{ 'label.numofactiveclientloans' | translate }}{{summary.activeGroupLoans}}
    {{ 'label.numofactivegroupborrowers' | translate }}{{summary.activeGroupBorrowers}}
    {{ 'label.numofactiveclientborrowers' | translate }}{{summary.activeClientBorrowers}}
    {{ 'label.numofactiveoverduegrouploans' | translate }}{{summary.overdueGroupLoans}}
    {{ 'label.numofactiveoverdueclientloans' | translate }}{{summary.overdueClientLoans}}
    -
    +
    +
    +
    + + +
    +
    +
    +

    {{'label.heading.groupclosed' | translate}}

    -
    -
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{group.name}}
    {{ 'label.heading.activationdate' | translate }}{{group.activationDate | DateFormat}}{{ 'label.notactivated' | translate }}
    {{ 'label.heading.staff' | translate }}{{group.staffName}}{{ 'label.unassigned' | translate }} +
    {{ 'label.input.externalid' | translate }}{{group.externalId}}{{ 'label.notprovided' | translate }} +
    {{ 'label.heading.nextmeetingon' | translate }}{{group.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}  + + {{ 'label.unassigned' | translate }} +
    {{ 'label.heading.meetingfrequency' | translate }}{{group.collectionMeetingCalendar.humanReadable}}
    {{ 'label.heading.center' | translate }}{{group.centerName}} +
    {{ 'label.heading.closedate' | translate }}{{group.timeline.closedOnDate | DateFormat}}
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.summary' | translate }}
    {{ 'label.numofactiveclient' | translate }}{{summary.activeClients}}
    {{ 'label.numofactivegrouploans' | translate }}{{summary.activeGroupLoans}}
    {{ 'label.numofactiveclientloans' | translate }}{{summary.activeGroupLoans}}
    {{ 'label.numofactivegroupborrowers' | translate }}{{summary.activeGroupBorrowers}}
    {{ 'label.numofactiveclientborrowers' | translate }}{{summary.activeClientBorrowers}}
    {{ 'label.numofactiveoverduegrouploans' | translate }}{{summary.overdueGroupLoans}}
    {{ 'label.numofactiveoverdueclientloans' | translate }}{{summary.overdueClientLoans}}
    +
    +
    +
    +
    - - + + - - + + -
    -
    -
    +
    +
    +
    {{ 'label.heading.loanaccoverview' | translate }} -
    -
    - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.products' | translate }}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{ 'label.heading.status' | translate }}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}}{{loanaccount.status.value}}
    - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.products' | translate }}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{ 'label.heading.status' | translate }}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}}{{loanaccount.status.value}}
    -
    -
    -
    +
    +
    + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.products' | translate }}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{ 'label.heading.status' | translate }}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}}{{loanaccount.status.value}} +
    + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.products' | translate }}{{'label.heading.accnum' | translate}}{{'label.heading.type' | translate}}{{ 'label.heading.status' | translate }}
    {{loanaccount.productName}}{{loanaccount.accountNo}}{{loanaccount.loanType.value}}{{loanaccount.status.value}} +
    +
    +
    +
    {{'label.heading.savingsaccoverview' | translate }} -
    -
    - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.balance' | translate }}{{ 'label.heading.status' | translate }}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}}
    - - - - - - - - - - - - - - - -
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.status' | translate }}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.status.value}}
    -
    -
    -
    - - - - - - - - - - - - - - - - -
    {{'label.heading.accnum' | translate}}{{'label.heading.name' | translate}}{{ 'label.heading.status' | translate }}
    {{member.accountNo}}{{member.displayName}} {{member.status.value}}
    -
    -
    -
    -
    -
    - -
    - - - -
    -
    -
    -
    -
    -
    -
    -

    {{groupNote.note}}

    - {{groupNote.id}} - {{'label.createdby' | translate}} : {{groupNote.createdByUsername}} - {{'label.createdon' | translate}} : {{groupNote.createdOn | DateFormat}} -
    -
    -
    - -
    - - - +
    - - - - - - + + + + + + - - - - - - + + + + + +
    {{ 'label.heading.role' | translate }}{{ 'label.heading.name' | translate }}{{ 'label.heading.clientid' | translate }}
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.balance' | translate }}{{ 'label.heading.status' | translate }}
    {{grouprole.role.name}}{{grouprole.clientName}}{{grouprole.clientId}}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.accountBalance}} + {{savingaccount.status.value}} +
    -
    - -
    - {{'label.button.deleteall' | translate}} - - {{'label.button.add' | translate}} -
    -
    - - - - - - - - - -
    {{column.columnName}}
    - - {{row}} - {{row}} - - {{row}} -
    - - - - - -
    {{value.key}}{{value.value}}
    + + + + + + + + + + + + + + + +
    {{ 'label.heading.products' | translate }}{{ 'label.heading.accnum' | translate }}{{ 'label.heading.status' | translate }}
    {{savingaccount.productName}}{{savingaccount.accountNo}}{{savingaccount.status.value}} +
    +
    +
    +
    + + + + + + + + + + + + + + + + +
    {{'label.heading.accnum' | translate}}{{'label.heading.name' | translate}}{{ 'label.heading.status' | translate }}
    {{member.accountNo}}{{member.displayName}}{{member.status.value}} +
    +
    + +
    + +
    +
    +
    + + +
    + + +
    - - -
    +
    + +
    +
    +
    +

    {{groupNote.note}}

    + {{groupNote.id}} + {{'label.createdby' | translate}} : {{groupNote.createdByUsername}} + {{'label.createdon' | translate}} : {{groupNote.createdOn | DateFormat}} +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.role' | translate }}{{ 'label.heading.name' | translate }}{{ 'label.heading.clientid' | translate }}
    {{grouprole.role.name}}{{grouprole.clientName}}{{grouprole.clientId}} + +
    +
    + +
    + {{'label.button.deleteall' + | translate}} + + {{'label.button.add' | + translate}} +
    +
    + + + + + + + + + +
    {{column.columnName}}
    + + {{row}} + {{row}} + + {{row}} +
    + + + + + +
    {{value.key}}{{value.value}}
    +
    +
    +
    +
    +
    diff --git a/app/views/header.html b/app/views/header.html index 1a0c8184..5837e151 100644 --- a/app/views/header.html +++ b/app/views/header.html @@ -1,17 +1,18 @@ mifosX
    diff --git a/app/views/help.html b/app/views/help.html index 3895471b..3cccf680 100644 --- a/app/views/help.html +++ b/app/views/help.html @@ -6,7 +6,9 @@
    -

    +
    +
    +
    {{'label.heading.keyboarshortcuts' | translate}}
    diff --git a/app/views/home.html b/app/views/home.html index 501b5539..00db8873 100644 --- a/app/views/home.html +++ b/app/views/home.html @@ -1,8 +1,8 @@
    -
    -
    -
    -
    -

    {{'label.youneedtologintoaccessthisarea' | translate}}

    -
    +
    +
    +
    +
    +

    {{'label.youneedtologintoaccessthisarea' | translate}}

    +
    diff --git a/app/views/loans/addloancharge.html b/app/views/loans/addloancharge.html index 609ed9a1..c97cae51 100644 --- a/app/views/loans/addloancharge.html +++ b/app/views/loans/addloancharge.html @@ -1,58 +1,75 @@ -
    -
    - -
    -
    - -
    - {{ 'label.heading.addloancharge' | translate }} +
    +
    + +
    + + +
    + {{ 'label.heading.addloancharge' | translate }} -
    - -
    - -
    -
    -
    -
    - -
    - - +
    + + +
    + +
    +
    +
    +
    + + +
    + + {{ 'label.requiredfield' | translate }} -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - - -
    - +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    + + +
    +
    \ No newline at end of file diff --git a/app/views/loans/addloancollateral.html b/app/views/loans/addloancollateral.html index bb7b49d8..2d277549 100644 --- a/app/views/loans/addloancollateral.html +++ b/app/views/loans/addloancollateral.html @@ -1,38 +1,47 @@ -
    -
    - -
    -
    - -
    - {{ 'label.heading.addloancollateral' | translate }} +
    +
    + +
    + + +
    + {{ 'label.heading.addloancollateral' | translate }} -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    +
    + -
    - +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    \ No newline at end of file diff --git a/app/views/loans/addloandocument.html b/app/views/loans/addloandocument.html index bbb7b698..74218a75 100644 --- a/app/views/loans/addloandocument.html +++ b/app/views/loans/addloandocument.html @@ -1,41 +1,51 @@
    -
    - -
    - -
    -
    - {{'label.heading.uploaddocument' | translate}} +
    + +
    + + +
    + {{'label.heading.uploaddocument' | translate}} -
    - -
    - +
    + + +
    + -
    -
    +
    +
    -
    - -
    - -
    -
    +
    + -
    - -
    - -
    -
    +
    + +
    +
    -
    - - -
    -
    - +
    + + +
    + +
    +
    + +
    + + + + +
    +
    +
    \ No newline at end of file diff --git a/app/views/loans/assignloanofficer.html b/app/views/loans/assignloanofficer.html index 987db027..97285aae 100644 --- a/app/views/loans/assignloanofficer.html +++ b/app/views/loans/assignloanofficer.html @@ -1,30 +1,42 @@ -
    -
    - -
    -
    - -
    - {{ 'label.heading.assignloanofficer' | translate }} +
    +
    + +
    + + +
    + {{ 'label.heading.assignloanofficer' | translate }}
    - -
    - -
    -
    -
    - -
    - -
    -
    + + +
    + +
    +
    +
    + + +
    + +
    +
    - - -
    + + +
    - +
    \ No newline at end of file diff --git a/app/views/loans/editguarantor.html b/app/views/loans/editguarantor.html index d97d0798..8e06ae32 100644 --- a/app/views/loans/editguarantor.html +++ b/app/views/loans/editguarantor.html @@ -1,24 +1,32 @@ -
    +
    {{'label.heading.guarantor' | translate}}
    +
    -
    - + +
    - +
    +
    @@ -26,12 +34,15 @@
    +
    - +
    +

    @@ -39,30 +50,35 @@
    +
    +
    +
    +
    diff --git a/app/views/loans/editloanaccount.html b/app/views/loans/editloanaccount.html index ad6844ca..8512aaf5 100644 --- a/app/views/loans/editloanaccount.html +++ b/app/views/loans/editloanaccount.html @@ -1,307 +1,384 @@
    -
    - -
    - - +
    + +
    + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + +
    + + + + + +
    + + + + + + + +
    +
    +
    +
    + + + + + + + + + + + + + + +
    {{calendar.startDate | DateFormat}}{{calendar.humanReadable}}
    +
    + - + + - - - - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
    - + +  {{loanaccountinfo.currency.displaySymbol}} + + - - - - - + +
    - +
    - +   + - + +
    - + + + +
    +   {{loanaccountinfo.interestRateFrequencyType.value}} + +
    - + +
    +  {{loanaccountinfo.currency.displaySymbol}} + + +
    + + +
    + - - - +
    -
    -
    -
    - - - - - - - - - - - - - - -
    {{calendar.startDate | DateFormat}}{{calendar.humanReadable}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -  {{loanaccountinfo.currency.displaySymbol}} - - -
    -   - - -
    - - - -
    -   {{loanaccountinfo.interestRateFrequencyType.value}} - -
    - -
    -  {{loanaccountinfo.currency.displaySymbol}} - - -
    - - -
    - - - -
    -
    -
    - - - - - - - - -
    -   - -   - -
    - - - - - - - - - - - - - - - -
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}} 
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} - -
    - -    -    - -   - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.value' | translate}}{{'label.heading.description' | translate}}{{'label.heading.actions' | translate}}
    -
    -
    -
    - -
    - +
    +
    + +
    + + + + + + +
    +   + +   + +
    + - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - -
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}} 
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}}
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    + + + +
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    -
    - - -
    - +
    + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} + +
    + +    +    + +   + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.value' | translate}}{{'label.heading.description' | translate}}{{'label.heading.actions' | translate}}
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}}
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    +
    +
    + + +
    +
    diff --git a/app/views/loans/editloancharge.html b/app/views/loans/editloancharge.html index 01efe0ec..c474eb70 100644 --- a/app/views/loans/editloancharge.html +++ b/app/views/loans/editloancharge.html @@ -1,26 +1,34 @@
    -
    - -
    -
    - -
    - {{ 'label.heading.editloancharge' | translate }} -
    - -
    - - -
    -
    +
    + +
    + + +
    + {{ 'label.heading.editloancharge' | translate }} +
    + -
    - - -
    -
    - +
    + + +
    +
    + +
    + + +
    + +
    \ No newline at end of file diff --git a/app/views/loans/editloancollateral.html b/app/views/loans/editloancollateral.html index 4d40b218..d170b163 100644 --- a/app/views/loans/editloancollateral.html +++ b/app/views/loans/editloancollateral.html @@ -1,39 +1,49 @@
    -
    - -
    -
    - -
    - {{ 'label.anchor.editloancollateral' | translate }} +
    + +
    + + +
    + {{ 'label.anchor.editloancollateral' | translate }} -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    +
    + -
    - +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + + +
    \ No newline at end of file diff --git a/app/views/loans/guarantor.html b/app/views/loans/guarantor.html index fe89c62e..81ef67a5 100644 --- a/app/views/loans/guarantor.html +++ b/app/views/loans/guarantor.html @@ -1,9 +1,11 @@ -
    +
    {{'label.heading.guarantor' | translate}}
    +
    @@ -11,16 +13,24 @@
    - + +
    - +
    +
    -
    @@ -29,34 +39,45 @@
    +
    -
    - + +
    - +
    +
    - +
    +
    - +
    +

    @@ -64,24 +85,28 @@
    +
    +
    +
    +
    @@ -90,7 +115,7 @@

    {{'label.heading.clientdetails' | translate}}

    - +
    diff --git a/app/views/loans/loanaccountactions.html b/app/views/loans/loanaccountactions.html index d380d122..301bb694 100644 --- a/app/views/loans/loanaccountactions.html +++ b/app/views/loans/loanaccountactions.html @@ -1,135 +1,175 @@
    -
    - -
    - - -
    - {{ title | translate}} +
    + +
    + + +
    + {{ title | translate}} -
    - -
    - -
    -
    +
    + -
    - -
    - - -
    -
    - -
    - -
    - -
    -
    - -
    -
    - -
    - -
    -
    -
    - - -
    -
    -
    - -
    - +
    + +
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    - - -
    +
    + -
    - +
    + + +
    +
    + +
    + + +
    + +
    +
    + +
    +
    + + +
    + +
    +
    +
    + + + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    +
    + +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + + +
    + +
    +
    +
    + +
    +
    + + +
    +
    + + +
    + + + diff --git a/app/views/loans/loanscreenreport.html b/app/views/loans/loanscreenreport.html index 9f3f1fad..8065e99c 100644 --- a/app/views/loans/loanscreenreport.html +++ b/app/views/loans/loanscreenreport.html @@ -1,19 +1,21 @@ -
    - {{'label.heading.loanscreenreport' | translate}} -
    -
    -
    {{'label.heading.name' | translate}} {{client.displayName}}
    - - - -
    - {{templateData.name}} -
    -
    -
    - +
    + {{'label.heading.loanscreenreport' | translate}} +
    +
    + + + + +
    + {{templateData.name}} +
    +
    +
    + - + -
    +
    \ No newline at end of file diff --git a/app/views/loans/newjlgloanaccount.html b/app/views/loans/newjlgloanaccount.html index 07027c51..42a06626 100644 --- a/app/views/loans/newjlgloanaccount.html +++ b/app/views/loans/newjlgloanaccount.html @@ -1,400 +1,471 @@ -
    - -
    - {{ 'label.heading.newjlgloanapplication' | translate }} -
    - - + + +
    +{{ 'label.heading.newjlgloanapplication' | translate }} +
    +
    + - - -
    - - + + - - -
    -
    - -
    -
    -
    - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #{{ 'label.input.name' | translate }}{{ 'label.input.amount' | translate }}{{ 'label.input.interestrate' | translate }}{{ 'label.input.repayments' | translate }}{{ 'label.input.loanterm' | translate }}{{ 'label.input.actions' | translate }}{{ 'label.heading.status' | translate }}
    - - {{ 'label.anchor.viewschedule' | translate }}{{client.status}}
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - + + + +
    - - + - - - -
    - - - - -
    +
    + +
    +
    +
    + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #{{ 'label.input.name' | translate }}{{ 'label.input.amount' | translate }}{{ 'label.input.interestrate' | translate }}{{ 'label.input.repayments' | translate }}{{ 'label.input.loanterm' | translate }}{{ 'label.input.actions' | translate }}{{ 'label.heading.status' | translate }}
    + + {{ 'label.anchor.viewschedule' | translate }}{{client.status}}
    +
    +
    -
    +
    +
    +
    -
    -
    -
    - - - - - -
    -
    - - - - - -
    -
    -
    -
    -
    - -
    - - -
    - +
    + + + + - - - - + + + - + + + + + + + + + + + + + + + + +
    + + - - - - - - - - - - - -
    - - - - -
    - - - - -
    +
    + +
    - + + - - - - - - - - + +
    - - - -
    - - + + + +
    + + +
    +
    +
    + + + + + +
    +
    + + + + + +
    +
    +
    +
    +
    + +
    + + + + + + + + + - - - - - - - - - - - - - - - - -
    + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    +
    + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - -
    + + + +
    + + {{formData.displaySymbol}} {{loanaccountinfo.currency.displaySymbol}} -
    - - +
    + + -
    - - - - - -
    - - -
    - -
    - -   -
    - -   -
    -
    - - - - - - -
    - -   -
    - - - - -
    - -   -
    - - - - - -
    - {{ 'label.button.addtranch' | - translate }} -
    - - - - - - - - - - - -
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}}
    - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} - -
    -
    - - -
    -    -    - -   -
    - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.value' | translate}}{{'label.heading.description' | translate}}{{'label.heading.actions' | translate}}
    -
    -
    - -
    - - -
    - - - - - - - - + + - - - - - - - - - + + - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - -
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}} + + + + + +
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    + + +
    + +
    + +   +
    + +   +
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    -
    +
    + + + + + + +
    + +   +
    + + + + +
    + +   +
    + + + -
    - - -
    - + +
    + {{ 'label.button.addtranch' | + translate }} +
    + + + + + + + + + + + +
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}}
    + +
    +
    + + +
    + + +
    + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} + +
    +
    + + +
    +    +    + +   +
    + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.value' | translate}}{{'label.heading.description' | translate}}{{'label.heading.actions' | translate}}
    +
    +
    + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}}
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    +
    + +
    + + +
    + \ No newline at end of file diff --git a/app/views/loans/newloanaccount.html b/app/views/loans/newloanaccount.html index 4d7e1406..c5683598 100644 --- a/app/views/loans/newloanaccount.html +++ b/app/views/loans/newloanaccount.html @@ -1,311 +1,384 @@
    -
    +
    -
    - -
    - - + + + +
    + - - + + - - + + - -
    - + - + - + - +
    - + - +
    - + - + - +
    -
    -
    -
    - - - - - - - - - - - - - - -
    {{calendar.startDate | DateFormat}}{{calendar.humanReadable}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -  {{loanaccountinfo.currency.displaySymbol}} - - -
    -   - - -
    - - - - - -
    -   {{loanaccountinfo.interestRateFrequencyType.value}} - -
    - -
    -  {{loanaccountinfo.currency.displaySymbol}} - - -
    - - -
    - - - -
    - -
    -
    -
    - - - - - - - + +
    -   - -   - -
    +
    +
    +
    + + + + + + + + + + + + + -
    {{calendar.startDate | DateFormat}}{{calendar.humanReadable}}
    - - - - - - - - - - - - - - - -
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}} 
    - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} - -
    - -    -    - -   - +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +  {{loanaccountinfo.currency.displaySymbol}} + + + + +
    + +   + + + +
    + + + + + +
    +   {{loanaccountinfo.interestRateFrequencyType.value}} + +
    + + +
    +  {{loanaccountinfo.currency.displaySymbol}} + + +
    + + +
    + + + +
    + +
    +
    +
    + + + + + + + + +
    +   + +   + +
    + + + + + + + + + + + + + + + +
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.principal' | translate}} 
    + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.date' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.chargeTimeType.value}} + +
    + +    +    + +   + - - - - - + + + + + -
    {{'label.heading.name' | translate}} {{'label.heading.value' | translate}} {{'label.heading.description' | translate}} {{'label.heading.actions' | translate}}
    -
    -
    +
    +
    -
    - +
    +
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}}
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    -
    + -
    - - -
    - +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}
    #{{'label.heading.date' | translate}}{{'label.heading.days' | translate}}{{'label.heading.disbursement' | translate}}{{'label.heading.principaldue' | translate}}{{'label.heading.principalbalance' | translate}}{{'label.heading.interestdue' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.due' | translate}}
    {{period.period}}{{period.dueDate | DateFormat}}{{period.daysInPeriod}}{{period.principalDisbursed}}{{period.principalDue}}{{period.principalLoanBalanceOutstanding}}{{period.interestDue}}{{period.feeChargesDue}}{{period.totalDueForPeriod}}
    {{'label.heading.total' | translate}}{{repaymentscheduleinfo.loanTermInDays}}{{repaymentscheduleinfo.totalPrincipalDisbursed}}{{repaymentscheduleinfo.totalPrincipalExpected}}{{repaymentscheduleinfo.totalInterestCharged}}{{repaymentscheduleinfo.totalFeeChargesCharged}}{{repaymentscheduleinfo.totalRepaymentExpected}}
    +
    + +
    + + +
    +
    \ No newline at end of file diff --git a/app/views/loans/view_loan_transaction.html b/app/views/loans/view_loan_transaction.html index b79c1ae9..b8d02f91 100644 --- a/app/views/loans/view_loan_transaction.html +++ b/app/views/loans/view_loan_transaction.html @@ -1,73 +1,76 @@
    -
    - -
    -

    {{ 'label.heading.details' | translate}}

    - +
    + +
    +

    {{ 'label.heading.details' | translate}}

    -
    - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.id' | translate}}{{transaction.id}}
    {{ 'label.heading.type' | translate}}{{transaction.type.value}}
    {{ 'label.heading.date' | translate}}{{transaction.date | DateFormat}}
    {{ 'label.heading.currency' | translate}}{{transaction.currency.name}}
    {{ 'label.heading.amount' | translate}}{{transaction.amount}}
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.paymentdetails' | translate}}
    {{ 'label.heading.paymenttype' | translate}}{{transaction.paymentDetailData.paymentType.name}}
    {{ 'label.heading.accnum' | translate}}{{transaction.paymentDetailData.accountNumber}}
    {{ 'label.heading.checknumber' | translate}}{{transaction.paymentDetailData.checkNumber}}
    {{ 'label.heading.routingcode' | translate}}{{transaction.paymentDetailData.routingCode}}
    {{ 'label.heading.receiptnumber' | translate}}{{transaction.paymentDetailData.receiptNumber}}
    {{ 'label.heading.banknumber' | translate}}{{transaction.paymentDetailData.bankNumber}}
    -
    + + +
    + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.id' | translate}}{{transaction.id}}
    {{ 'label.heading.type' | translate}}{{transaction.type.value}}
    {{ 'label.heading.date' | translate}}{{transaction.date | DateFormat}}
    {{ 'label.heading.currency' | translate}}{{transaction.currency.name}}
    {{ 'label.heading.amount' | translate}}{{transaction.amount}}
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.paymentdetails' | translate}}
    {{ 'label.heading.paymenttype' | translate}}{{transaction.paymentDetailData.paymentType.name}}
    {{ 'label.heading.accnum' | translate}}{{transaction.paymentDetailData.accountNumber}}
    {{ 'label.heading.checknumber' | translate}}{{transaction.paymentDetailData.checkNumber}}
    {{ 'label.heading.routingcode' | translate}}{{transaction.paymentDetailData.routingCode}}
    {{ 'label.heading.receiptnumber' | translate}}{{transaction.paymentDetailData.receiptNumber}}
    {{ 'label.heading.banknumber' | translate}}{{transaction.paymentDetailData.bankNumber}}
    +
    \ No newline at end of file diff --git a/app/views/loans/viewloanaccountdetails.html b/app/views/loans/viewloanaccountdetails.html index 6bdf2b5e..92616fd5 100644 --- a/app/views/loans/viewloanaccountdetails.html +++ b/app/views/loans/viewloanaccountdetails.html @@ -1,17 +1,19 @@
    -
    +
    -
    -
    -
    +
    +
    +
     {{loandetails.loanProductName}}(#{{loandetails.accountNo}}) -
    -
    +
    +
    @@ -33,581 +35,653 @@
    -
    +
    -

    -
    -
    - - - - - - - - - - - - + +
    {{'label.heading.disbursementdate' | translate}}{{loandetails.timeline.actualDisbursementDate | DateFormat}}{{'label.heading.notavailable' | translate}}
    {{'label.heading.currency' | translate}}{{loandetails.currency.name}}
    {{'label.heading.loanofficer' | translate}}{{'label.unassigned' | translate}}{{loandetails.loanOfficerName}}  +
    +
    + +
    +
    + + + + + + + + + + + + - -
    {{'label.heading.disbursementdate' | translate}}{{loandetails.timeline.actualDisbursementDate | DateFormat}}{{'label.heading.notavailable' | translate}} +
    {{'label.heading.currency' | translate}}{{loandetails.currency.name}}
    {{'label.heading.loanofficer' | translate}}{{'label.unassigned' | translate}}{{loandetails.loanOfficerName}}  - + -
    -
    -
    - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanpurpose' | translate}}{{loandetails.loanPurposeName}} - {{'label.heading.notprovided' | translate}}
    {{'label.heading.approvedamount' | translate}}{{loandetails.approvedPrincipal}}
    {{'label.heading.disburseamount' | translate}}{{loandetails.principal}}
    {{'label.heading.arrearsby' | translate}}{{loandetails.summary.totalOverdue}}{{'label.heading.notprovided' | translate}}
    -
    +
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.repaymentstrategy' | translate}}{{loandetails.transactionProcessingStrategyName}}
    {{'label.heading.repayments' | translate}}{{loandetails.numberOfRepayments}} every {{loandetails.repaymentEvery}} {{loandetails.repaymentFrequencyType.value}}
    {{'label.heading.amortization' | translate}}{{loandetails.amortizationType.value}}
    {{'label.heading.interest' | translate}}{{loandetails.annualInterestRate}} per annum ({{loandetails.interestRatePerPeriod}}%  {{loandetails.interestRateFrequencyType.value}}) - {{loandetails.interestType.value}}
    {{'label.heading.graceonprincipalpayment' | translate}}{{loandetails.graceOnPrincipalPayment}}
    {{'label.heading.graceoninterestpayment' | translate}}{{loandetails.graceOnInterestPayment}}
    {{'label.heading.fundsource' | translate}}{{loandetails.fundName}}
    {{'label.heading.interestfreeperiod' | translate}}{{loandetails.graceOnInterestCharged}}
    {{'label.heading.interestcalculationperiod' | translate}}{{loandetails.interestCalculationPeriodType.value}}
    {{'label.heading.interesttype' | translate}}{{loandetails.interestType.value}}
    {{'label.heading.submittedondate' | translate}}{{loandetails.timeline.submittedOnDate | DateFormat }}
    {{'label.heading.approvedondate' | translate}}{{loandetails.timeline.approvedOnDate | DateFormat}}
    {{'label.heading.disbursedondate' | translate}}{{loandetails.timeline.actualDisbursementDate | DateFormat}}
    {{'label.heading.matureson' | translate}}{{loandetails.timeline.expectedMaturityDate | DateFormat}}
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.firstname' | translate}}{{'label.heading.lastname' | translate}}{{'label.heading.relationship' | translate}}{{'label.heading.guarantortype' | translate}}
    {{guarantor.firstname}}{{guarantor.lastname}}{{guarantor.clientRelationshipType.name}}{{guarantor.guarantorType.value}}{{'label.heading.details' | translate}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.firstname' | translate}}{{guarantorData.firstname}}
    {{'label.heading.lastname' | translate}}{{guarantorData.lastname}}
    {{'label.heading.relationship' | translate}}:{{guarantorData.clientRelationshipType.name}}
    {{'label.heading.guarantortype' | translate}}:{{guarantorData.guarantorType.value}}
    {{'label.heading.joindate' | translate}}:{{guarantorData.joinedDate | DateFormat}}
    {{'label.heading.office' | translate}}:{{guarantorData.officeName}}
    {{'label.heading.dob' | translate}}:{{guarantorData.dob | DateFormat}}
    {{'label.heading.mobile' | translate}}:{{guarantorData.mobileNumber}}
    {{'label.heading.residence' | translate}}:{{guarantorData.housePhoneNumber}}
    {{'label.heading.city' | translate}}:{{guarantorData.city}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.original' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.waived' | translate}}{{'label.heading.writtenoff' | translate}}{{'label.heading.outstanding' | translate}}{{'label.heading.overdue' | translate}}
    {{'label.heading.principal' | translate}}{{loandetails.summary.principalDisbursed}}{{loandetails.summary.principalPaid}} {{loandetails.summary.principalWrittenOff}}{{loandetails.summary.principalOutstanding}}{{loandetails.summary.principalOverdue}}
    {{'label.heading.interest' | translate}}{{loandetails.summary.interestCharged}}{{loandetails.summary.interestPaid}}{{loandetails.summary.interestWaived}}{{loandetails.summary.interestWrittenOff}}{{loandetails.summary.interestOutstanding}}{{loandetails.summary.interestOverdue}}
    {{'label.heading.fees' | translate}}{{loandetails.summary.feeChargesCharged}}{{loandetails.summary.feeChargesPaid}}{{loandetails.summary.feeChargesWaived}}{{loandetails.summary.feeChargesWrittenOff}}{{loandetails.summary.feeChargesOutstanding}}{{loandetails.summary.feeChargesOverdue}}
    {{'label.heading.penalties' | translate}}{{loandetails.summary.penaltyChargesCharged}}{{loandetails.summary.penaltyChargesPaid}}{{loandetails.summary.penaltyChargesWaived}}{{loandetails.summary.penaltyChargesWrittenOff}}{{loandetails.summary.penaltyChargesOutstanding}}{{loandetails.summary.penaltyChargesOverdue}}
    {{'label.heading.total' | translate}}{{loandetails.summary.totalExpectedRepayment}}{{loandetails.summary.totalRepayment}}{{loandetails.summary.totalWaived}}{{loandetails.summary.totalWrittenOff}}{{loandetails.summary.totalOutstanding}}{{loandetails.summary.totalOverdue}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}{{'label.heading.installmenttotals' | translate}}
    #{{'label.heading.days' | translate}}{{'label.heading.date' | translate}}{{'label.heading.paiddate' | translate}} {{'label.heading.principaldue' | translate}}{{'label.heading.balanceofloan' | translate}}{{'label.heading.interest' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.penalties' | translate}}{{'label.heading.due' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.inadvance' | translate}}{{'label.heading.late' | translate}}{{'label.heading.totaldue' | translate}}
    {{period.period}}{{period.daysInPeriod}}{{period.dueDate | DateFormat}}{{period.obligationsMetOnDate | DateFormat}}
    {{period.principalDue | number:decimals}}{{period.principalLoanBalanceOutstanding | number:decimals}}{{period.interestOriginalDue | number:decimals}}{{period.feeChargesDue | number:decimals}}{{period.penaltyChargesDue | number:decimals}}{{period.totalDueForPeriod | number:decimals}}{{period.totalPaidForPeriod | number:decimals}}{{period.totalPaidInAdvanceForPeriod | number:decimals}}{{period.totalPaidLateForPeriod | number:decimals}}{{period.totalOutstandingForPeriod | number:decimals}}
     {{loandetails.repaymentSchedule.loanTermInDays}}{{'label.heading.total' | translate}}{{loandetails.repaymentSchedule.totalPrincipalExpected | number:decimals}} {{loandetails.repaymentSchedule.totalInterestCharged | number:decimals}}{{loandetails.repaymentSchedule.totalFeeChargesCharged | number:decimals}}{{loandetails.repaymentSchedule.totalPenaltyChargesCharged | number:decimals}}{{loandetails.repaymentSchedule.totalRepaymentExpected | number:decimals}}{{loandetails.repaymentSchedule.totalRepayment | number:decimals}}{{loandetails.repaymentSchedule.totalPaidInAdvance | number:decimals}}{{loandetails.repaymentSchedule.totalPaidLate | number:decimals}}{{loandetails.repaymentSchedule.totalOutstanding | number:decimals}}
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.id' | translate}}{{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.transactiontype' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.breakdown' | translate}}
         {{'label.heading.principal' | translate}}{{'label.heading.interest' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.penalities' | translate}}
    {{transaction.id}}{{transaction.officeName}}{{transaction.date | DateFormat}}{{transaction.type.value}}{{transaction.amount}}{{transaction.principalPortion}}{{transaction.interestPortion}}{{transaction.feeChargesPortion}}{{transaction.penaltyChargesPortion}}
    -
    - - - - - - - - - - - - - - - - - -
    {{'label.heading.type' | translate}}{{'label.heading.description' | translate}}{{'label.heading.value' | translate}}
    - {{collateral.type.name}} - {{collateral.description}}{{collateral.value}}{{'label.button.details' | translate}}
    -
    - - - +
    +
    - - - - - - - - -
    - {{'label.input.fixedemiamount' | translate}} :  {{loandetails.fixedEmiAmount}}  -
    - {{'label.input.outstandingloanbalance' | translate}} :  {{loandetails.maxOutstandingLoanBalance}}  -
    - {{'label.heading.tranchedetails' | translate}} -
    - - - - - - - - - - - - - - + -
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.disbursedon' | translate}}{{'label.heading.approvedamount' | translate}}{{'label.input.principal' | translate}} 
    {{disbursementDetail.expectedDisbursementDate | DateFormat}}{{disbursementDetail.actualDisbursementDate | DateFormat}}{{disbursementDetail.approvedPrincipal}}{{disbursementDetail.principal}}
    - +
    {{'label.heading.loanpurpose' | translate}}{{loandetails.loanPurposeName}} + {{'label.heading.notprovided' | translate}}
    - - - + + -
    - {{'label.input.fixedemiamountvariations' | translate}} :    - {{'label.heading.approvedamount' | translate}}{{loandetails.approvedPrincipal}}
    - - - - + + + - - - - -
    {{'label.input.emiamoutvariationfrom' | translate}}{{'label.input.fixedemiamount' | translate}}
    {{'label.heading.disburseamount' | translate}}{{loandetails.principal}}
    {{emiVariations.termVariationApplicableFrom | DateFormat}}{{emiVariations.termValue}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - -
    {{'label.heading.name' | translate}}{{'label.heading.feeorpenalty' | translate}}{{'label.heading.paymentdueat' | translate}}{{'label.heading.dueasof' | translate}}{{'label.heading.calculationtype' | translate}}{{'label.heading.due' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.waived' | translate}}{{'label.heading.outstanding' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}}{{"penalty"}}{{"fee"}}{{charge.chargeTimeType.value}}{{charge.dueDate | DateFormat}}{{charge.chargeCalculationType.value}}{{charge.currency.displaySymbol}}{{charge.amount}}{{charge.currency.displaySymbol}}{{charge.amountPaid}}{{charge.currency.displaySymbol}}{{charge.amountWaived}}{{charge.currency.displaySymbol}}{{charge.amountOutstanding}} - - - - {{"label.button.pay" | translate}} +
    {{'label.heading.arrearsby' | translate}}{{loandetails.summary.totalOverdue}}{{'label.heading.notprovided' | translate}}
    -
    + +
    +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.repaymentstrategy' | + translate}} + {{loandetails.transactionProcessingStrategyName}}
    {{'label.heading.repayments' | translate}}{{loandetails.numberOfRepayments}} every {{loandetails.repaymentEvery}} {{loandetails.repaymentFrequencyType.value}} +
    {{'label.heading.amortization' | translate}}{{loandetails.amortizationType.value}}
    {{'label.heading.interest' | translate}}{{loandetails.annualInterestRate}} per annum ({{loandetails.interestRatePerPeriod}}%  {{loandetails.interestRateFrequencyType.value}}) - {{loandetails.interestType.value}} +
    {{'label.heading.graceonprincipalpayment' | + translate}} + {{loandetails.graceOnPrincipalPayment}}
    {{'label.heading.graceoninterestpayment' | + translate}} + {{loandetails.graceOnInterestPayment}}
    {{'label.heading.fundsource' | translate}}{{loandetails.fundName}}
    {{'label.heading.interestfreeperiod' | + translate}} + {{loandetails.graceOnInterestCharged}}
    {{'label.heading.interestcalculationperiod' | + translate}} + {{loandetails.interestCalculationPeriodType.value}}
    {{'label.heading.interesttype' | translate}}{{loandetails.interestType.value}}
    {{'label.heading.submittedondate' | translate}} + {{loandetails.timeline.submittedOnDate | DateFormat }}
    {{'label.heading.approvedondate' | translate}} + {{loandetails.timeline.approvedOnDate | DateFormat}}
    {{'label.heading.disbursedondate' | translate}} + {{loandetails.timeline.actualDisbursementDate | DateFormat}}
    {{'label.heading.matureson' | translate}}{{loandetails.timeline.expectedMaturityDate | DateFormat}}
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.firstname' | translate}}{{'label.heading.lastname' | translate}}{{'label.heading.relationship' | translate}}{{'label.heading.guarantortype' | translate}}
    {{guarantor.firstname}}{{guarantor.lastname}}{{guarantor.clientRelationshipType.name}}{{guarantor.guarantorType.value}}{{'label.heading.details' | translate}} + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.firstname' | translate}}{{guarantorData.firstname}}
    {{'label.heading.lastname' | translate}}{{guarantorData.lastname}}
    {{'label.heading.relationship' | translate}}:{{guarantorData.clientRelationshipType.name}}
    {{'label.heading.guarantortype' | translate}}:{{guarantorData.guarantorType.value}}
    {{'label.heading.joindate' | translate}}:{{guarantorData.joinedDate | DateFormat}}
    {{'label.heading.office' | translate}}:{{guarantorData.officeName}}
    {{'label.heading.dob' | translate}}:{{guarantorData.dob | DateFormat}}
    {{'label.heading.mobile' | translate}}:{{guarantorData.mobileNumber}}
    {{'label.heading.residence' | translate}}:{{guarantorData.housePhoneNumber}}
    {{'label.heading.city' | translate}}:{{guarantorData.city}}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - -
    -
    {{'label.heading.original' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.waived' | translate}}{{'label.heading.writtenoff' | translate}}{{'label.heading.outstanding' | translate}}{{'label.heading.overdue' | translate}}
    {{'label.heading.principal' | translate}}{{loandetails.summary.principalDisbursed}}{{loandetails.summary.principalPaid}} {{loandetails.summary.principalWrittenOff}}{{loandetails.summary.principalOutstanding}}{{loandetails.summary.principalOverdue}}
    {{'label.heading.interest' | translate}}{{loandetails.summary.interestCharged}}{{loandetails.summary.interestPaid}}{{loandetails.summary.interestWaived}}{{loandetails.summary.interestWrittenOff}}{{loandetails.summary.interestOutstanding}}{{loandetails.summary.interestOverdue}}
    {{'label.heading.fees' | translate}}{{loandetails.summary.feeChargesCharged}}{{loandetails.summary.feeChargesPaid}}{{loandetails.summary.feeChargesWaived}}{{loandetails.summary.feeChargesWrittenOff}}{{loandetails.summary.feeChargesOutstanding}}{{loandetails.summary.feeChargesOverdue}}
    - + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.penalties' | translate}}{{loandetails.summary.penaltyChargesCharged}}{{loandetails.summary.penaltyChargesPaid}}{{loandetails.summary.penaltyChargesWaived}}{{loandetails.summary.penaltyChargesWrittenOff}}{{loandetails.summary.penaltyChargesOutstanding}}{{loandetails.summary.penaltyChargesOverdue}}
    {{'label.heading.total' | translate}}{{loandetails.summary.totalExpectedRepayment}}{{loandetails.summary.totalRepayment}}{{loandetails.summary.totalWaived}}{{loandetails.summary.totalWrittenOff}}{{loandetails.summary.totalOutstanding}}{{loandetails.summary.totalOverdue}}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanamountandbalance' | translate}}{{'label.heading.totalcostofloan' | translate}}{{'label.heading.installmenttotals' | translate}}
    #{{'label.heading.days' | translate}}{{'label.heading.date' | translate}}{{'label.heading.paiddate' | translate}} {{'label.heading.principaldue' | translate}}{{'label.heading.balanceofloan' | translate}}{{'label.heading.interest' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.penalties' | translate}}{{'label.heading.due' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.inadvance' | translate}}{{'label.heading.late' | translate}}{{'label.heading.totaldue' | translate}}
    {{period.period}}{{period.daysInPeriod}}{{period.dueDate | DateFormat}}{{period.obligationsMetOnDate | DateFormat}} +
    +
    {{period.principalDue | number:decimals}}{{period.principalLoanBalanceOutstanding | number:decimals}}{{period.interestOriginalDue | number:decimals}}{{period.feeChargesDue | number:decimals}}{{period.penaltyChargesDue | number:decimals}}{{period.totalDueForPeriod | number:decimals}}{{period.totalPaidForPeriod | number:decimals}}{{period.totalPaidInAdvanceForPeriod | number:decimals}}{{period.totalPaidLateForPeriod | number:decimals}}{{period.totalOutstandingForPeriod | number:decimals}}
     {{loandetails.repaymentSchedule.loanTermInDays}}{{'label.heading.total' | translate}}{{loandetails.repaymentSchedule.totalPrincipalExpected | number:decimals}} {{loandetails.repaymentSchedule.totalInterestCharged | number:decimals}}{{loandetails.repaymentSchedule.totalFeeChargesCharged | number:decimals}}{{loandetails.repaymentSchedule.totalPenaltyChargesCharged | number:decimals}}{{loandetails.repaymentSchedule.totalRepaymentExpected | number:decimals}}{{loandetails.repaymentSchedule.totalRepayment | number:decimals}}{{loandetails.repaymentSchedule.totalPaidInAdvance | number:decimals}}{{loandetails.repaymentSchedule.totalPaidLate | number:decimals}}{{loandetails.repaymentSchedule.totalOutstanding | number:decimals}}
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.id' | translate}}{{'label.heading.office' | translate}}{{'label.heading.transactiondate' | translate}}{{'label.heading.transactiontype' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.breakdown' | translate}}
         {{'label.heading.principal' | translate}}{{'label.heading.interest' | translate}}{{'label.heading.fees' | translate}}{{'label.heading.penalities' | translate}}
    + {{transaction.id}} + + {{transaction.officeName}} + + {{transaction.date | DateFormat}} + + {{transaction.type.value}} + + {{transaction.amount}} + + {{transaction.principalPortion}} + + {{transaction.interestPortion}} + + {{transaction.feeChargesPortion}} + + {{transaction.penaltyChargesPortion}} +
    +
    + + + + + + + + + + + + + + + + + +
    {{'label.heading.type' | translate}}{{'label.heading.description' | translate}}{{'label.heading.value' | translate}}
    + {{collateral.type.name}} + {{collateral.description}}{{collateral.value}}{{'label.button.details' | + translate}}
    +
    + + + + + + + + + + + + +
    + {{'label.input.fixedemiamount' | translate}} :  {{loandetails.fixedEmiAmount}}  +
    + {{'label.input.outstandingloanbalance' | translate}} :  {{loandetails.maxOutstandingLoanBalance}}  +
    + {{'label.heading.tranchedetails' | translate}} +
    + + + + + + + + + + + + + + + +
    {{'label.input.expecteddisbursementon' | translate}}{{'label.input.disbursedon' | translate}}{{'label.heading.approvedamount' | translate}}{{'label.input.principal' | translate}} 
    {{disbursementDetail.expectedDisbursementDate | DateFormat}}{{disbursementDetail.actualDisbursementDate | DateFormat}}{{disbursementDetail.approvedPrincipal}}{{disbursementDetail.principal}} +
    +
    + +
    + + + + + +
    + {{'label.input.fixedemiamountvariations' | translate}} :    +
    + + + + + + + + + +
    {{'label.input.emiamoutvariationfrom' | translate}}{{'label.input.fixedemiamount' | translate}}
    {{emiVariations.termVariationApplicableFrom | DateFormat}}{{emiVariations.termValue}}
    +
    + + + + + - - + + + + + + + + + + + + + - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.filename' | translate}}{{'label.heading.feeorpenalty' | translate}}{{'label.heading.paymentdueat' | translate}}{{'label.heading.dueasof' | translate}}{{'label.heading.calculationtype' | translate}}{{'label.heading.due' | translate}}{{'label.heading.paid' | translate}}{{'label.heading.waived' | translate}}{{'label.heading.outstanding' | translate}} {{'label.heading.actions' | translate}}
    {{document.name}}{{document.description}}{{document.fileName}} -   - -
    -
    + + + + {{charge.name}} + + {{"penalty"}} + {{"fee"}} + + {{charge.chargeTimeType.value}} + + {{charge.dueDate | DateFormat}} + + {{charge.chargeCalculationType.value}} + + {{charge.currency.displaySymbol}}{{charge.amount}} + {{charge.currency.displaySymbol}}{{charge.amountPaid}} + {{charge.currency.displaySymbol}}{{charge.amountWaived}} + {{charge.currency.displaySymbol}}{{charge.amountOutstanding}} + + + + + + {{"label.button.pay" | + translate}} + + + + + - -
    + + + +
    + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.description' | translate}}{{'label.heading.filename' | translate}}{{'label.heading.actions' | translate}}
    {{document.name}}{{document.description}}{{document.fileName}} +   + +
    +
    + + +
    - {{'label.button.deleteall' | translate}} + {{'label.button.deleteall' | translate}} - {{'label.button.add' | translate}} + {{'label.button.add' | translate}}
    -
    - - - - - - - - - -
    {{column.columnName}}
    - - {{row}} - {{row}} - - {{row}} -
    - - - - - -
    {{value.key}}{{value.value}}
    -
    -
    -
    - -
    -
    -

    {{note.note}}

    - {{'label.heading.updatedby'| translate}} : {{note.updatedByUsername}} - {{'label.heading.updatedon'| translate}} : {{note.updatedOn | DateFormat}} -
    -
    -
    - +
    + + + + + + + + + +
    {{column.columnName}}
    + + {{row}} + {{row}} + + {{row}} +
    + + + + + +
    {{value.key}}{{value.value}}
    +
    -
    + + + +
    +
    +

    {{note.note}}

    + {{'label.heading.updatedby'| translate}} : {{note.updatedByUsername}} + {{'label.heading.updatedon'| translate}} : {{note.updatedOn | DateFormat}} +
    +
    +
    + +
    +
    diff --git a/app/views/loans/viewloancharge.html b/app/views/loans/viewloancharge.html index ecf08bb9..191cbe43 100644 --- a/app/views/loans/viewloancharge.html +++ b/app/views/loans/viewloancharge.html @@ -1,10 +1,11 @@
    -
    - -
    +
    + +
    -
    +
    - {{'label.button.edit' | translate}} - + {{'label.button.edit' | translate}} +
    -

    {{'label.anchor.viewcharge' | translate}}

    - - - - - - - - +
    {{'label.heading.name' | translate}}{{charge.name}}
    {{'label.heading.chargetype' | translate}} - {{'label.heading.penalty' | translate}} +

    {{'label.anchor.viewcharge' | translate}}

    + + + + + + + + - - - - - - + + + + + + @@ -65,7 +69,7 @@ - -
    {{'label.heading.name' | translate}}{{charge.name}}
    {{'label.heading.chargetype' | translate}} + {{'label.heading.penalty' | translate}} {{'label.heading.fees' | translate}}
    {{'label.heading.currency' | translate}}{{charge.currency.name}}
    {{'label.heading.currency' | translate}}{{charge.currency.name}}
    {{'label.heading.paymentdueat' | translate}} {{charge.chargeTimeType.value}}
    {{'label.heading.outstanding' | translate}} {{charge.currency.displaySymbol}} {{charge.amountOutstanding}}
    - +
    +
    \ No newline at end of file diff --git a/app/views/loans/viewloancollateral.html b/app/views/loans/viewloancollateral.html index 20d2077a..02b74847 100644 --- a/app/views/loans/viewloancollateral.html +++ b/app/views/loans/viewloancollateral.html @@ -1,10 +1,11 @@
    -
    - -
    +
    + +
    -
    +
    - {{'label.button.edit' | translate}} - + {{'label.button.edit' | translate}} +
    -

    {{'label.heading.viewcollateral' | translate}}

    - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{collateral.type.name}}
    {{'label.heading.description' | translate}}{{collateral.description}}
    {{'label.heading.currency' | translate}}{{collateral.currency.name}}
    {{'label.heading.value' | translate}}{{collateral.currency.displaySymbol}}  {{collateral.value}}
    -
    +

    {{'label.heading.viewcollateral' | translate}}

    + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{collateral.type.name}}
    {{'label.heading.description' | translate}}{{collateral.description}}
    {{'label.heading.currency' | translate}}{{collateral.currency.name}}
    {{'label.heading.value' | translate}}{{collateral.currency.displaySymbol}}  {{collateral.value}}
    +
    \ No newline at end of file diff --git a/app/views/login.html b/app/views/login.html index deeb52b9..4396996a 100644 --- a/app/views/login.html +++ b/app/views/login.html @@ -1,13 +1,14 @@
    -
    - - -
    -
    - -
    -
    -

    {{'error.login.failed' | translate}}

    -
    +
    + + +
    +
    + +
    +
    +

    {{'error.login.failed' | translate}}

    +
    diff --git a/app/views/navigation/offices.html b/app/views/navigation/offices.html index ef4b01ac..4b55e11a 100644 --- a/app/views/navigation/offices.html +++ b/app/views/navigation/offices.html @@ -1,118 +1,138 @@
    - - -
    + + + +
    +
    -
    - -
    -
    - - - - -
    {{office.name}}
    -
    +
    -
    -
    - -
    -
    - - - - -
    {{staff.displayName}}
    -
    -
    -
    -
    - -
    -
    - - - - -
    {{center.name}}
    -
    -
    -
    -
    - -
    -
    - - - - -
    {{group.name}}
    -
    -
    -
    -
    - -
    - +
    + + + + +
    {{office.name}}
    -
    -
    -
    -
    +
    +
    + +
    +
    + + + + +
    {{staff.displayName}}
    +
    +
    +
    +
    + +
    +
    + + + + +
    {{center.name}}
    +
    +
    +
    +
    + +
    +
    + + + + +
    {{group.name}}
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +

    -   - {{officeName}} -

    +   + {{officeName}} +
    -
    - - - - - - - - - - - - - -
    {{ 'label.heading.parentoffice' | translate }}{{office.parentName}}
    {{ 'label.heading.openedon' | translate }}{{office.openingDate | DateFormat}}
    {{ 'label.heading.externalid' | translate }}{{office.externalId}}
    -
    -
    - -

    07

    -
    -
    -
    - -

    07

    -
    -
    -
    -
    -
    -
    -
    +
    + + + + + + + + + + + + + +
    {{ 'label.heading.parentoffice' | translate }}{{office.parentName}}
    {{ 'label.heading.openedon' | translate }}{{office.openingDate | DateFormat}}
    {{ 'label.heading.externalid' | translate }}{{office.externalId}}
    +
    +
    + +

    07

    +
    +
    +
    + +

    07

    +
    +
    +
    +
    +
    +
    + +
    @@ -122,22 +142,23 @@ {{loanOfficer}} -
    - - - - - - - - - -
    {{ 'label.office.parentoffice' | translate }}{{office.parentName}}
    {{ 'label.heading.office' | translate }}{{staff.officeName}}
    -
    - +
    +
    + +
    -
    - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.activationdate' | translate }}{{center.activationDate | DateFormat}}
    {{ 'label.heading.staff' | translate }}{{center.staffName}}
    {{ 'label.heading.nextmeetingon' | translate }}{{center.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}
    {{ 'label.heading.meetingfrequency' | translate }}{{center.collectionMeetingCalendar.humanReadable}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    - {{loanaccount.productName}} - - {{loanaccount.accountNo}} - {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    - {{savingaccount.productName}} - {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} - -
    -
    -
    -
    -
    - + +
    +
    + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.activationdate' | translate }}{{center.activationDate | DateFormat}}
    {{ 'label.heading.staff' | translate }}{{center.staffName}}
    {{ 'label.heading.nextmeetingon' | translate }}{{center.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}
    {{ 'label.heading.meetingfrequency' | translate }}{{center.collectionMeetingCalendar.humanReadable}}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    + {{loanaccount.productName}} + + {{loanaccount.accountNo}} + {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    + {{savingaccount.productName}} + {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} + +
    +
    +
    +
    + + -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.firstname' | translate}}{{client.firstname}}
    {{'label.heading.lastname' | translate}}{{client.lastname}}
    {{ 'label.heading.accnum' | translate }}{{client.accountNo}}
    {{ 'label.heading.activationdate' | translate }}{{client.activationDate | DateFormat}}
    {{ 'label.heading.office' | translate }}{{client.officeName}}
    {{ 'label.heading.staff' | translate }}{{client.staffName}}
    -
    - - - - + +
    {{ 'label.heading.memberof' | translate }} + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.firstname' | translate}}{{client.firstname}}
    {{'label.heading.lastname' | translate}}{{client.lastname}}
    {{ 'label.heading.accnum' | translate }}{{client.accountNo}}
    {{ 'label.heading.activationdate' | translate }}{{client.activationDate | DateFormat}}
    {{ 'label.heading.office' | translate }}{{client.officeName}}
    {{ 'label.heading.staff' | translate }}{{client.staffName}}
    +
    + + + + - -
    {{ 'label.heading.memberof' | translate }} {{group.name}} | -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    - {{loanaccount.productName}} - - {{loanaccount.accountNo}} - {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    - {{savingaccount.productName}} - {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} - -
    - -
    -
    -
    - +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    + {{loanaccount.productName}} + + {{loanaccount.accountNo}} + {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    + {{savingaccount.productName}} + {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} + +
    +
    +
    +
    + + -
    - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.activationdate' | translate }}{{group.activationDate | DateFormat}}
    {{ 'label.heading.staff' | translate }}{{group.staffName}}
    {{ 'label.heading.nextmeetingon' | translate }}{{group.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}
    {{ 'label.heading.meetingfrequency' | translate }}{{group.collectionMeetingCalendar.humanReadable}}
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    - {{loanaccount.productName}} - - {{loanaccount.accountNo}} - {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    - {{savingaccount.productName}} - {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} - -
    -
    +
    +
    + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.activationdate' | translate }}{{group.activationDate | DateFormat}}
    {{ 'label.heading.staff' | translate }}{{group.staffName}}
    {{ 'label.heading.nextmeetingon' | translate }}{{group.collectionMeetingCalendar.nextTenRecurringDates[0] | DateFormat}}
    {{ 'label.heading.meetingfrequency' | translate }}{{group.collectionMeetingCalendar.humanReadable}}
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.loanaccount'| translate}}{{'label.heading.loantype'| translate}}{{'label.heading.status'| translate}}
    + {{loanaccount.productName}} + + {{loanaccount.accountNo}} + {{loanaccount.loanType.value}}{{loanaccount.status.value}}
     
    {{'label.heading.savingaccount'| translate}}{{'label.heading.balance'| translate}}{{'label.heading.status'| translate}}
    + {{savingaccount.productName}} + {{savingaccount.accountNo}}{{savingaccount.accountBalance}}{{savingaccount.status.value}} + +
    +
    +
    \ No newline at end of file diff --git a/app/views/organization/bulkloan.html b/app/views/organization/bulkloan.html index 59eae4ca..58e6115e 100644 --- a/app/views/organization/bulkloan.html +++ b/app/views/organization/bulkloan.html @@ -12,9 +12,13 @@
    - + +
    -
    @@ -24,9 +28,13 @@
    - + +
    - +
    @@ -34,9 +42,13 @@
    - + +
    -
    @@ -44,9 +56,12 @@
    - + +
    -
    @@ -58,15 +73,18 @@
    - + @@ -77,25 +95,30 @@
    {{'label.heading.clients' | translate}}{{'label.heading.clients' | translate}}
    - + + + - +
    {{client.displayName}}
    {{client.displayName}}
      {{loan.productName}}({{loan.accountNo}})  {{loan.productName}}({{loan.accountNo}}) +
    - + - - + - + +
    {{'label.heading.groups' | translate}}{{'label.heading.groups' | translate}}
    +
    - + + + - +
    {{group.displayName}}
    {{group.displayName}}
      {{loan.productName}}({{loan.accountNo}})  {{loan.productName}}({{loan.accountNo}}) +
    -
    diff --git a/app/views/organization/createemployee.html b/app/views/organization/createemployee.html index 07072cb4..cbf14363 100644 --- a/app/views/organization/createemployee.html +++ b/app/views/organization/createemployee.html @@ -1,51 +1,63 @@ -
    - -
    -
    - -
    - {{'label.heading.createemployee' | translate}} +
    + +
    + + +
    + {{'label.heading.createemployee' | translate}} -
    - -
    - -
    -
    +
    + -
    -
    - - +
    -
    +
    + +
    + -
    -
    - - + +
    -
    - -
    +
    + +
    + + +
    + + +
    +
    + +
    -
    - -
    -
    - + +
    + + + -
    -
    - +
    + + diff --git a/app/views/organization/createholiday.html b/app/views/organization/createholiday.html index 0b02b71d..92236e88 100644 --- a/app/views/organization/createholiday.html +++ b/app/views/organization/createholiday.html @@ -5,7 +5,8 @@
  • {{'label.anchor.createholiday' | translate}}
  • -
    +
    {{'label.heading.createholiday' | translate}} @@ -14,8 +15,10 @@
    +
    - +
    @@ -26,14 +29,21 @@
    - -
    - -
    -
    - + +
    - + +
    +
    +
    + + +
    +
    @@ -43,9 +53,12 @@
    - + +
    - +
    @@ -54,6 +67,7 @@
    +
    @@ -64,20 +78,23 @@
    +
    + data-angular-treeview="true" + data-tree-id="holidaytreeview" + data-tree-model="treedata" + data-node-id="id" + data-node-label="name" + data-node-children="children">
    diff --git a/app/views/organization/createoffice.html b/app/views/organization/createoffice.html index d7f3dbf6..40ca281d 100644 --- a/app/views/organization/createoffice.html +++ b/app/views/organization/createoffice.html @@ -1,60 +1,73 @@ -
    - -
    - - -
    - {{'label.heading.createoffice' | translate}} - +
    + +
    + + +
    + {{'label.heading.createoffice' | translate}} +
    - + - + - + - + -
    -
    - -
    - - -
    -
    -
    +
    + + +
    + + +
    +
    +
    -
    - -
    - -
    -
    -
    +
    + + +
    + +
    +
    +
    -
    - -
    - -
    -
    -
    +
    + + +
    + +
    +
    +
    -
    - -
    - -
    -
    -
    +
    + + +
    + +
    +
    +
    -
    - +
    +
    + diff --git a/app/views/organization/currencyconfig.html b/app/views/organization/currencyconfig.html index b0021d12..732d6705 100644 --- a/app/views/organization/currencyconfig.html +++ b/app/views/organization/currencyconfig.html @@ -2,52 +2,60 @@
    - - - - - - - - - - - - - -
    {{'label.heading.currencyname' | translate}}{{'label.heading.currencycode' | translate}}
    {{currency.name}}{{currency.code}}
    + + + + + + + + + + + + + +
    {{'label.heading.currencyname' | translate}}{{'label.heading.currencycode' | translate}}
    {{currency.name}}{{currency.code}}

    -    +    -
    -    +
    +   
    - - + +
    -
    +
    \ No newline at end of file diff --git a/app/views/organization/editemployee.html b/app/views/organization/editemployee.html index 33f721ea..8a7a98c2 100644 --- a/app/views/organization/editemployee.html +++ b/app/views/organization/editemployee.html @@ -1,63 +1,79 @@ -
    -
    + +
    - {{'label.heading.editemployee' | translate}} + {{'label.heading.editemployee' | translate}} -
    - -
    - -
    -
    +
    + -
    - -
    - - +
    + +
    -
    -
    - -
    - - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    +
    + -
    - - -
    +
    + + +
    +
    + +
    + + +
    + + +
    +
    + +
    + + +
    + +
    +
    + +
    + + +
    + +
    +
    + +
    + + + + +
    - -
    + +
    diff --git a/app/views/organization/editholiday.html b/app/views/organization/editholiday.html index ccfec8d5..461fc8cf 100644 --- a/app/views/organization/editholiday.html +++ b/app/views/organization/editholiday.html @@ -1,8 +1,10 @@
    @@ -11,44 +13,59 @@
    {{'label.heading.editholiday' | translate}} -
    +
    +
    - +
    -
    +
    - -
    - -
    -
    - + +
    - + +
    +
    +
    + + +
    +
    - + +
    - +
    +
    diff --git a/app/views/organization/editoffice.html b/app/views/organization/editoffice.html index 481d77d8..233836c2 100644 --- a/app/views/organization/editoffice.html +++ b/app/views/organization/editoffice.html @@ -1,60 +1,73 @@ -
    - -
    -
    - -
    - {{'label.heading.editoffice' | translate}} - +
    + +
    + + +
    + {{'label.heading.editoffice' | translate}} +
    - + - - - - - + + - + -
    -
    - -
    - - -
    -
    -
    +
    + + +
    + + +
    +
    +
    -
    - -
    - -
    -
    -
    -
    - -
    - -
    -
    -
    +
    + + +
    + +
    +
    +
    -
    - -
    - -
    -
    -
    +
    + + +
    + +
    +
    +
    -
    - + + +
    + + +
    + +
    +
    + + + +
    + + + -
    -
    -
    +
    +
    + diff --git a/app/views/organization/employees.html b/app/views/organization/employees.html index e38aa25b..07bc848e 100644 --- a/app/views/organization/employees.html +++ b/app/views/organization/employees.html @@ -4,25 +4,27 @@
  • {{'label.anchor.manageemployees' | translate}}  {{employee.lastname}}
  • - - + +
    - - - - - + + + + + - - - - - + + + + +
    {{ 'label.heading.name' | translate }}{{ 'label.heading.isLoanOfficer' | translate }}{{ 'label.heading.office' | translate }}
    {{ 'label.heading.name' | translate }}{{ 'label.heading.isLoanOfficer' | translate }}{{ 'label.heading.office' | translate }}
    {{employee.displayName}}{{employee.isLoanOfficer}}{{employee.officeName}}
    {{employee.displayName}}{{employee.isLoanOfficer}}{{employee.officeName}}
    \ No newline at end of file diff --git a/app/views/organization/holidays.html b/app/views/organization/holidays.html index 121bbe26..f79d30c5 100644 --- a/app/views/organization/holidays.html +++ b/app/views/organization/holidays.html @@ -5,13 +5,16 @@
    - @@ -22,7 +25,8 @@
    - + @@ -38,7 +42,9 @@ - + diff --git a/app/views/organization/managefunds.html b/app/views/organization/managefunds.html index 0a096eb3..77fba148 100644 --- a/app/views/organization/managefunds.html +++ b/app/views/organization/managefunds.html @@ -7,28 +7,35 @@

    {{'label.heading.managefunds' | translate}}

    -    - +    + {{ 'label.requiredfield' | translate }} -
    +
    {{holiday.name}} {{holiday.fromDate | DateFormat}} {{holiday.toDate | DateFormat}}{{holiday.repaymentsRescheduledTo | DateFormat}}{{holiday.repaymentsRescheduledTo | + DateFormat}} + {{holiday.status.value}}
    - - + +    - - + +
    -
    +
    \ No newline at end of file diff --git a/app/views/organization/offices.html b/app/views/organization/offices.html index 7081aafe..e9c5a75a 100644 --- a/app/views/organization/offices.html +++ b/app/views/organization/offices.html @@ -1,45 +1,49 @@
    - +
    - -
    - - - - - - - - - - - - - - - - - - -
    {{'label.heading.officeName' | translate}}{{'label.heading.externalid' | translate}}{{'label.heading.parentoffice' | translate}}{{'label.heading.openedon' | translate}}
    {{office.name}}{{office.externalId}}{{office.parentName}}{{office.openingDate | DateFormat}}
    -
    -
    -
    -
    -
    + +
    + + + + + + + + + + + + + + + + + + +
    {{'label.heading.officeName' | translate}}{{'label.heading.externalid' | translate}}{{'label.heading.parentoffice' | translate}}{{'label.heading.openedon' | translate}}
    {{office.name}}{{office.externalId}}{{office.parentName}}{{office.openingDate | DateFormat}}
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/organization/viewemployee.html b/app/views/organization/viewemployee.html index af380b8b..0ed82b2b 100644 --- a/app/views/organization/viewemployee.html +++ b/app/views/organization/viewemployee.html @@ -1,42 +1,46 @@ -
    -
    - +
    +
    + -
    +
    + +
    +

    {{employee.displayName}}

    -
    -

    {{employee.displayName}}

    - - - - - - - - - - - - - - - - - - - - - -
    {{ 'label.heading.firstname' | translate }}{{employee.firstname}}
    {{ 'label.heading.lastname' | translate }}{{employee.lastname}}
    {{ 'label.heading.office' | translate }}{{employee.officeName}}
    {{ 'label.heading.isLoanOfficer' | translate }}{{employee.isLoanOfficer}}
    {{ 'label.heading.mobileNo' | translate }}{{employee.mobileNo}}
    -
    + + + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.firstname' | translate }}{{employee.firstname}}
    {{ 'label.heading.lastname' | translate }}{{employee.lastname}}
    {{ 'label.heading.office' | translate }}{{employee.officeName}}
    {{ 'label.heading.isLoanOfficer' | translate }}{{employee.isLoanOfficer}}
    {{ 'label.heading.mobileNo' | translate }}{{employee.mobileNo}}
    +
    diff --git a/app/views/organization/viewholiday.html b/app/views/organization/viewholiday.html index eab65a8a..a68ef781 100644 --- a/app/views/organization/viewholiday.html +++ b/app/views/organization/viewholiday.html @@ -1,8 +1,10 @@
    @@ -27,14 +29,17 @@

    {{holiday.name}}

    - +
    diff --git a/app/views/organization/viewoffice.html b/app/views/organization/viewoffice.html index 419501fb..76e5ce7d 100644 --- a/app/views/organization/viewoffice.html +++ b/app/views/organization/viewoffice.html @@ -1,36 +1,38 @@
    {{ 'label.heading.name' | translate }} {{holiday.name}}
    - - - - - - - - - - - - - - - - -
    {{ 'label.heading.parentoffice' | translate }}{{office.parentName}}
    {{ 'label.heading.openedon' | translate }}{{office.openingDate | DateFormat}}
    {{ 'label.heading.namedecorated' | translate }}{{office.nameDecorated | DotRemove}}
    {{ 'label.heading.externalid' | translate }}{{office.externalId}}
    -
    +

    {{office.name}}

    + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.parentoffice' | translate }}{{office.parentName}}
    {{ 'label.heading.openedon' | translate }}{{office.openingDate | DateFormat}}
    {{ 'label.heading.namedecorated' | translate }}{{office.nameDecorated | DotRemove}}
    {{ 'label.heading.externalid' | translate }}{{office.externalId}}
    +
    \ No newline at end of file diff --git a/app/views/private/home_superuser.html b/app/views/private/home_superuser.html index 2fc567b0..4b4b4a12 100644 --- a/app/views/private/home_superuser.html +++ b/app/views/private/home_superuser.html @@ -1,8 +1,11 @@

    {{'label.heading.mifosxdashhome' | translate}}

    - +

    +
    @@ -24,7 +27,8 @@
    -

    {{'label.heading.frequentactivities' | translate}} +

    {{'label.heading.frequentactivities' | + translate}}

    diff --git a/app/views/products/charges.html b/app/views/products/charges.html index 0bb0583c..e816ced7 100644 --- a/app/views/products/charges.html +++ b/app/views/products/charges.html @@ -4,26 +4,28 @@
  • {{'label.anchor.charges' | translate}}
  • - - + +
    - - - - - + + + + + - - - - - + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.ispenalty' | translate}}{{'label.heading.active' | translate}}
    {{'label.heading.name' | translate}}{{'label.heading.ispenalty' | translate}}{{'label.heading.active' | translate}}
    {{charge.name}}{{charge.penalty}}{{charge.active}}
    {{charge.name}}{{charge.penalty}}{{charge.active}}
    \ No newline at end of file diff --git a/app/views/products/createcharge.html b/app/views/products/createcharge.html index 97f38426..fa523e52 100644 --- a/app/views/products/createcharge.html +++ b/app/views/products/createcharge.html @@ -10,10 +10,15 @@
    - + +
    - +
    @@ -21,63 +26,92 @@
    - + +
    - + +
    - +
    - + +
    - +
    - + +
    - +
    - + +
    - +
    - + +
    - +
    - + +
    - {{'label.input.months' | translate}} + {{'label.input.months' + | translate}}
    - + +
    @@ -85,6 +119,7 @@
    +
    +
    diff --git a/app/views/products/createloanproduct.html b/app/views/products/createloanproduct.html index 7c75039f..b8237e0c 100644 --- a/app/views/products/createloanproduct.html +++ b/app/views/products/createloanproduct.html @@ -30,7 +30,8 @@ - + @@ -132,255 +133,256 @@ - - - - - - + + + + + + - - + - - - + + + - - + - - - - - - + + + + + - - - +
    - - -
    - -   -   - - -
    + + +
    + +   +   + + +
    -
    - - - - - - - - - + +
    {{'label.heading.principalCycleVariations' | translate}}
    {{ 'label.button.add' | - translate }}
    - - - - - - - - - - - - - - + - + + +
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    - - - - - - +
    +
    + + + + + + + + + - -
    {{'label.heading.principalCycleVariations' | translate}}
    {{ 'label.button.add' | + translate }}
    + + + + + + + + + + + + + + - - + + - -
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    + + + + + + - + -
    -
    -
    -
    +
    +
    +
    - -   -    - - -
    + +   +    + + +
    -
    - - - - - - - - - - + +
    {{'label.heading.numerOfRepaymentCycleVariations' | translate}}
    {{ 'label.button.add' - | translate }}
    - - - - - - - - - - - - - - + - + + +
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    - - - - - - +
    +
    + + + + + + + + + + - -
    {{'label.heading.numerOfRepaymentCycleVariations' | translate}}
    {{ 'label.button.add' + | translate }}
    + + + + + + + + + + + + + + - - + + - -
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    + + + + + + - + -
    -
    -
    -
    +
    +
    +
    - -   -
    - -   +
    + +   +
    + +   -   +   - + -
    -
    - - - - - - - - - - + +
    {{'label.heading.interestRateCycleVariations' | translate}}
    {{ 'label.button.add' | - translate }}
    - - - - - - - - - - - - - - + + + - + + +
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    - - - - - - +
    +
    + + + + + + + + + + - -
    {{'label.heading.interestRateCycleVariations' | translate}}
    {{ 'label.button.add' | + translate }}
    + + + + + + + + + + + + + + - - + + - -
    {{'label.input.cyclenumber' | translate}}{{'label.input.minimum' | translate}}{{'label.input.default' | translate}}{{'label.input.maximum' | translate}}
    + + + + + + - + -
    -
    -
    -
    +
    +
    +
    @@ -476,13 +478,14 @@ - + - + @@ -549,285 +552,299 @@ - - - - - - - - - -
    - {{'label.input.none' | - translate}}
    -
    - - {{'label.input.cash' | - translate}}
    -
    -
    - + +
    + + + + + + + +
    + {{'label.input.none' | + translate}}
    +
    + + {{'label.input.cash' | + translate}}
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.assets' | translate }}

    +
    + + + +
    + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.income' | translate }}

    +
    + + + +
    + + + + +
    + + + + +
    + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.expenses' | translate }}

    +
    + + + +
    +
    +

    {{ 'label.heading.liabilities' | translate }}

    +
    + + + +
    + + + + + +
    +

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}]


    +
    + - - - - - - - - - - - - - -
    -
    -

    {{ 'label.heading.assets' | translate }}

    -
    - - - -
    - - - - -
    - - - - -
    - - - - - - + - - - - - - - - -
    -
    -

    {{ 'label.heading.income' | translate }}

    -
    - - - - {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    - - - - -
    - - - - -
    - - - - - + - - - - - - -
    -
    -

    {{ 'label.heading.expenses' | translate }}

    -
    - - - - {{ 'label.button.add' | + translate }}
    -
    -

    {{ 'label.heading.liabilities' | translate }}

    -
    - - - -
    - - - - - - + + +
    -

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}]


    -
    - - - - + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}} + + + + + + + - - - - - + - - - - - - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    {{ 'label.button.add' | - translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    - - - - - -
    +
    +
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} + +
    - - - - - - - - - - - - - - - -
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - - - -
    -
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate - }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    +
    +
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} +
    + + + + + + + + + + + + + + + +
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + + + +
    +
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate + }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    - -
    + +
    diff --git a/app/views/products/createsavingproduct.html b/app/views/products/createsavingproduct.html index 2c34c1c0..03017cc9 100644 --- a/app/views/products/createsavingproduct.html +++ b/app/views/products/createsavingproduct.html @@ -1,478 +1,556 @@
    - +
    -
    - -
    - - - - + +
    - - - - - - - - - + +
    - - - - -
    - - - + + +
    + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    + + + + +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + +
    + + +
    + + +
    + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + +   + +
    + + +
    + + +
    + + +
    +
    + + + + + {{ 'label.button.add' | translate }} + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.amount}}{{charge.chargeTimeType.value}}
    +
    + + + + + + +
    + {{'label.input.none' | + translate}}
    +
    + + {{'label.input.cash' | + translate}}
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    {{"label.heading.assets" | translate}}

    + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + +
    +
    +

    {{"label.heading.liabilities" | translate}}

    + + + +
    + + + + +
    +
    +

    {{"label.heading.expenses" | translate}}

    + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    +

    {{"label.heading.income" | translate}}

    + + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + + + - -
    +

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}] +


    +
    + + + + + + + + + + - + + + + + + + + + - - - - - -
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | translate + }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    - - - - -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    - - - - - - - -
    - - -
    - - -
    - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - -   - -
    - - -
    - - -
    - - -
    -
    - - -
    - - {{ 'label.button.add' | translate }} -
    - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.amount}}{{charge.chargeTimeType.value}}
    -
    - - - - - - -
    - {{'label.input.none' | translate}}
    -
    - - {{'label.input.cash' | translate}}
    -
    -
    - - - - - - - - - - - - - - - -

    {{"label.heading.assets" | translate}}

    - - - -
    - - - -
    - - - - - - - - - - - - - - - - - - - - -

    {{"label.heading.liabilities" | translate}}

    - - - -
    - - - - -

    {{"label.heading.expenses" | translate}}

    - - - - - - - - - - - - - - - -
    - - - -
    - - - -

    {{"label.heading.income" | translate}}

    - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - - - - -
    - - - - - - - -
    -

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}]


    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    -
    -
    -
    -
    +
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    +
    +
    +
    +
    {{'label.button.cancel' | translate}} -
    +
    \ No newline at end of file diff --git a/app/views/products/editcharge.html b/app/views/products/editcharge.html index c4c4b414..d89ef8d1 100644 --- a/app/views/products/editcharge.html +++ b/app/views/products/editcharge.html @@ -11,63 +11,94 @@
    {{'label.heading.editcharge' | translate}}
    - + +
    -

    - + +
    - +
    - + +
    -
    +
    -
    - + +
    -
    - + +
    -
    - + +
    - +
    - + +
    - {{'label.input.months' | translate}} + {{'label.input.months' + | translate}}
    - + +
    @@ -75,6 +106,7 @@
    +
    +
    - + @@ -457,10 +458,11 @@ +
    - +
    - {{formData.displaySymbol}} @@ -539,13 +541,14 @@
    - +
    - +
    @@ -630,260 +633,270 @@
    - - - - - - - - - - - - - - - -
    -
    -

    {{ 'label.heading.assets' | translate }}

    -
    - - - -
    - - - - -
    - - - - -
    - - - - - - - - - - - - - - - - -
    -
    -

    {{ 'label.heading.income' | translate }}

    -
    - - - -
    - - - - -
    - - - - -
    - - - - - - - - - - - - - - -
    -
    -

    {{ 'label.heading.expenses' | translate }}

    -
    - - - -
    -
    -

    {{ 'label.heading.liabilities' | translate }}

    -
    - - - -
    - - - - - - - -
    -

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}] -


    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | - translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} -
    - - - - - - - - - - - - - - - -
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} -
    - - - - - - - - - - - - - - - -
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    -
    + + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.assets' | translate }}

    +
    + + + +
    + + + + +
    + + + + +
    + + + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.income' | translate }}

    +
    + + + +
    + + + + +
    + + + + +
    + + + + + + + + + + + + + + +
    +
    +

    {{ 'label.heading.expenses' | translate }}

    +
    + + + +
    +
    +

    {{ 'label.heading.liabilities' | translate }}

    +
    + + + +
    + + + + + + + +
    +

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}] +


    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | + translate }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} +
    + + + + + + + + + + + + + + + +
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }} +
    + + + + + + + + + + + + + + + +
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    +
    diff --git a/app/views/products/editsavingproduct.html b/app/views/products/editsavingproduct.html index 19ded750..2b026ad3 100644 --- a/app/views/products/editsavingproduct.html +++ b/app/views/products/editsavingproduct.html @@ -1,485 +1,563 @@ -
    -
    - -
    -
    - -
    - - - - + + + + +
    - - - - - - - - +
    +
    + +
    + + +
    +
    - - - - -
    + + + - -
    + + + + + + + + - - - - - -
    + + + + +
    - +
    - - - - -
    -
    - +
    + + + + +
    + + + +
    -
    - - - - - - - - - - - - - +
    +
    - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - -
    - - - - - - - -
    - - -
    - - -
    - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - -   - -
    - - -
    - - -
    - - -
    -
    + + + + + + + + + + - - - + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + +
    + + +
    + + +
    + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + + + +
    + +   + +
    + + +
    + + +
    + + +
    +
    - - - - - {{ 'label.button.add' | translate }} - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}
    + + +
    + + {{ 'label.button.add' | translate }} +
    + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.type' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.amount}}{{charge.chargeTimeType.value}}
    +
    + + + + + + +
    + {{'label.input.none' | + translate}}
    +
    + + {{'label.input.cash' | + translate}}
    +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +

    {{"label.heading.assets" | translate}}

    + + + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + +
    +
    +

    {{"label.heading.liabilities" | translate}}

    + + + +
    + + + + +
    +
    +

    {{"label.heading.expenses" | translate}}

    + + + + + + + + + + + + + + + +
    + + + +
    + + + +
    +
    +

    {{"label.heading.income" | translate}}

    + + + + + + + + + + + + + + +
    + + + + +
    + + + + +
    + + + + +
    + + + + + + + + + + + + + +
    +

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}] +


    +
    + + + + + + + + + + - - - - - - - - - - - - - -
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | translate + }}
    + + + - - - + - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}} {{'label.heading.amount' | translate}}{{'label.heading.collectedon' | translate}}{{'label.heading.fundsource' | translate}} {{'label.heading.actions' | translate}}
    {{charge.name}},{{charge.currency.displaySymbol}}{{charge.chargeCalculationType.value}}{{charge.amount}}{{charge.chargeTimeType.value}}
    -
    - - - - - - -
    - {{'label.input.none' | translate}}
    -
    - - {{'label.input.cash' | translate}}
    -
    -
    - - - - - - - - - - - - - - - - - -

    {{"label.heading.assets" | translate}}

    - - - -
    - - - -
    - - - - - - - - - - - - - - - - - - - - -

    {{"label.heading.liabilities" | translate}}

    - - - -
    - - - - -

    {{"label.heading.expenses" | translate}}

    - - - - - - - - - - - - - - - -
    - - - -
    - - - -

    {{"label.heading.income" | translate}}

    - - - - - - - - - - - - - - -
    - - - - -
    - - - - -
    - - - - -
    - - - - - - - -
    -

    {{'label.heading.advancedaccountingrules' | translate}}[{{showOrHideValue}}]


    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.configurefundsourcesforpaymentchannels' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.paymenttype' | translate}}{{'label.heading.fundsource' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    - - - - - - - - - - - - - - - -
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    - - - -
    -
    -
    -
    - -
    - - -
    - +
    + + + +
    +
    {{'label.heading.mapfeestoincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.fees' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    {{'label.heading.mappenaltiestospecificincomeaccounts' | translate}}
    {{ 'label.button.add' | translate }}
    + + + + + + + + + + + + + + + +
    {{'label.heading.penalty' | translate}}{{'label.heading.incomeaccount' | translate}}{{'label.heading.actions' | translate}}
    + + + +
    +
    +
    + + + +
    +
    + + +
    +
    \ No newline at end of file diff --git a/app/views/products/loanproducts.html b/app/views/products/loanproducts.html index 1354c0ab..362db8d9 100644 --- a/app/views/products/loanproducts.html +++ b/app/views/products/loanproducts.html @@ -4,28 +4,31 @@
  • {{'label.anchor.loanproducts' | translate}}
  • - - + +
    - - - - - - + + + + + + - - - - - - + + + + + +
    {{'label.heading.name' | translate}}{{'label.heading.shortname' | translate}}{{'label.heading.expirydate' | translate}}{{'label.heading.status' | translate}}
    {{'label.heading.name' | translate}}{{'label.heading.shortname' | translate}}{{'label.heading.expirydate' | translate}}{{'label.heading.status' | translate}}
    {{loanproduct.name}}{{loanproduct.shortName}}{{loanproduct.closeDate | DateFormat}}
    {{loanproduct.name}}{{loanproduct.shortName}}{{loanproduct.closeDate | DateFormat}}
    \ No newline at end of file diff --git a/app/views/products/productmix/addproductmix.html b/app/views/products/productmix/addproductmix.html index 734a16bc..f28b9c39 100644 --- a/app/views/products/productmix/addproductmix.html +++ b/app/views/products/productmix/addproductmix.html @@ -1,12 +1,16 @@ -
    +
    {{'label.heading.addproductmix' | translate}}
    +
    - +
    @@ -16,17 +20,24 @@
    -
    - + +
    +
    diff --git a/app/views/products/productmix/editproductmix.html b/app/views/products/productmix/editproductmix.html index 683207fd..54a46cf7 100644 --- a/app/views/products/productmix/editproductmix.html +++ b/app/views/products/productmix/editproductmix.html @@ -2,25 +2,34 @@

    {{ 'label.heading.editproductmix' | translate }}

    +
    -
    - + +
    +
    -

    +
    +
    {{ 'label.button.cancel' | translate }} diff --git a/app/views/products/productmix/productmix.html b/app/views/products/productmix/productmix.html index fd5863c6..975cbee9 100644 --- a/app/views/products/productmix/productmix.html +++ b/app/views/products/productmix/productmix.html @@ -3,7 +3,8 @@
  • {{'label.heading.productmix' | translate}}
  • diff --git a/app/views/products/productmix/viewproductmix.html b/app/views/products/productmix/viewproductmix.html index 65ec4708..25a19c52 100644 --- a/app/views/products/productmix/viewproductmix.html +++ b/app/views/products/productmix/viewproductmix.html @@ -17,8 +17,11 @@
    - {{ 'label.button.edit' | translate }} - + {{ 'label.button.edit' | translate }} +

    @@ -33,7 +36,7 @@
    - +
    @@ -45,7 +48,7 @@
    {{ 'label.heading.allowedproducts' | translate }}
    - +
    diff --git a/app/views/products/products.html b/app/views/products/products.html index 5dea6a6b..d23f84b9 100644 --- a/app/views/products/products.html +++ b/app/views/products/products.html @@ -1,26 +1,34 @@ \ No newline at end of file diff --git a/app/views/products/savingproducts.html b/app/views/products/savingproducts.html index 018ff7f5..99422e20 100644 --- a/app/views/products/savingproducts.html +++ b/app/views/products/savingproducts.html @@ -4,24 +4,27 @@
  • {{'label.anchor.savingproducts' | translate}}
  • - -
    {{ 'label.heading.restrictedproducts' | translate }}
    + +
    - - - - + + + + - - - - + + + +
    {{'label.heading.name' | translate}}{{'label.heading.shortname' | translate}}
    {{'label.heading.name' | translate}}{{'label.heading.shortname' | translate}}
    {{savingproduct.name}}{{savingproduct.shortName}}
    {{savingproduct.name}}{{savingproduct.shortName}}
    \ No newline at end of file diff --git a/app/views/products/viewcharge.html b/app/views/products/viewcharge.html index 17637427..5ba9db65 100644 --- a/app/views/products/viewcharge.html +++ b/app/views/products/viewcharge.html @@ -1,18 +1,22 @@
    -
    -
    \ No newline at end of file diff --git a/app/views/system/viewaudit.html b/app/views/system/viewaudit.html index f3ee103f..c576078a 100644 --- a/app/views/system/viewaudit.html +++ b/app/views/system/viewaudit.html @@ -5,8 +5,9 @@
  • {{'label.anchor.viewauditentry' | translate}}
  • {{'label.heading.viewauditentry' | translate}}

    +
    - +
    diff --git a/app/views/system/viewcheckerinbox.html b/app/views/system/viewcheckerinbox.html index dff63da9..8f9f0fe7 100644 --- a/app/views/system/viewcheckerinbox.html +++ b/app/views/system/viewcheckerinbox.html @@ -4,12 +4,22 @@
  • {{'label.anchor.viewcheckerinbox' | translate}}
  • - - + + +

    {{'label.heading.viewcheckerinbox' | translate}}

    +
    -
    {{'label.heading.id' | translate}}: {{details.id}} + + + +
    +
    diff --git a/app/views/system/viewcode.html b/app/views/system/viewcode.html index 44cc1bd8..babc8393 100644 --- a/app/views/system/viewcode.html +++ b/app/views/system/viewcode.html @@ -30,45 +30,62 @@ -

    {{code.name}}

    +

    {{code.name}}

    +
    - - + +
    {{'label.heading.id' | translate}}: {{details.id}}
    - - - - - - + + + + + + - - - - - + + + + +
    {{ 'label.heading.name' | translate }}{{ 'label.heading.position' | translate }}
    {{ 'label.heading.name' | translate }}{{ 'label.heading.position' | translate }}
    - {{codevalue.name}} - - - {{codevalue.position}} - - - - - -
    + {{codevalue.name}} + + + {{codevalue.position}} + + + + + +
    diff --git a/app/views/system/viewdatatable.html b/app/views/system/viewdatatable.html index 50a6c39c..67911684 100644 --- a/app/views/system/viewdatatable.html +++ b/app/views/system/viewdatatable.html @@ -3,15 +3,19 @@
    - {{'label.button.edit' | translate}} - + {{'label.button.edit' | translate}} +
    -

    {{ 'label.heading.datatablename' | translate }}-{{tableName}}

    -
    - - - - - -
    {{column.columnName}}:{{column.value}}
    -
    -
    -

    {{ 'label.heading.editdatatableentry' | translate }}

    -
    - {{ 'label.heading.datatablename' | translate }}-{{tableName}} -
    +

    {{ 'label.heading.datatablename' | translate }}-{{tableName}}

    +
    + + + + + +
    {{column.columnName}}:{{column.value}}
    +
    +
    +

    {{ 'label.heading.editdatatableentry' | translate }}

    +
    + {{ 'label.heading.datatablename' | translate }}-{{tableName}} +
    - + +
    - - - - + + +
    - + +
    - +
    {{ 'label.button.cancel' | translate }}
    -
    +
    diff --git a/app/views/system/viewreport.html b/app/views/system/viewreport.html index 2f53fe8f..b00ac9da 100644 --- a/app/views/system/viewreport.html +++ b/app/views/system/viewreport.html @@ -1,15 +1,18 @@ -
    - +
    +
    - {{'label.button.edit' | translate}} - + {{'label.button.edit' + | translate}} +
    -
    -

    {{report.reportName}}

    - - - - - - - - - - - - - - - - - - - - - +
    +

    {{report.reportName}}

    +
    {{ 'label.heading.reporttype' | translate }}{{report.reportType}}
    {{ 'label.heading.reportsubtype' | translate }}{{report.reportSubType}}
    {{ 'label.heading.reportcategory' | translate }}{{report.reportCategory}}
    {{ 'label.heading.corereport' | translate }}{{report.coreReport}}
    {{ 'label.heading.usereport' | translate }}{{report.useReport}}
    + + + + + + + + + + + + + + + + + + + +
    {{ 'label.heading.reporttype' | translate }}{{report.reportType}}
    {{ 'label.heading.reportsubtype' | translate }}{{report.reportSubType}}
    {{ 'label.heading.reportcategory' | translate }}{{report.reportCategory}}
    {{ 'label.heading.corereport' | translate }}{{report.coreReport}}
    {{ 'label.heading.usereport' | translate }}{{report.useReport}}
    -
    +
    \ No newline at end of file diff --git a/app/views/system/viewschedulerjob.html b/app/views/system/viewschedulerjob.html index 29474d0c..9c904cd4 100644 --- a/app/views/system/viewschedulerjob.html +++ b/app/views/system/viewschedulerjob.html @@ -1,36 +1,40 @@ -
    - +
    +
    - - - - - - - - - - - - - - +
    {{ 'label.heading.jobname' | translate }}{{job.displayName}}
    {{ 'label.heading.cronexpression' | translate }}{{job.cronExpression}}
    {{ 'label.heading.isactivejob' | translate }}{{job.active}}
    + + + + + + + + + + + + + - - -
    {{ 'label.heading.jobname' | translate }}{{job.displayName}}
    {{ 'label.heading.cronexpression' | translate }}{{job.cronExpression}}
    {{ 'label.heading.isactivejob' | translate }}{{job.active}}
    {{ 'label.heading.follow' | translate }}{{'label.anchor.clickheretogeneratecron' | translate}}
    -
    + {{'label.anchor.clickheretogeneratecron' | + translate}} + + +
    \ No newline at end of file diff --git a/app/views/system/viewschedulerjobhistory.html b/app/views/system/viewschedulerjobhistory.html index a1c96faa..15cc7847 100644 --- a/app/views/system/viewschedulerjobhistory.html +++ b/app/views/system/viewschedulerjobhistory.html @@ -4,27 +4,31 @@
  • {{'label.anchor.manageschedulerjobs' | translate}} /
  • {{'label.anchor.schedularjobhistory' | translate}}
  • - - + +
    - - - - - - + + + + + + - - - - - - + + + + + +
    {{'label.heading.version' | translate}}{{'label.heading.runstarttime' | translate}}{{'label.heading.status' | translate}}{{'label.heading.runtype' | translate}}
    {{'label.heading.version' | translate}}{{'label.heading.runstarttime' | translate}}{{'label.heading.status' | translate}}{{'label.heading.runtype' | translate}}
    {{history.version}}{{history.jobRunStartTime}}{{history.status}}{{history.triggerType}}
    {{history.version}}{{history.jobRunStartTime}}{{history.status}}{{history.triggerType}}
    \ No newline at end of file diff --git a/app/views/tasks.html b/app/views/tasks.html index d95797d4..c0361382 100644 --- a/app/views/tasks.html +++ b/app/views/tasks.html @@ -1,255 +1,288 @@
    -
    - {{'label.heading.pendingtasks' | translate}} - - -
    - - - - + + +
    - - - - +
    +{{'label.heading.pendingtasks' | translate}} + + +
    + + + + - - -
    + + + + - - + + -
    +
    +
    +
    + +
    +
    + + +
    +
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    - -
    -
    - {{'label.button.advancesearch' | translate}} +
    +
    + + +
    +
    - - -
    - + +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + + +
    + +
    +
    + {{'label.button.advancesearch' + | translate}} + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    {{'label.heading.id' | translate}}{{'label.heading.madeondate' | translate}}{{'label.heading.status' | translate}}{{'label.heading.user' | translate}}{{'label.heading.action' | translate}}{{'label.heading.entity' | translate}}
    {{data.id}}{{data.madeOnDate | DateFormat}}{{data.processingResult}}{{data.maker}}{{data.actionName}}{{data.entityName}}
    +
    + + +
    + + + + + + + +
    + + + +
    +
    + + + + + + +
    + {{officeName}} +
    + - - - - - - + + + - - - - - - - - + + + + +
    {{'label.heading.id' | translate}}{{'label.heading.madeondate' | translate}}{{'label.heading.status' | translate}}{{'label.heading.user' | translate}}{{'label.heading.action' | translate}}{{'label.heading.entity' | translate}}{{'label.heading.name' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.staff' | translate}}
    {{data.id}}{{data.madeOnDate | DateFormat}}{{data.processingResult}}{{data.maker}}{{data.actionName}}{{data.entityName}}
    {{client.displayName}}{{client.accountNo}}{{client.staffName}}
    - - - -
    - - - - - - - -
    - - - -
    -
    - - - - + + +
    - {{officeName}} -
    +
    + +
    + + + + + + + +
    + + + +
    +
    + + + + + + + + +
    {{office.name}}
    + + + + + + + + - - + + + + + + + +
    {{'label.heading.client' | translate}}{{'label.heading.loan' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.loanpurpose' | translate}}
    - - - - - - - - - - - - - - - - - -
    {{'label.heading.name' | translate}}{{'label.heading.accnum' | translate}}{{'label.heading.staff' | translate}}
    {{client.displayName}}{{client.accountNo}}{{client.staffName}}
    +
    {{loan.clientName}}{{loan.loanProductName}}({{loan.accountNo}}) {{loan.principal}}{{loan.loanPurposeName}}
    - - -
    - - - - - - - -
    - - - -
    -
    - - - - - - -
    {{office.name}}
    - - - - - - - - - - - - - - - - - - - -
    {{'label.heading.client' | translate}}{{'label.heading.loan' | translate}}{{'label.heading.amount' | translate}}{{'label.heading.loanpurpose' | translate}}
    {{loan.clientName}}{{loan.loanProductName}}({{loan.accountNo}}){{loan.principal}}{{loan.loanPurposeName}}
    -
    -
    - -
    - - - - - - -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - -
    {{'label.heading.client' | translate}}{{'label.heading.loanaccountnum' | translate}}{{'label.heading.loanproduct' | translate}}{{'label.heading.principal' | translate}}
    {{loan.clientName}}{{loan.accountNo}}{{loan.loanProductName}}{{loan.principal}}
    -
    -
    - - +
    +
    + +
    + + + + + + +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + +
    {{'label.heading.client' | translate}}{{'label.heading.loanaccountnum' | translate}}{{'label.heading.loanproduct' | translate}}{{'label.heading.principal' | translate}}
    {{loan.clientName}}{{loan.accountNo}}{{loan.loanProductName}}{{loan.principal}}
    +
    +
    + + diff --git a/app/views/templates/createtemplate.html b/app/views/templates/createtemplate.html index 9868203b..a8808c8b 100644 --- a/app/views/templates/createtemplate.html +++ b/app/views/templates/createtemplate.html @@ -1,84 +1,93 @@
    - +
    - -
    -
    -
    -
    - - - - - - - - - -
    - - - - - -
    - - -
    -
    -
    - - - - - - - - - - - - -
    - - - - - - - - - -
    - - - - - - - - - -
    -
    -
    - -
    -
    - -
    -
    -
    - - -
    {{templateKey}}
    -
    -
    -
    -
    -
    + +
    +
    +
    +
    + + + + + + + + + +
    + + + + + +
    + + +
    +
    +
    + + + + + + + + + + + + +
    + + + + + + + + + +
    + + + + + + + + + +
    +
    +
    + +
    +
    + +
    +
    +
    + + +
    {{templateKey}} +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/app/views/templates/edittemplate.html b/app/views/templates/edittemplate.html index 859630cc..9cda66c5 100644 --- a/app/views/templates/edittemplate.html +++ b/app/views/templates/edittemplate.html @@ -1,87 +1,102 @@ -
    -
    +
    +
    -
    - -
    -
    -
    -
    -
    - - - - - - - - - -
    - - - - - -
    - - -
    -
    -
    - - {{mapper}} - - - - - - - - - - -
    - - - - - - - - - -
    - - - - - - - - - -
    -
    -
    - -
    -
    - -
    -
    -
    - - -
    {{templateKey}}
    -
    -
    -
    -
    -
    -
    + +
    +
    +
    +
    +
    + + + + + + + + + +
    + + + + + +
    + + +
    +
    +
    + + {{mapper}} + + + + + + + + + + +
    + + + + + + + + + +
    + + + + + + + + + +
    +
    +
    + +
    +
    + +
    +
    +
    + + +
    {{templateKey}} +
    +
    +
    +
    +
    +
    +
    +
    diff --git a/app/views/templates/templates.html b/app/views/templates/templates.html index 06dcdf13..14133d5f 100644 --- a/app/views/templates/templates.html +++ b/app/views/templates/templates.html @@ -3,25 +3,27 @@
  • {{'label.anchor.templates' | translate}}
  • - - + +
    - - - - - + + + + + - - - - - + + + + +
    {{ 'label.heading.entity' | translate }}{{ 'label.heading.type' | translate }}{{ 'label.heading.name' | translate }}
    {{ 'label.heading.entity' | translate }}{{ 'label.heading.type' | translate }}{{ 'label.heading.name' | translate }}
    {{template.entity}}{{template.type}}{{template.name}}
    {{template.entity}}{{template.type}}{{template.name}}
    \ No newline at end of file diff --git a/app/views/templates/viewtemplate.html b/app/views/templates/viewtemplate.html index 6507fd94..f7b713b1 100644 --- a/app/views/templates/viewtemplate.html +++ b/app/views/templates/viewtemplate.html @@ -1,16 +1,19 @@ -
    -
    - -
    -
    - {{'label.button.edit' | translate}} - -
    +
    +
    + +
    +
    + {{'label.button.edit' + | translate}} + +
    +
    -
    -
    -

    {{template.name}}

    - - - - - - - - - - - - - -
    {{'label.heading.entity' | translate }}{{template.entity}}
    {{ 'label.heading.type' | translate }}{{template.type}}
    {{ 'label.heading.text' | translate }}
    -
    +
    +

    {{template.name}}

    + + + + + + + + + + + + + +
    {{'label.heading.entity' | translate }}{{template.entity}}
    {{ 'label.heading.type' | translate }}{{template.type}}
    {{ 'label.heading.text' | translate }}
    +
    \ No newline at end of file diff --git a/test/functional/demoTest.js b/test/functional/demoTest.js index df856da7..bfc5fbfd 100644 --- a/test/functional/demoTest.js +++ b/test/functional/demoTest.js @@ -1,18 +1,18 @@ define(['mifosX', 'services/HttpServiceProvider', 'services/ResourceFactoryProvider'], { - configure: function(url) { - - var baseUrl = url || "https://demo.openmf.com"; - mifosX.ng.services.config(['HttpServiceProvider', 'ResourceFactoryProvider', '$httpProvider', function(httpServiceProvider, resourceFactoryProvider, httpProvider) { - - // Below initialization has been moved to InitialTask.js - /*resourceFactoryProvider.setBaseUrl(baseUrl); - httpServiceProvider.addRequestInterceptor('demoUrl', function(config) { - return _.extend(config, {url: baseUrl + config.url}); - });*/ + configure: function (url) { - httpProvider.defaults.headers.common['X-Mifos-Platform-TenantId'] = 'default'; - }]).run(function($log) { - $log.warn("Using live demo server api -> " + baseUrl); - }); - } + var baseUrl = url || "https://demo.openmf.com"; + mifosX.ng.services.config(['HttpServiceProvider', 'ResourceFactoryProvider', '$httpProvider', function (httpServiceProvider, resourceFactoryProvider, httpProvider) { + + // Below initialization has been moved to InitialTask.js + /*resourceFactoryProvider.setBaseUrl(baseUrl); + httpServiceProvider.addRequestInterceptor('demoUrl', function(config) { + return _.extend(config, {url: baseUrl + config.url}); + });*/ + + httpProvider.defaults.headers.common['X-Mifos-Platform-TenantId'] = 'default'; + }]).run(function ($log) { + $log.warn("Using live demo server api -> " + baseUrl); + }); + } }); diff --git a/test/functional/scenarioTest.js b/test/functional/scenarioTest.js index 5b40ddd6..6b1a6682 100644 --- a/test/functional/scenarioTest.js +++ b/test/functional/scenarioTest.js @@ -1,29 +1,33 @@ define(['mifosX', 'angular-mocks'], { - configure: function(scenarioName) { - require(["test/testHelper", "test/scenarios/" + scenarioName + "_scenario"], function(testHelper, scenario) { - mifosX.ng.application.config(function($provide) { - $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); - $provide.decorator('$httpBackend', function($delegate) { - function proxy(method, url, data, callback, headers) { - var interceptor = function(returnCode, responseData, responseHeaders) { - var self = this, args = arguments; - if (_.isNumber(proxy.responseDelay) && proxy.responseDelay > 0) { - setTimeout(function() { callback.apply(self, args); }, proxy.responseDelay * 1000); - } else { - callback.apply(self, args); - } - }; - return $delegate.call(this, method, url, data, interceptor, headers); - }; - _.each(_.keys($delegate), function(key) {proxy[key] = $delegate[key];}); - return proxy; + configure: function (scenarioName) { + require(["test/testHelper", "test/scenarios/" + scenarioName + "_scenario"], function (testHelper, scenario) { + mifosX.ng.application.config(function ($provide) { + $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); + $provide.decorator('$httpBackend', function ($delegate) { + function proxy(method, url, data, callback, headers) { + var interceptor = function (returnCode, responseData, responseHeaders) { + var self = this, args = arguments; + if (_.isNumber(proxy.responseDelay) && proxy.responseDelay > 0) { + setTimeout(function () { + callback.apply(self, args); + }, proxy.responseDelay * 1000); + } else { + callback.apply(self, args); + } + }; + return $delegate.call(this, method, url, data, interceptor, headers); + }; + _.each(_.keys($delegate), function (key) { + proxy[key] = $delegate[key]; + }); + return proxy; + }); + }).run(function ($httpBackend, $log) { + $log.warn("Running test scenario: " + scenarioName); + $httpBackend.when("GET", /\.html$/).passThrough(); + scenario.stubServer(new testHelper.FakeServer($httpBackend)); + }); + angular.bootstrap(document, ["MifosX_Application"]); }); - }).run(function($httpBackend, $log) { - $log.warn("Running test scenario: " + scenarioName); - $httpBackend.when("GET", /\.html$/).passThrough(); - scenario.stubServer(new testHelper.FakeServer($httpBackend)); - }); - angular.bootstrap(document, ["MifosX_Application"]); - }); - } + } }); \ No newline at end of file diff --git a/test/functional/scenarios/role_management_scenario.js b/test/functional/scenarios/role_management_scenario.js index 5fccdfdf..0916fef4 100644 --- a/test/functional/scenarios/role_management_scenario.js +++ b/test/functional/scenarios/role_management_scenario.js @@ -1,16 +1,16 @@ -define(["test/scenarios/user_authentication_scenario"], function(authenticationScenario) { - var roles = [ - {id: 1, name: "Super User", description: "This guy is the suuuper user"}, - {id: 2, name: "Branch Manager", description: "This guy is the branch manager"}, - {id: 3, name: "Simple User", description: "This guy is just a random joe"}, - ]; +define(["test/scenarios/user_authentication_scenario"], function (authenticationScenario) { + var roles = [ + {id: 1, name: "Super User", description: "This guy is the suuuper user"}, + {id: 2, name: "Branch Manager", description: "This guy is the branch manager"}, + {id: 3, name: "Simple User", description: "This guy is just a random joe"}, + ]; - return { - stubServer: function(fakeServer) { - authenticationScenario.stubServer(fakeServer); - fakeServer.get(/\/roles/, function(){ - return {content: roles} - }); - } - }; + return { + stubServer: function (fakeServer) { + authenticationScenario.stubServer(fakeServer); + fakeServer.get(/\/roles/, function () { + return {content: roles} + }); + } + }; }); diff --git a/test/functional/scenarios/user_authentication_scenario.js b/test/functional/scenarios/user_authentication_scenario.js index 22fae6b5..a7112453 100644 --- a/test/functional/scenarios/user_authentication_scenario.js +++ b/test/functional/scenarios/user_authentication_scenario.js @@ -1,71 +1,79 @@ -define([], function() { - var users = { - mifos: {userId: 1, roles: [{id: 1, name: "Super User"}]}, - joe: {userId: 2, roles: [{id: 2, name: "Branch Manager"}]}, - jack: {userId: 3, roles: [{id: 3, name: "Funder"}]} - }; - - var authenticationSuccess = function(username, userDetails) { - return { - username: username, - userId: userDetails.userId, - base64EncodedAuthenticationKey: "bWlmb3M6cGFzc3dvcmQ=", - authenticated: true, - staffId: 1, - staffDisplayName: "Director, Program", - organisationalRole: { - id: 100, - code: "staffOrganisationalRoleType.programDirector", - value: "Program Director" - }, - roles: userDetails.roles, - permissions: [ - "ALL_FUNCTIONS" - ] +define([], function () { + var users = { + mifos: {userId: 1, roles: [ + {id: 1, name: "Super User"} + ]}, + joe: {userId: 2, roles: [ + {id: 2, name: "Branch Manager"} + ]}, + jack: {userId: 3, roles: [ + {id: 3, name: "Funder"} + ]} }; - }; - var authenticationFailure = function() { - return { - developerMessage: "Invalid authentication details were passed in api request.", - developerDocLink: "https://github.com/openMF/mifosx/wiki/HTTP-API-Error-codes", - httpStatusCode: "401", - defaultUserMessage: "Unauthenticated. Please login.", - userMessageGlobalisationCode: "error.msg.not.authenticated", - errors: [] - }; - }; - - return { - stubServer: function(fakeServer) { - fakeServer.post(/\/authentication\?username=(\w+)&password=(.+)/, function(match) { - var username = match[1]; - var password = match[2]; - if (users[username] && password === 'password') { - return {content: authenticationSuccess(username, users[username]), delay: 2}; - } - return {returnCode: 401, content: authenticationFailure(), delay: 3}; - }); - - fakeServer.get(/\/users\/(\w+)/, function(match) { + var authenticationSuccess = function (username, userDetails) { return { - content: { - id: match[1], - username: "mifos", - officeId: 1, - officeName: "Head Office", - firstname: "App", - lastname: "Administrator", - email: "demomfi@mifos.org", - availableRoles: [], - roles: [{ - id: 1, - name: "Super user", - description: "This role provides all application permissions." - }] - } + username: username, + userId: userDetails.userId, + base64EncodedAuthenticationKey: "bWlmb3M6cGFzc3dvcmQ=", + authenticated: true, + staffId: 1, + staffDisplayName: "Director, Program", + organisationalRole: { + id: 100, + code: "staffOrganisationalRoleType.programDirector", + value: "Program Director" + }, + roles: userDetails.roles, + permissions: [ + "ALL_FUNCTIONS" + ] }; - }); - } - }; + }; + + var authenticationFailure = function () { + return { + developerMessage: "Invalid authentication details were passed in api request.", + developerDocLink: "https://github.com/openMF/mifosx/wiki/HTTP-API-Error-codes", + httpStatusCode: "401", + defaultUserMessage: "Unauthenticated. Please login.", + userMessageGlobalisationCode: "error.msg.not.authenticated", + errors: [] + }; + }; + + return { + stubServer: function (fakeServer) { + fakeServer.post(/\/authentication\?username=(\w+)&password=(.+)/, function (match) { + var username = match[1]; + var password = match[2]; + if (users[username] && password === 'password') { + return {content: authenticationSuccess(username, users[username]), delay: 2}; + } + return {returnCode: 401, content: authenticationFailure(), delay: 3}; + }); + + fakeServer.get(/\/users\/(\w+)/, function (match) { + return { + content: { + id: match[1], + username: "mifos", + officeId: 1, + officeName: "Head Office", + firstname: "App", + lastname: "Administrator", + email: "demomfi@mifos.org", + availableRoles: [], + roles: [ + { + id: 1, + name: "Super user", + description: "This role provides all application permissions." + } + ] + } + }; + }); + } + }; }); diff --git a/test/functional/scenarios/user_management_scenario.js b/test/functional/scenarios/user_management_scenario.js index afe29715..e7195b0e 100644 --- a/test/functional/scenarios/user_management_scenario.js +++ b/test/functional/scenarios/user_management_scenario.js @@ -1,37 +1,38 @@ -define(["test/scenarios/user_authentication_scenario"], function(authenticationScenario) { - var createUsers = function(number) { - var users = []; - for (var i = 1 ; i <= number; i++) { - users.push({ - id: i, - username: "username_" + i, - officeId: 1000 + i, - officeName: "officename_" + i, - firstname: "firstname_" + i, - lastname: "lastname_" + i, - email: "testuser_" + i + "@mifos.org" - }); +define(["test/scenarios/user_authentication_scenario"], function (authenticationScenario) { + var createUsers = function (number) { + var users = []; + for (var i = 1; i <= number; i++) { + users.push({ + id: i, + username: "username_" + i, + officeId: 1000 + i, + officeName: "officename_" + i, + firstname: "firstname_" + i, + lastname: "lastname_" + i, + email: "testuser_" + i + "@mifos.org" + }); + } + ; + return users; }; - return users; - }; - var roles = [ - {id: 1, name: "Super User"}, - {id: 2, name: "Branch Manager"}, - {id: 3, name: "Simple User"} - ]; - var offices = [ - {id: 1, name: "Office 1"}, - {id: 2, name: "Office 2"}, - {id: 3, name: "Office 3"} - ]; + var roles = [ + {id: 1, name: "Super User"}, + {id: 2, name: "Branch Manager"}, + {id: 3, name: "Simple User"} + ]; + var offices = [ + {id: 1, name: "Office 1"}, + {id: 2, name: "Office 2"}, + {id: 3, name: "Office 3"} + ]; - return { - stubServer: function(fakeServer) { - authenticationScenario.stubServer(fakeServer); - fakeServer.get(/\/users?.*/, { content: createUsers(25), delay: 3 }); - fakeServer.get(/\/roles/, { content: roles, delay: 1 }); - fakeServer.get(/\/offices/, { content: offices, delay: 1 }); - fakeServer.post(/\/users/, {returnCode: 201, delay: 2}); - } - }; + return { + stubServer: function (fakeServer) { + authenticationScenario.stubServer(fakeServer); + fakeServer.get(/\/users?.*/, { content: createUsers(25), delay: 3 }); + fakeServer.get(/\/roles/, { content: roles, delay: 1 }); + fakeServer.get(/\/offices/, { content: offices, delay: 1 }); + fakeServer.post(/\/users/, {returnCode: 201, delay: 2}); + } + }; }); diff --git a/test/functional/testHelper.js b/test/functional/testHelper.js index f675836f..ccde9cd7 100644 --- a/test/functional/testHelper.js +++ b/test/functional/testHelper.js @@ -1,26 +1,26 @@ define(['underscore'], { - FakeServer: function(httpBackend) { - var getResponseOptions = function(urlMatch, requestData, requestHeaders, response) { - var options = response; - if (_.isFunction(response)) { - options = response.call(null, urlMatch, requestData, requestHeaders); - } - return _.defaults(options, { - returnCode: 200, - content: {}, - headers: {}, - delay: 0 - }); - }; + FakeServer: function (httpBackend) { + var getResponseOptions = function (urlMatch, requestData, requestHeaders, response) { + var options = response; + if (_.isFunction(response)) { + options = response.call(null, urlMatch, requestData, requestHeaders); + } + return _.defaults(options, { + returnCode: 200, + content: {}, + headers: {}, + delay: 0 + }); + }; - _.each(['get', 'post'], function(method) { - this[method] = function(urlRegex, response) { - httpBackend["when" + method.toUpperCase()](urlRegex).respond(function(method, url, data, headers) { - var responseOptions = getResponseOptions(url.match(urlRegex), data, headers, response); - httpBackend.responseDelay = responseOptions.delay; - return [responseOptions.returnCode, responseOptions.content, responseOptions.headers]; - }); - } - }, this); - } + _.each(['get', 'post'], function (method) { + this[method] = function (urlRegex, response) { + httpBackend["when" + method.toUpperCase()](urlRegex).respond(function (method, url, data, headers) { + var responseOptions = getResponseOptions(url.match(urlRegex), data, headers, response); + httpBackend.responseDelay = responseOptions.delay; + return [responseOptions.returnCode, responseOptions.content, responseOptions.headers]; + }); + } + }, this); + } }); \ No newline at end of file diff --git a/test/functional/testInitializer.js b/test/functional/testInitializer.js index f0c12680..305e35b9 100644 --- a/test/functional/testInitializer.js +++ b/test/functional/testInitializer.js @@ -1,13 +1,13 @@ -define(['test/demoTest', 'test/scenarioTest'], function(demoTest, scenarioTest) { - var protocol = window.location.protocol; - if (protocol === 'file:') { - var match = /\?test_scenario=(\w+)/.exec(window.location.search); - if (match) { - scenarioTest.configure(match[1]); - return true; - } else { - demoTest.configure(); +define(['test/demoTest', 'test/scenarioTest'], function (demoTest, scenarioTest) { + var protocol = window.location.protocol; + if (protocol === 'file:') { + var match = /\?test_scenario=(\w+)/.exec(window.location.search); + if (match) { + scenarioTest.configure(match[1]); + return true; + } else { + demoTest.configure(); + } } - } - return false; + return false; }); diff --git a/test/spec/controllers/LoginFormControllerSpec.js b/test/spec/controllers/LoginFormControllerSpec.js index 774d5f49..3eb7fe2a 100644 --- a/test/spec/controllers/LoginFormControllerSpec.js +++ b/test/spec/controllers/LoginFormControllerSpec.js @@ -1,37 +1,37 @@ -describe("LoginFormController", function() { - var eventListener; - beforeEach(function() { - this.scope = jasmine.createSpyObj("$scope", ['$on']); - this.scope.$on.andCallFake(function(event, listener) { - eventListener = listener; - }); - this.authenticationService = jasmine.createSpyObj("AuthenticationService", ['$on']); - $ = jQuery = jasmine.createSpy('jQuery'); - $.keypress = jasmine.createSpy('$.keypress()'); - $.andCallFake(function(selector) { - return $; +describe("LoginFormController", function () { + var eventListener; + beforeEach(function () { + this.scope = jasmine.createSpyObj("$scope", ['$on']); + this.scope.$on.andCallFake(function (event, listener) { + eventListener = listener; + }); + this.authenticationService = jasmine.createSpyObj("AuthenticationService", ['$on']); + $ = jQuery = jasmine.createSpy('jQuery'); + $.keypress = jasmine.createSpy('$.keypress()'); + $.andCallFake(function (selector) { + return $; + }); + + this.controller = new mifosX.controllers.LoginFormController(this.scope, this.authenticationService); }); - this.controller = new mifosX.controllers.LoginFormController(this.scope, this.authenticationService); - }); - - it("should initialise the login credentials", function() { - expect(this.scope.loginCredentials).toEqual({}); - }); - - it("should initialise the authenticationFailed flag", function() { - expect(this.scope.authenticationFailed).toBeFalsy(); - }); - - it("should listen to 'UserAuthenticationFailureEvent'", function() { - expect(this.scope.$on).toHaveBeenCalledWith("UserAuthenticationFailureEvent", jasmine.any(Function)); - }); - - describe("on receving 'UserAuthenticationFailureEvent'", function() { - it("should set the authenticationFailed flag to true", function() { - eventListener({}); - - expect(this.scope.authenticationFailed).toBeTruthy(); + it("should initialise the login credentials", function () { + expect(this.scope.loginCredentials).toEqual({}); + }); + + it("should initialise the authenticationFailed flag", function () { + expect(this.scope.authenticationFailed).toBeFalsy(); + }); + + it("should listen to 'UserAuthenticationFailureEvent'", function () { + expect(this.scope.$on).toHaveBeenCalledWith("UserAuthenticationFailureEvent", jasmine.any(Function)); + }); + + describe("on receving 'UserAuthenticationFailureEvent'", function () { + it("should set the authenticationFailed flag to true", function () { + eventListener({}); + + expect(this.scope.authenticationFailed).toBeTruthy(); + }); }); - }); }); diff --git a/test/spec/controllers/MainControllerSpec.js b/test/spec/controllers/MainControllerSpec.js index a653a2b8..43655d15 100644 --- a/test/spec/controllers/MainControllerSpec.js +++ b/test/spec/controllers/MainControllerSpec.js @@ -1,76 +1,78 @@ -describe("MainController", function() { - var eventListener, sessionCallback; - beforeEach(function() { - this.scope = jasmine.createSpyObj("$scope", ['$on', '$watch']); - this.scope.$on.andCallFake(function(event, listener) { eventListener = listener; }); - this.location = jasmine.createSpyObj("$location", ['path', 'replace']); - this.location.path.andReturn(this.location); - this.sessionManager = jasmine.createSpyObj("sessionManager", ['get', 'clear', 'restore']); - this.sessionManager.restore.andCallFake(function(callback) { - sessionCallback = callback; - }); - this.keyboardManager= jasmine.createSpyObj('keyboardManager',['bind']); +describe("MainController", function () { + var eventListener, sessionCallback; + beforeEach(function () { + this.scope = jasmine.createSpyObj("$scope", ['$on', '$watch']); + this.scope.$on.andCallFake(function (event, listener) { + eventListener = listener; + }); + this.location = jasmine.createSpyObj("$location", ['path', 'replace']); + this.location.path.andReturn(this.location); + this.sessionManager = jasmine.createSpyObj("sessionManager", ['get', 'clear', 'restore']); + this.sessionManager.restore.andCallFake(function (callback) { + sessionCallback = callback; + }); + this.keyboardManager = jasmine.createSpyObj('keyboardManager', ['bind']); - this.translate = jasmine.createSpyObj("translate", ["uses"]); - this.rootScope = jasmine.createSpy(); - this.localStorageService = jasmine.createSpyObj("localStorageService", ["get", "add"]); - this.idle = jasmine.createSpyObj("$idle", ['watch','unwatch']); + this.translate = jasmine.createSpyObj("translate", ["uses"]); + this.rootScope = jasmine.createSpy(); + this.localStorageService = jasmine.createSpyObj("localStorageService", ["get", "add"]); + this.idle = jasmine.createSpyObj("$idle", ['watch', 'unwatch']); - this.controller = new mifosX.controllers.MainController(this.scope, - this.location, - this.sessionManager, - this.translate, - this.rootScope, - this.localStorageService, - this.keyboardManager, - this.idle); - }); - - describe("on initialisation", function() { - it("should listen to 'UserAuthenticationSuccessEvent'", function() { - expect(this.scope.$on).toHaveBeenCalledWith("UserAuthenticationSuccessEvent", jasmine.any(Function)); + this.controller = new mifosX.controllers.MainController(this.scope, + this.location, + this.sessionManager, + this.translate, + this.rootScope, + this.localStorageService, + this.keyboardManager, + this.idle); }); - it("should restore the session", function() { - sessionCallback("test_session"); - expect(this.scope.currentSession).toEqual("test_session"); + describe("on initialisation", function () { + it("should listen to 'UserAuthenticationSuccessEvent'", function () { + expect(this.scope.$on).toHaveBeenCalledWith("UserAuthenticationSuccessEvent", jasmine.any(Function)); + }); + + it("should restore the session", function () { + sessionCallback("test_session"); + expect(this.scope.currentSession).toEqual("test_session"); + }); + + it("should set the dateformat in the scope", function () { + expect(this.scope.dateformat).toEqual("dd MMMM yyyy"); + expect(this.scope.df).toEqual("dd MMMM yyyy"); + }); }); - it("should set the dateformat in the scope" , function() { - expect(this.scope.dateformat).toEqual("dd MMMM yyyy"); - expect(this.scope.df).toEqual("dd MMMM yyyy"); - }); - }); + describe("on receving 'UserAuthenticationSuccessEvent'", function () { + beforeEach(function () { + this.sessionManager.get.andReturn("test_session"); - describe("on receving 'UserAuthenticationSuccessEvent'", function() { - beforeEach(function() { - this.sessionManager.get.andReturn("test_session"); + eventListener({}, "test_data"); + }); - eventListener({}, "test_data"); + it("should start a new session", function () { + expect(this.sessionManager.get).toHaveBeenCalledWith("test_data"); + expect(this.scope.currentSession).toEqual("test_session"); + }); + it("should redirect to the home page", function () { + expect(this.location.path).toHaveBeenCalledWith('/home'); + }); }); - it("should start a new session", function() { - expect(this.sessionManager.get).toHaveBeenCalledWith("test_data"); - expect(this.scope.currentSession).toEqual("test_session"); - }); - it("should redirect to the home page", function() { - expect(this.location.path).toHaveBeenCalledWith('/home'); - }); - }); + describe("User logout", function () { + beforeEach(function () { + this.sessionManager.clear.andReturn("test_session"); - describe("User logout", function() { - beforeEach(function() { - this.sessionManager.clear.andReturn("test_session"); + this.scope.logout(); + }); - this.scope.logout(); + it("should clear the session", function () { + expect(this.sessionManager.clear).toHaveBeenCalled(); + expect(this.scope.currentSession).toEqual("test_session"); + }); + it("should redirect to the start page", function () { + expect(this.location.path).toHaveBeenCalledWith('/'); + }); }); - - it("should clear the session", function() { - expect(this.sessionManager.clear).toHaveBeenCalled(); - expect(this.scope.currentSession).toEqual("test_session"); - }); - it("should redirect to the start page", function() { - expect(this.location.path).toHaveBeenCalledWith('/'); - }); - }); }); \ No newline at end of file diff --git a/test/spec/controllers/RoleControllerSpec.js b/test/spec/controllers/RoleControllerSpec.js index 02393dc3..877dd5ee 100644 --- a/test/spec/controllers/RoleControllerSpec.js +++ b/test/spec/controllers/RoleControllerSpec.js @@ -1,20 +1,20 @@ -describe("RoleController", function() { - var resourceCallback; +describe("RoleController", function () { + var resourceCallback; - beforeEach(function() { - this.scope = {}; - this.resourceFactory = { roleResource: { - getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function(params, callback) { - resourceCallback = callback; - }) - }}; + beforeEach(function () { + this.scope = {}; + this.resourceFactory = { roleResource: { + getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function (params, callback) { + resourceCallback = callback; + }) + }}; - this.controller = new mifosX.controllers.RoleController(this.scope, this.resourceFactory); - }); + this.controller = new mifosX.controllers.RoleController(this.scope, this.resourceFactory); + }); + + it("should get all roles", function () { + resourceCallback(['role1', 'role2']); + expect(this.scope.roles).toEqual(['role1', 'role2']); + }); - it("should get all roles", function() { - resourceCallback(['role1', 'role2']); - expect(this.scope.roles).toEqual(['role1','role2']); - }); - }); diff --git a/test/spec/controllers/SearchControllerSpec.js b/test/spec/controllers/SearchControllerSpec.js index 4b621bea..3cb5af4c 100644 --- a/test/spec/controllers/SearchControllerSpec.js +++ b/test/spec/controllers/SearchControllerSpec.js @@ -1,120 +1,120 @@ -describe("SearchController", function() { - var resourceCallback, clientGet, clientAccountGet, groupGet, groupAccountGet,centerGet, centerAccountGet; - beforeEach(function() { +describe("SearchController", function () { + var resourceCallback, clientGet, clientAccountGet, groupGet, groupAccountGet, centerGet, centerAccountGet; + beforeEach(function () { this.scope = {}; - this.route =jasmine.createSpyObj("$routeParams", ['query']); + this.route = jasmine.createSpyObj("$routeParams", ['query']); this.resourceFactory = { globalSearch: { - search: jasmine.createSpy('globalSearch.search()').andCallFake(function(query,callback) { + search: jasmine.createSpy('globalSearch.search()').andCallFake(function (query, callback) { resourceCallback = callback; })}, clientResource: { - get: jasmine.createSpy('clientResources.get()').andCallFake(function(params,callback) { + get: jasmine.createSpy('clientResources.get()').andCallFake(function (params, callback) { clientGet = callback; })}, - clientAccountResource : { - get: jasmine.createSpy('clientAccountResources.get()').andCallFake(function(params,callback){ - clientAccountGet=callback; + clientAccountResource: { + get: jasmine.createSpy('clientAccountResources.get()').andCallFake(function (params, callback) { + clientAccountGet = callback; })}, groupResource: { - get: jasmine.createSpy('groupResources.get()').andCallFake(function(params, callback) { + get: jasmine.createSpy('groupResources.get()').andCallFake(function (params, callback) { groupGet = callback; })}, - groupAccountResource : { - get: jasmine.createSpy('groupAccountResources.get()').andCallFake(function(params, callback){ - groupAccountGet=callback; + groupAccountResource: { + get: jasmine.createSpy('groupAccountResources.get()').andCallFake(function (params, callback) { + groupAccountGet = callback; })}, centerResource: { - get: jasmine.createSpy('centerResources.get()').andCallFake(function(params, callback) { + get: jasmine.createSpy('centerResources.get()').andCallFake(function (params, callback) { centerGet = callback; })}, - centerAccountResource : { - get: jasmine.createSpy('centerAccountResources.get()').andCallFake(function(params, callback){ - centerAccountGet=callback; + centerAccountResource: { + get: jasmine.createSpy('centerAccountResources.get()').andCallFake(function (params, callback) { + centerAccountGet = callback; })} } this.controller = new mifosX.controllers.SearchController(this.scope, this.route, this.resourceFactory); }); - it("should populate the search results on loading", function(){ - resourceCallback({"data":"searchResults"}); + it("should populate the search results on loading", function () { + resourceCallback({"data": "searchResults"}); expect(this.resourceFactory.globalSearch.search).toHaveBeenCalled(); expect(this.scope.searchResults.data).toBe("searchResults"); }); - describe("when a clientId is selected",function(){ - beforeEach(function() { + describe("when a clientId is selected", function () { + beforeEach(function () { this.scope.getClientDetails("123"); - clientGet({'clientId':'123'}); + clientGet({'clientId': '123'}); }); - it("should set the clientId to selected when the clientId is selected",function(){ + it("should set the clientId to selected when the clientId is selected", function () { expect(this.scope.selected).toBe("123"); }); - it("should set the group to blank",function(){ + it("should set the group to blank", function () { expect(this.scope.group).toBe(""); }); - it("should set the center to blank",function(){ + it("should set the center to blank", function () { expect(this.scope.center).toBe(""); }); - it("should get the client data",function(){ + it("should get the client data", function () { expect(this.scope.client.clientId).toBe("123"); }); - it("should get the client account data",function(){ - clientAccountGet({'account':'1'}); + it("should get the client account data", function () { + clientAccountGet({'account': '1'}); expect(this.scope.clientAccounts.account).toBe("1"); }); }); - describe("when a groupId is selected",function(){ - beforeEach(function(){ + describe("when a groupId is selected", function () { + beforeEach(function () { this.scope.getGroupDetails("10"); - groupGet({'groupId':'10'}); + groupGet({'groupId': '10'}); }); - it("should set the groupID to selected when the groupID is selected", function(){ + it("should set the groupID to selected when the groupID is selected", function () { expect(this.scope.selected).toBe("10"); }); - it("should set the client to blank",function(){ + it("should set the client to blank", function () { expect(this.scope.client).toBe(""); }); - it("should set the center to blank",function(){ + it("should set the center to blank", function () { expect(this.scope.center).toBe(""); }); - it("should get the group information",function(){ + it("should get the group information", function () { expect(this.scope.group.groupId).toBe("10"); }); - it("should get the group account information",function(){ - groupAccountGet({'account':'2'}); + it("should get the group account information", function () { + groupAccountGet({'account': '2'}); expect(this.scope.groupAccounts.account).toBe("2"); }); }); - describe("when a centerId is selected",function(){ - beforeEach(function(){ + describe("when a centerId is selected", function () { + beforeEach(function () { this.scope.getCenterDetails("001"); - centerGet({"centerId":"001"}); + centerGet({"centerId": "001"}); }); - it("should set the centerID to selected when the centerID is selected", function(){ + it("should set the centerID to selected when the centerID is selected", function () { expect(this.scope.selected).toBe("001"); }); - it("should set the client to blank",function(){ + it("should set the client to blank", function () { expect(this.scope.client).toBe(""); }); - it("should set the group to blank",function(){ + it("should set the group to blank", function () { expect(this.scope.group).toBe(""); }); - it("should get the center information",function(){ + it("should get the center information", function () { expect(this.scope.center.centerId).toBe("001"); }); - it("should get the center account information",function(){ - centerAccountGet({"account":"3"}); + it("should get the center account information", function () { + centerAccountGet({"account": "3"}); expect(this.scope.centerAccounts.account).toBe("3"); }); }); diff --git a/test/spec/controllers/client/ClientControllerSpec.js b/test/spec/controllers/client/ClientControllerSpec.js index 61d0176a..6629eb46 100644 --- a/test/spec/controllers/client/ClientControllerSpec.js +++ b/test/spec/controllers/client/ClientControllerSpec.js @@ -1,10 +1,10 @@ -describe("ClientController", function() { +describe("ClientController", function () { var resourceCallback; - beforeEach(function() { + beforeEach(function () { this.scope = jasmine.createSpyObj("$scope", ['$clients']); this.resourceFactory = {clientResource: { - getAllClients: jasmine.createSpy('clientResource.getAllClients()').andCallFake(function(callback) { + getAllClients: jasmine.createSpy('clientResource.getAllClients()').andCallFake(function (callback) { resourceCallback = callback; }) }}; @@ -14,7 +14,7 @@ describe("ClientController", function() { this.controller = new mifosX.controllers.ClientController(this.scope, this.resourceFactory, this.paginatorService); }); - it("should populate the scope with paginated clients", function() { + it("should populate the scope with paginated clients", function () { expect(this.paginatorService.paginate).toHaveBeenCalled(); }); }); \ No newline at end of file diff --git a/test/spec/controllers/user/UserFormControllerSpec.js b/test/spec/controllers/user/UserFormControllerSpec.js index b2781349..2fae4dc9 100644 --- a/test/spec/controllers/user/UserFormControllerSpec.js +++ b/test/spec/controllers/user/UserFormControllerSpec.js @@ -1,130 +1,132 @@ -describe("UserFormController", function() { - var eventCallback; - beforeEach(function() { - this.scope = { - $emit: jasmine.createSpy("$scope.$emit()"), - $on: jasmine.createSpy("$scope.$on()").andCallFake(function(eventName, callback) { eventCallback = callback; }) - }; - this.resourceFactory = { - officeResource: { - getAllOffices: jasmine.createSpy('officeResource.getAllOffices()').andCallFake(function(params, callback) { - callback(['test_office1', 'test_office2']); - }) - }, - roleResource: { - getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function(params, callback) { - callback(['test_role1', 'test_role2']); - }) - }, - userResource: jasmine.createSpy('userResource') - }; - - this.controller = new mifosX.controllers.UserFormController(this.scope, this.resourceFactory); - }); - - describe("Initialization", function() { - it("should initialize the offices collection", function() { - expect(this.scope.offices).toEqual(['test_office1', 'test_office2']); - }); - it("should initialize the roles collection", function() { - expect(this.scope.roles).toEqual(['test_role1', 'test_role2']); - }); - }); - - describe("When form dialog opens", function() { - it("should listen to the 'OpenUserFormDialog' event", function() { - expect(this.scope.$on).toHaveBeenCalledWith('OpenUserFormDialog', jasmine.any(Function)); - }); - it("should reset the form data", function() { - eventCallback(); - - expect(this.scope.userFormData).toEqual({selectedRoles: {}, sendPasswordToEmail: false}); - expect(this.scope.formInError).toBeFalsy(); - expect(this.scope.errors).toEqual([]); - }); - }); - - describe("Form actions", function() { - var userResource, onSuccessCallback, onErrorCallback; - beforeEach(function() { - userResource = jasmine.createSpyObj('userResource', ['$save']); - userResource.$save.andCallFake(function(params, success, error) { - onSuccessCallback = success; - onErrorCallback = error; - }); - this.resourceFactory.userResource.andReturn(userResource); - }); - - it("should emit the 'CloseUserForm' when cancelling the form", function() { - this.scope.cancelUserForm(); - - expect(this.scope.$emit).toHaveBeenCalledWith('CloseUserForm'); - }); - - describe("Save user", function() { - var expectedUserParams; - beforeEach(function() { - this.scope.userFormData = { - username: 'test_username', - firstname: 'test_firstname', - lastname: 'test_lastname', - email: 'test_email', - office: {id: 'test_office'}, - sendPasswordToEmail: true, - selectedRoles: {'123': {}, '456': {}} +describe("UserFormController", function () { + var eventCallback; + beforeEach(function () { + this.scope = { + $emit: jasmine.createSpy("$scope.$emit()"), + $on: jasmine.createSpy("$scope.$on()").andCallFake(function (eventName, callback) { + eventCallback = callback; + }) + }; + this.resourceFactory = { + officeResource: { + getAllOffices: jasmine.createSpy('officeResource.getAllOffices()').andCallFake(function (params, callback) { + callback(['test_office1', 'test_office2']); + }) + }, + roleResource: { + getAllRoles: jasmine.createSpy('roleResource.getAllRoles()').andCallFake(function (params, callback) { + callback(['test_role1', 'test_role2']); + }) + }, + userResource: jasmine.createSpy('userResource') }; - expectedUserParams = _.extend( - _.pick(this.scope.userFormData, ['username', 'firstname', 'lastname', 'email', 'sendPasswordToEmail']), - { officeId: 'test_office', roles: [123, 456] } - ); - - this.scope.submitUserForm(); - }); - it("should emit the 'SubmitUserFormStart' event", function() { - expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormStart'); - }); - it("should create and save a new user resource", function() { - expect(this.resourceFactory.userResource).toHaveBeenCalledWith(expectedUserParams); - expect(userResource.$save).toHaveBeenCalledWith({}, jasmine.any(Function), jasmine.any(Function)); - }); - - describe("User save error handler", function() { - beforeEach(function() { - this.scope.formInError = false; - this.scope.errors = []; - - onErrorCallback({data: {errors: 'test_errors'}}); - }); - - it("should flag the form in error", function() { - expect(this.scope.formInError).toBeTruthy(); - }); - it("should put the errors in the scope", function() { - expect(this.scope.errors).toEqual('test_errors'); - }); - it("should emit the 'SubmitUserFormError' event", function() { - expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormError'); - }); - }); - - describe("User save success handler", function() { - var addedUser, existingUser; - beforeEach(function() { - existingUser = {id: 'another_userId'}; - this.scope.users = [existingUser]; - addedUser = _.extend(expectedUserParams, {id: 'test_userId'}); - - onSuccessCallback({resourceId: 'test_userId'}); - }); - - it("should add the user to the users in the scope", function() { - expect(this.scope.users).toEqual([existingUser, addedUser]); - }); - it("should emit the 'SubmitUserFormSuccess' event", function() { - expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormSuccess'); - }); - }); + this.controller = new mifosX.controllers.UserFormController(this.scope, this.resourceFactory); + }); + + describe("Initialization", function () { + it("should initialize the offices collection", function () { + expect(this.scope.offices).toEqual(['test_office1', 'test_office2']); + }); + it("should initialize the roles collection", function () { + expect(this.scope.roles).toEqual(['test_role1', 'test_role2']); + }); + }); + + describe("When form dialog opens", function () { + it("should listen to the 'OpenUserFormDialog' event", function () { + expect(this.scope.$on).toHaveBeenCalledWith('OpenUserFormDialog', jasmine.any(Function)); + }); + it("should reset the form data", function () { + eventCallback(); + + expect(this.scope.userFormData).toEqual({selectedRoles: {}, sendPasswordToEmail: false}); + expect(this.scope.formInError).toBeFalsy(); + expect(this.scope.errors).toEqual([]); + }); + }); + + describe("Form actions", function () { + var userResource, onSuccessCallback, onErrorCallback; + beforeEach(function () { + userResource = jasmine.createSpyObj('userResource', ['$save']); + userResource.$save.andCallFake(function (params, success, error) { + onSuccessCallback = success; + onErrorCallback = error; + }); + this.resourceFactory.userResource.andReturn(userResource); + }); + + it("should emit the 'CloseUserForm' when cancelling the form", function () { + this.scope.cancelUserForm(); + + expect(this.scope.$emit).toHaveBeenCalledWith('CloseUserForm'); + }); + + describe("Save user", function () { + var expectedUserParams; + beforeEach(function () { + this.scope.userFormData = { + username: 'test_username', + firstname: 'test_firstname', + lastname: 'test_lastname', + email: 'test_email', + office: {id: 'test_office'}, + sendPasswordToEmail: true, + selectedRoles: {'123': {}, '456': {}} + }; + expectedUserParams = _.extend( + _.pick(this.scope.userFormData, ['username', 'firstname', 'lastname', 'email', 'sendPasswordToEmail']), + { officeId: 'test_office', roles: [123, 456] } + ); + + this.scope.submitUserForm(); + }); + + it("should emit the 'SubmitUserFormStart' event", function () { + expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormStart'); + }); + it("should create and save a new user resource", function () { + expect(this.resourceFactory.userResource).toHaveBeenCalledWith(expectedUserParams); + expect(userResource.$save).toHaveBeenCalledWith({}, jasmine.any(Function), jasmine.any(Function)); + }); + + describe("User save error handler", function () { + beforeEach(function () { + this.scope.formInError = false; + this.scope.errors = []; + + onErrorCallback({data: {errors: 'test_errors'}}); + }); + + it("should flag the form in error", function () { + expect(this.scope.formInError).toBeTruthy(); + }); + it("should put the errors in the scope", function () { + expect(this.scope.errors).toEqual('test_errors'); + }); + it("should emit the 'SubmitUserFormError' event", function () { + expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormError'); + }); + }); + + describe("User save success handler", function () { + var addedUser, existingUser; + beforeEach(function () { + existingUser = {id: 'another_userId'}; + this.scope.users = [existingUser]; + addedUser = _.extend(expectedUserParams, {id: 'test_userId'}); + + onSuccessCallback({resourceId: 'test_userId'}); + }); + + it("should add the user to the users in the scope", function () { + expect(this.scope.users).toEqual([existingUser, addedUser]); + }); + it("should emit the 'SubmitUserFormSuccess' event", function () { + expect(this.scope.$emit).toHaveBeenCalledWith('SubmitUserFormSuccess'); + }); + }); + }); }); - }); }); \ No newline at end of file diff --git a/test/spec/controllers/user/UserListControllerSpec.js b/test/spec/controllers/user/UserListControllerSpec.js index ccb49504..899cd244 100644 --- a/test/spec/controllers/user/UserListControllerSpec.js +++ b/test/spec/controllers/user/UserListControllerSpec.js @@ -1,12 +1,12 @@ -describe("UserListController", function() { +describe("UserListController", function () { var resourceCallback; - beforeEach(function() { + beforeEach(function () { this.scope = { $broadcast: jasmine.createSpy("$scope.$broadcast(") }; this.resourceFactory = {userListResource: { - getAllUsers: jasmine.createSpy('userResource.getAllUsers()').andCallFake(function(callback) { + getAllUsers: jasmine.createSpy('userResource.getAllUsers()').andCallFake(function (callback) { resourceCallback = callback; }) }}; @@ -14,11 +14,11 @@ describe("UserListController", function() { this.controller = new mifosX.controllers.UserListController(this.scope, this.resourceFactory); }); - it("should call the userResource with the correct method", function() { + it("should call the userResource with the correct method", function () { expect(this.resourceFactory.userListResource.getAllUsers).toHaveBeenCalled(); }); - it("should populate the scope with the retrieved users", function() { + it("should populate the scope with the retrieved users", function () { resourceCallback(["test_user1", "test_user2"]); expect(this.scope.users).toEqual(["test_user1", "test_user2"]); }); diff --git a/test/spec/controllers/user/UserSettingControllerSpec.js b/test/spec/controllers/user/UserSettingControllerSpec.js index b5e88c14..b7012d38 100644 --- a/test/spec/controllers/user/UserSettingControllerSpec.js +++ b/test/spec/controllers/user/UserSettingControllerSpec.js @@ -1,31 +1,31 @@ -describe("UserSettingController", function() { +describe("UserSettingController", function () { - beforeEach(function() { + beforeEach(function () { this.scope = jasmine.createSpyObj("$scope", ['$watch']); this.translate = { uses: jasmine.createSpy("translate.uses()") }; this.localStorageService = { - get: jasmine.createSpy("localStorageService.get()").andReturn({"name" : "English" , "code" : "en"}), + get: jasmine.createSpy("localStorageService.get()").andReturn({"name": "English", "code": "en"}), add: jasmine.createSpy("localStorageService.add()") }; - this.controller = new mifosX.controllers.UserSettingController(this.scope, this.translate,this.localStorageService); + this.controller = new mifosX.controllers.UserSettingController(this.scope, this.translate, this.localStorageService); }); - it("should populate the scope with available languages", function() { + it("should populate the scope with available languages", function () { expect(this.scope.langs).not.toBeNull(); }); - it("should set the default language", function() { - expect(this.scope.optlang).toEqual(this.scope.langs[0]); + it("should set the default language", function () { + expect(this.scope.optlang).toEqual(this.scope.langs[0]); }); - it("should change the default language", function() { + it("should change the default language", function () { this.scope.optlang = this.scope.langs[1]; this.scope.changeLang(this.scope.langs[1]); expect(this.translate.uses).toHaveBeenCalledWith('fr'); - expect(this.localStorageService.add).toHaveBeenCalledWith('Language',{"name" : "Français", "code":"fr"}); + expect(this.localStorageService.add).toHaveBeenCalledWith('Language', {"name": "Français", "code": "fr"}); }); }); diff --git a/test/spec/directives/DialogDirectiveSpec.js b/test/spec/directives/DialogDirectiveSpec.js index 02da5d69..b296a3f2 100644 --- a/test/spec/directives/DialogDirectiveSpec.js +++ b/test/spec/directives/DialogDirectiveSpec.js @@ -1,79 +1,79 @@ -describe("dialogDirective", function() { - var scope, eventsCallbacks; - beforeEach(function() { - eventsCallbacks = {}; - $ = jQuery = jasmine.createSpy('jQuery'); - $.dialog = jasmine.createSpy('$.dialog()'); - $.andCallFake(function(selector) { - if (selector === "test-element") return $; - }); - scope = { - $eval: jasmine.createSpy("$scope.$eval"), - $on: jasmine.createSpy("$scope.$on").andCallFake(function(eventName, callback) { - eventsCallbacks[eventName] = callback; - }) - }; +describe("dialogDirective", function () { + var scope, eventsCallbacks; + beforeEach(function () { + eventsCallbacks = {}; + $ = jQuery = jasmine.createSpy('jQuery'); + $.dialog = jasmine.createSpy('$.dialog()'); + $.andCallFake(function (selector) { + if (selector === "test-element") return $; + }); + scope = { + $eval: jasmine.createSpy("$scope.$eval"), + $on: jasmine.createSpy("$scope.$on").andCallFake(function (eventName, callback) { + eventsCallbacks[eventName] = callback; + }) + }; - this.linkFunction = mifosX.directives.dialogDirective(); - }); - - describe("Event actions", function() { - beforeEach(function() { - scope.$eval.andReturn( - {show: 'test_event_show1,test_event_show2', hide: 'test_event_hide1,test_event_hide2'} - ); - this.linkFunction(scope, "test-element", {mfDialog: "test_map"}); + this.linkFunction = mifosX.directives.dialogDirective(); }); - it("should parse the event map", function() { - expect(scope.$eval).toHaveBeenCalledWith("test_map"); - }); - _.each(['test_event_show1', 'test_event_show2', 'test_event_hide1', 'test_event_hide2'], function(name) { - it("should setup the " + name + " listener", function() { - expect(scope.$on).toHaveBeenCalledWith(name, jasmine.any(Function)); - }); - }); - _.times(2, function(i) { - it("should open the dialog with a given title", function() { - eventsCallbacks["test_event_show" + (i+1)]({}, {title: 'test-title'}); + describe("Event actions", function () { + beforeEach(function () { + scope.$eval.andReturn( + {show: 'test_event_show1,test_event_show2', hide: 'test_event_hide1,test_event_hide2'} + ); + this.linkFunction(scope, "test-element", {mfDialog: "test_map"}); + }); - expect($.dialog).toHaveBeenCalledWith('option', 'title', 'test-title'); - expect($.dialog).toHaveBeenCalledWith('open'); - }); - it("should close the dialog", function() { - eventsCallbacks["test_event_hide" + (i+1)]({}, {}); + it("should parse the event map", function () { + expect(scope.$eval).toHaveBeenCalledWith("test_map"); + }); + _.each(['test_event_show1', 'test_event_show2', 'test_event_hide1', 'test_event_hide2'], function (name) { + it("should setup the " + name + " listener", function () { + expect(scope.$on).toHaveBeenCalledWith(name, jasmine.any(Function)); + }); + }); + _.times(2, function (i) { + it("should open the dialog with a given title", function () { + eventsCallbacks["test_event_show" + (i + 1)]({}, {title: 'test-title'}); - expect($.dialog).toHaveBeenCalledWith('close'); - }) - }); - }); + expect($.dialog).toHaveBeenCalledWith('option', 'title', 'test-title'); + expect($.dialog).toHaveBeenCalledWith('open'); + }); + it("should close the dialog", function () { + eventsCallbacks["test_event_hide" + (i + 1)]({}, {}); - describe("Dialog options", function() { - beforeEach(function() { - scope.$eval.andCallFake(function(attr){ - if (attr === "test_options") return {resizable: true, modal: true}; - if (attr === "test_map") return {show: 'test_event', hide: 'test_event'}; - }); + expect($.dialog).toHaveBeenCalledWith('close'); + }) + }); }); - it("should use default options", function() { - this.linkFunction(scope, "test-element", {mfDialog: "test_map"}); + describe("Dialog options", function () { + beforeEach(function () { + scope.$eval.andCallFake(function (attr) { + if (attr === "test_options") return {resizable: true, modal: true}; + if (attr === "test_map") return {show: 'test_event', hide: 'test_event'}; + }); + }); - expect($.dialog).toHaveBeenCalledWith({ - autoOpen: false, - draggable: false, - resizable: false - }); - }); - it("should override the options", function() { - this.linkFunction(scope, "test-element", {mfDialog: "test_map", mfDialogOptions: "test_options"}); + it("should use default options", function () { + this.linkFunction(scope, "test-element", {mfDialog: "test_map"}); - expect($.dialog).toHaveBeenCalledWith({ - autoOpen: false, - draggable: false, - resizable: true, - modal: true - }); + expect($.dialog).toHaveBeenCalledWith({ + autoOpen: false, + draggable: false, + resizable: false + }); + }); + it("should override the options", function () { + this.linkFunction(scope, "test-element", {mfDialog: "test_map", mfDialogOptions: "test_options"}); + + expect($.dialog).toHaveBeenCalledWith({ + autoOpen: false, + draggable: false, + resizable: true, + modal: true + }); + }); }); - }); }); \ No newline at end of file diff --git a/test/spec/directives/OverlayDirectiveSpec.js b/test/spec/directives/OverlayDirectiveSpec.js index 222f1ef1..e32f7ec3 100644 --- a/test/spec/directives/OverlayDirectiveSpec.js +++ b/test/spec/directives/OverlayDirectiveSpec.js @@ -1,96 +1,96 @@ -describe("overlayDirective", function() { - var eventsCallbacks, scope; - beforeEach(function() { - eventsCallbacks = {}; - $ = jQuery = jasmine.createSpy('jQuery'); - $.blockUI = jasmine.createSpy('$.blockUI'); - $.unblockUI = jasmine.createSpy('$.unblockUI'); - $.blockUI.defaults = {}; - scope = { - $eval: jasmine.createSpy("$scope.$eval").andCallFake(function(expr) { - if (expr === "test_map") return {show: 'test_event_show1,test_event_show2', hide: 'test_event_hide1,test_event_hide2'}; - if (expr === "test_opacity") return {opacity: 'test_value'}; - }), - $on: jasmine.createSpy("$scope.$on").andCallFake(function(eventName, callback) { - eventsCallbacks[eventName] = callback; - }) - }; +describe("overlayDirective", function () { + var eventsCallbacks, scope; + beforeEach(function () { + eventsCallbacks = {}; + $ = jQuery = jasmine.createSpy('jQuery'); + $.blockUI = jasmine.createSpy('$.blockUI'); + $.unblockUI = jasmine.createSpy('$.unblockUI'); + $.blockUI.defaults = {}; + scope = { + $eval: jasmine.createSpy("$scope.$eval").andCallFake(function (expr) { + if (expr === "test_map") return {show: 'test_event_show1,test_event_show2', hide: 'test_event_hide1,test_event_hide2'}; + if (expr === "test_opacity") return {opacity: 'test_value'}; + }), + $on: jasmine.createSpy("$scope.$on").andCallFake(function (eventName, callback) { + eventsCallbacks[eventName] = callback; + }) + }; - this.linkFunction = mifosX.directives.overlayDirective(); - }); - - describe("Event mapping", function() { - beforeEach(function() { - this.linkFunction(scope, "test-element", {mfOverlay: "test_map"}); + this.linkFunction = mifosX.directives.overlayDirective(); }); - it("should reset the default css options", function() { - expect($.blockUI.defaults.css).toEqual({}); - }); - _.each(['test_event_show1', 'test_event_show2', 'test_event_hide1', 'test_event_hide2'], function(name) { - it("should setup the " + name + " listener", function() { - expect(scope.$on).toHaveBeenCalledWith(name, jasmine.any(Function)); - }); - }); - }); - - describe("Action mapping with no target", function() { - beforeEach(function() { - $.andCallFake(function(selector) { - if (selector === "test-element") return "test_message"; - }); - this.linkFunction(scope, "test-element", {mfOverlay: "test_map", mfOverlayOptions: "test_opacity"}); - }); - _.each(['test_event_show1', 'test_event_show2'], function(name) { - it("should invoke the blockUI function to display the overlay", function() { - eventsCallbacks[name](); - - expect($.blockUI).toHaveBeenCalledWith({ - fadeIn: 100, - fadeOut: 200, - message: "test_message", - overlayCSS: {opacity: 'test_value'} + describe("Event mapping", function () { + beforeEach(function () { + this.linkFunction(scope, "test-element", {mfOverlay: "test_map"}); }); - }); - }); - _.each(['test_event_hide1', 'test_event_hide2'], function(name) { - it("should invoke the unblockUI function to hide the overlay", function() { - eventsCallbacks[name](); - expect($.unblockUI).toHaveBeenCalled(); - }); - }); - }); - - describe("Action mapping with a target", function() { - beforeEach(function() { - $.block = jasmine.createSpy('$.block'); - $.unblock = jasmine.createSpy('$.unblock'); - $.andCallFake(function(selector) { - if (selector === "test-element") return "test_message"; - if (selector === "test_target") return $; - }); - - this.linkFunction(scope, "test-element", {mfOverlay: "test_map", mfOverlayOptions: "test_opacity", mfOverlayTarget: "test_target"}); - }); - _.each(['test_event_show1', 'test_event_show2'], function(name) { - it("should invoke the block function to display the overlay", function() { - eventsCallbacks[name](); - - expect($.block).toHaveBeenCalledWith({ - fadeIn: 100, - fadeOut: 200, - message: "test_message", - overlayCSS: {opacity: 'test_value'} + it("should reset the default css options", function () { + expect($.blockUI.defaults.css).toEqual({}); + }); + _.each(['test_event_show1', 'test_event_show2', 'test_event_hide1', 'test_event_hide2'], function (name) { + it("should setup the " + name + " listener", function () { + expect(scope.$on).toHaveBeenCalledWith(name, jasmine.any(Function)); + }); }); - }); }); - _.each(['test_event_hide1', 'test_event_hide2'], function(name) { - it("should invoke the unblock function to hide the overlay", function() { - eventsCallbacks[name](); - expect($.unblock).toHaveBeenCalled(); - }); + describe("Action mapping with no target", function () { + beforeEach(function () { + $.andCallFake(function (selector) { + if (selector === "test-element") return "test_message"; + }); + this.linkFunction(scope, "test-element", {mfOverlay: "test_map", mfOverlayOptions: "test_opacity"}); + }); + _.each(['test_event_show1', 'test_event_show2'], function (name) { + it("should invoke the blockUI function to display the overlay", function () { + eventsCallbacks[name](); + + expect($.blockUI).toHaveBeenCalledWith({ + fadeIn: 100, + fadeOut: 200, + message: "test_message", + overlayCSS: {opacity: 'test_value'} + }); + }); + }); + _.each(['test_event_hide1', 'test_event_hide2'], function (name) { + it("should invoke the unblockUI function to hide the overlay", function () { + eventsCallbacks[name](); + + expect($.unblockUI).toHaveBeenCalled(); + }); + }); + }); + + describe("Action mapping with a target", function () { + beforeEach(function () { + $.block = jasmine.createSpy('$.block'); + $.unblock = jasmine.createSpy('$.unblock'); + $.andCallFake(function (selector) { + if (selector === "test-element") return "test_message"; + if (selector === "test_target") return $; + }); + + this.linkFunction(scope, "test-element", {mfOverlay: "test_map", mfOverlayOptions: "test_opacity", mfOverlayTarget: "test_target"}); + }); + _.each(['test_event_show1', 'test_event_show2'], function (name) { + it("should invoke the block function to display the overlay", function () { + eventsCallbacks[name](); + + expect($.block).toHaveBeenCalledWith({ + fadeIn: 100, + fadeOut: 200, + message: "test_message", + overlayCSS: {opacity: 'test_value'} + }); + }); + }); + _.each(['test_event_hide1', 'test_event_hide2'], function (name) { + it("should invoke the unblock function to hide the overlay", function () { + eventsCallbacks[name](); + + expect($.unblock).toHaveBeenCalled(); + }); + }); }); - }); }); \ No newline at end of file diff --git a/test/spec/models/LoggedInUserSpec.js b/test/spec/models/LoggedInUserSpec.js index 581a1fe6..4b4eeb19 100644 --- a/test/spec/models/LoggedInUserSpec.js +++ b/test/spec/models/LoggedInUserSpec.js @@ -1,22 +1,22 @@ -describe("LoggedInUser", function() { - it("should return the username", function() { - var user = new mifosX.models.LoggedInUser({username: 'test_user'}); +describe("LoggedInUser", function () { + it("should return the username", function () { + var user = new mifosX.models.LoggedInUser({username: 'test_user'}); - expect(user.name).toEqual('test_user'); - }); + expect(user.name).toEqual('test_user'); + }); - it("should return the mapped role page name", function() { - var data = { - username: 'test_user', - roles: [ - {id: 1, name: "Test super user role"}, - {id: 2, name: "Test branch manager role"} - ] - }; + it("should return the mapped role page name", function () { + var data = { + username: 'test_user', + roles: [ + {id: 1, name: "Test super user role"}, + {id: 2, name: "Test branch manager role"} + ] + }; - var user = new mifosX.models.LoggedInUser(data); + var user = new mifosX.models.LoggedInUser(data); - expect(user.name).toEqual('test_user'); - expect(user.getHomePageIdentifier()).toEqual('superuser'); - }); + expect(user.name).toEqual('test_user'); + expect(user.getHomePageIdentifier()).toEqual('superuser'); + }); }); \ No newline at end of file diff --git a/test/spec/models/RoleSpec.js b/test/spec/models/RoleSpec.js index e1c15530..a78240dc 100644 --- a/test/spec/models/RoleSpec.js +++ b/test/spec/models/RoleSpec.js @@ -1,14 +1,14 @@ -describe("Role", function() { - it("should return the details about the role", function() { - var data = { - id: 1, - name: "Test super user role", - description: "test super user description" - }; +describe("Role", function () { + it("should return the details about the role", function () { + var data = { + id: 1, + name: "Test super user role", + description: "test super user description" + }; - var role = new mifosX.models.Role(data); - expect(role.id).toEqual(1); - expect(role.name).toEqual('Test super user role'); - expect(role.description).toEqual('test super user description'); - }); + var role = new mifosX.models.Role(data); + expect(role.id).toEqual(1); + expect(role.name).toEqual('Test super user role'); + expect(role.description).toEqual('test super user description'); + }); }); diff --git a/test/spec/services/AuthenticationServiceSpec.js b/test/spec/services/AuthenticationServiceSpec.js index f44a56d2..b3fced3f 100644 --- a/test/spec/services/AuthenticationServiceSpec.js +++ b/test/spec/services/AuthenticationServiceSpec.js @@ -1,46 +1,46 @@ -describe("AuthenticationService", function() { - var scope, httpService, callbacks,localStorageService; - beforeEach(function() { - callbacks = {}; - scope = jasmine.createSpyObj("$rootScope", ['$broadcast']); - localStorageService= jasmine.createSpyObj('localStorageService',['add']); - - httpService = jasmine.createSpyObj("httpService", ['post', 'success', 'error']); - httpService.post.andReturn(httpService); - _.each(['success', 'error'], function(method) { - httpService[method].andCallFake(function(callback) { - callbacks[method] = callback; - return this; - }); +describe("AuthenticationService", function () { + var scope, httpService, callbacks, localStorageService; + beforeEach(function () { + callbacks = {}; + scope = jasmine.createSpyObj("$rootScope", ['$broadcast']); + localStorageService = jasmine.createSpyObj('localStorageService', ['add']); + + httpService = jasmine.createSpyObj("httpService", ['post', 'success', 'error']); + httpService.post.andReturn(httpService); + _.each(['success', 'error'], function (method) { + httpService[method].andCallFake(function (callback) { + callbacks[method] = callback; + return this; + }); + }); + + new mifosX.services.AuthenticationService(scope, httpService, localStorageService).authenticateWithUsernamePassword({ + username: "test_username", + password: "test_password" + }); }); - new mifosX.services.AuthenticationService(scope, httpService,localStorageService).authenticateWithUsernamePassword({ - username: "test_username", - password: "test_password" + it("should pass the correct parameters to the post method", function () { + expect(httpService.post).toHaveBeenCalledWith("/mifosng-provider/api/v1/authentication?username=test_username&password=test_password"); }); - }); - it("should pass the correct parameters to the post method", function() { - expect(httpService.post).toHaveBeenCalledWith("/mifosng-provider/api/v1/authentication?username=test_username&password=test_password"); - }); - - it("should broadcast 'UserAuthenticationStartEvent'", function() { - expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationStartEvent"); - }); - - describe("On successful authentication", function() { - it("should broadcast a 'UserAuthenticationSuccessEvent' on successful authentication", function() { - callbacks['success']("test_data"); - - expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationSuccessEvent", "test_data"); + it("should broadcast 'UserAuthenticationStartEvent'", function () { + expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationStartEvent"); }); - }); - describe("On failed authentication", function() { - it("should broadcast a 'UserAuthenticationFailureEvent' on failed authentication", function() { - callbacks['error']("test_data"); + describe("On successful authentication", function () { + it("should broadcast a 'UserAuthenticationSuccessEvent' on successful authentication", function () { + callbacks['success']("test_data"); - expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationFailureEvent", "test_data"); + expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationSuccessEvent", "test_data"); + }); + }); + + describe("On failed authentication", function () { + it("should broadcast a 'UserAuthenticationFailureEvent' on failed authentication", function () { + callbacks['error']("test_data"); + + expect(scope.$broadcast).toHaveBeenCalledWith("UserAuthenticationFailureEvent", "test_data"); + }); }); - }); }); \ No newline at end of file diff --git a/test/spec/services/HttpServiceProviderSpec.js b/test/spec/services/HttpServiceProviderSpec.js index f74f33b2..dc81d5cd 100644 --- a/test/spec/services/HttpServiceProviderSpec.js +++ b/test/spec/services/HttpServiceProviderSpec.js @@ -1,88 +1,96 @@ -describe("HttpServiceProvider", function() { - var http, httpService; - beforeEach(function() { - this.provider = new mifosX.services.HttpServiceProvider(); - }); - - describe("Http service", function() { - describe("HTTP methods", function() { - beforeEach(function() { - http = jasmine.createSpy("$http").andReturn('httpPromise'); - httpService = this.provider.$get[1](http); - }); +describe("HttpServiceProvider", function () { + var http, httpService; + beforeEach(function () { + this.provider = new mifosX.services.HttpServiceProvider(); + }); - _.each(['get', 'head', 'delete'], function(method) { - it("should delegate to the correspoding http " + method, function() { - var promise = httpService[method]("test_url"); - - expect(http).toHaveBeenCalledWith({ method: method.toUpperCase(), url: "test_url"}); - expect(promise).toEqual('httpPromise'); + describe("Http service", function () { + describe("HTTP methods", function () { + beforeEach(function () { + http = jasmine.createSpy("$http").andReturn('httpPromise'); + httpService = this.provider.$get[1](http); + }); + + _.each(['get', 'head', 'delete'], function (method) { + it("should delegate to the correspoding http " + method, function () { + var promise = httpService[method]("test_url"); + + expect(http).toHaveBeenCalledWith({ method: method.toUpperCase(), url: "test_url"}); + expect(promise).toEqual('httpPromise'); + }); + }); + + _.each(['post', 'put'], function (method) { + it("should delegate to the correspoding http " + method, function () { + var promise = httpService[method]("test_url", {test: 'some_data'}); + + expect(http).toHaveBeenCalledWith({ method: method.toUpperCase(), url: "test_url", data: {test: 'some_data'} }); + expect(promise).toEqual('httpPromise'); + }); + }); }); - }); - _.each(['post', 'put'], function(method) { - it("should delegate to the correspoding http " + method, function() { - var promise = httpService[method]("test_url", {test: 'some_data'}); - - expect(http).toHaveBeenCalledWith({ method: method.toUpperCase(), url: "test_url", data: {test: 'some_data'} }); - expect(promise).toEqual('httpPromise'); + describe("Authorization", function () { + beforeEach(function () { + http = { defaults: { headers: { common: {} } } }; + httpService = this.provider.$get[1](http); + }); + it("should set the Authorization header", function () { + httpService.setAuthorization("test_key"); + + expect(http.defaults.headers.common.Authorization).toEqual("Basic test_key"); + }); + + it("should remove the Authorization header", function () { + http.defaults.headers.common.Authorization = "test"; + httpService.cancelAuthorization(); + + expect(http.defaults.headers.common.Authorization).toBeUndefined(); + }); }); - }); - }); - - describe("Authorization", function() { - beforeEach(function() { - http = { defaults: { headers: { common: {} } } }; - httpService = this.provider.$get[1](http); - }); - it("should set the Authorization header", function() { - httpService.setAuthorization("test_key"); - - expect(http.defaults.headers.common.Authorization).toEqual("Basic test_key"); - }); - - it("should remove the Authorization header", function() { - http.defaults.headers.common.Authorization = "test"; - httpService.cancelAuthorization(); - - expect(http.defaults.headers.common.Authorization).toBeUndefined(); - }); - }); - }); - - describe("Request interceptors", function() { - beforeEach(function() { - http = jasmine.createSpy("$http").andReturn('httpPromise'); - httpService = this.provider.$get[1](http); }); - it("should add a new interceptor", function() { - this.provider.addRequestInterceptor("test_interceptor", function(config) { - return _.extend(config, {url: "test_another_url"}); - }); + describe("Request interceptors", function () { + beforeEach(function () { + http = jasmine.createSpy("$http").andReturn('httpPromise'); + httpService = this.provider.$get[1](http); + }); - httpService.get("test_url"); + it("should add a new interceptor", function () { + this.provider.addRequestInterceptor("test_interceptor", function (config) { + return _.extend(config, {url: "test_another_url"}); + }); - expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_another_url" }); + httpService.get("test_url"); + + expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_another_url" }); + }); + + it("should add a chain of interceptors", function () { + this.provider.addRequestInterceptor("test_interceptor1", function (config) { + return _.extend(config, {url: "test_another_url"}); + }); + this.provider.addRequestInterceptor("test_interceptor2", function (config) { + return _.extend(config, {headers: {AnotherHeader: "test_header"}}) + }); + + httpService.get("test_url"); + + expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_another_url", headers: {AnotherHeader: "test_header"} }); + }); + + it("should remove an interceptor", function () { + this.provider.addRequestInterceptor("test_interceptor1", function (config) { + return _.extend(config, {url: "test_another_url"}); + }); + this.provider.addRequestInterceptor("test_interceptor2", function (config) { + return _.extend(config, {headers: {AnotherHeader: "test_header"}}) + }); + this.provider.removeRequestInterceptor("test_interceptor1"); + + httpService.get("test_url"); + + expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_url", headers: {AnotherHeader: "test_header"} }); + }); }); - - it("should add a chain of interceptors", function() { - this.provider.addRequestInterceptor("test_interceptor1", function(config) { return _.extend(config, {url: "test_another_url"}); }); - this.provider.addRequestInterceptor("test_interceptor2", function(config) { return _.extend(config, {headers: {AnotherHeader: "test_header"}}) }); - - httpService.get("test_url"); - - expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_another_url", headers: {AnotherHeader: "test_header"} }); - }); - - it("should remove an interceptor", function() { - this.provider.addRequestInterceptor("test_interceptor1", function(config) { return _.extend(config, {url: "test_another_url"}); }); - this.provider.addRequestInterceptor("test_interceptor2", function(config) { return _.extend(config, {headers: {AnotherHeader: "test_header"}}) }); - this.provider.removeRequestInterceptor("test_interceptor1"); - - httpService.get("test_url"); - - expect(http).toHaveBeenCalledWith({ method: 'GET', url: "test_url", headers: {AnotherHeader: "test_header"} }); - }); - }); }); \ No newline at end of file diff --git a/test/spec/services/ResourceFactoryProviderSpec.js b/test/spec/services/ResourceFactoryProviderSpec.js index 22c5d735..f70242c2 100644 --- a/test/spec/services/ResourceFactoryProviderSpec.js +++ b/test/spec/services/ResourceFactoryProviderSpec.js @@ -1,41 +1,41 @@ -describe("ResourceFactoryProvider", function() { - var ngResource, - rootScope, - apiVersion = "/mifosng-provider/api/v1"; - beforeEach(function() { - this.provider = new mifosX.services.ResourceFactoryProvider(); - ngResource = jasmine.createSpy("$resource").andReturn("test_resource"); - rootScope = jasmine.createSpyObj("$rootScope",["hostUrl"]); +describe("ResourceFactoryProvider", function () { + var ngResource, + rootScope, + apiVersion = "/mifosng-provider/api/v1"; + beforeEach(function () { + this.provider = new mifosX.services.ResourceFactoryProvider(); + ngResource = jasmine.createSpy("$resource").andReturn("test_resource"); + rootScope = jasmine.createSpyObj("$rootScope", ["hostUrl"]); - this.factory = this.provider.$get[2](ngResource,rootScope); - }); - - describe("User resource", function() { - it("should define the User resource", function() { - expect(ngResource).toHaveBeenCalledWith(apiVersion + "/users/:userId", {userId:'@userId'}, { - getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}, - getUser: {method:'GET',params:{}} - }); - expect(this.factory.userResource).toEqual("test_resource"); + this.factory = this.provider.$get[2](ngResource, rootScope); }); - }); - describe("Role resource", function() { - it("should define the Role resource", function() { - expect(ngResource).toHaveBeenCalledWith(apiVersion + "/roles/:roleId", {}, { - getAllRoles: {method: 'GET', params: {}, isArray: true} - }); - expect(this.factory.roleResource).toEqual("test_resource"); + describe("User resource", function () { + it("should define the User resource", function () { + expect(ngResource).toHaveBeenCalledWith(apiVersion + "/users/:userId", {userId: '@userId'}, { + getAllUsers: {method: 'GET', params: {fields: "id,firstname,lastname,username,officeName"}, isArray: true}, + getUser: {method: 'GET', params: {}} + }); + expect(this.factory.userResource).toEqual("test_resource"); + }); }); - }); - describe("Office resource", function() { - it("should define the Office resource", function() { - expect(ngResource).toHaveBeenCalledWith(apiVersion + "/offices/:officeId", {officeId:"@officeId"}, { - getAllOffices: {method: 'GET', params: {}, isArray: true}, - update: {method: 'PUT'} - }); - expect(this.factory.officeResource).toEqual("test_resource"); + describe("Role resource", function () { + it("should define the Role resource", function () { + expect(ngResource).toHaveBeenCalledWith(apiVersion + "/roles/:roleId", {}, { + getAllRoles: {method: 'GET', params: {}, isArray: true} + }); + expect(this.factory.roleResource).toEqual("test_resource"); + }); + }); + + describe("Office resource", function () { + it("should define the Office resource", function () { + expect(ngResource).toHaveBeenCalledWith(apiVersion + "/offices/:officeId", {officeId: "@officeId"}, { + getAllOffices: {method: 'GET', params: {}, isArray: true}, + update: {method: 'PUT'} + }); + expect(this.factory.officeResource).toEqual("test_resource"); + }); }); - }); }); diff --git a/test/spec/services/SessionManagerSpec.js b/test/spec/services/SessionManagerSpec.js index d8ed31d7..78e5cb9e 100644 --- a/test/spec/services/SessionManagerSpec.js +++ b/test/spec/services/SessionManagerSpec.js @@ -1,84 +1,88 @@ -describe("SessionManager", function() { - var webStorage, httpService, resourceFactory, resourceCallback, userConstructor; - beforeEach(function() { - webStorage = jasmine.createSpyObj("webStorage", ['add', 'get', 'remove']); - httpService = jasmine.createSpyObj("HttpService", ['setAuthorization', 'cancelAuthorization']); - resourceFactory = {userResource: { - get: jasmine.createSpy('userResource.get()').andCallFake(function(params, callback) { - resourceCallback = callback; - }) - }}; - userConstructor = spyOn(mifosX.models, 'LoggedInUser').andReturn({id: "test_user"}); +describe("SessionManager", function () { + var webStorage, httpService, resourceFactory, resourceCallback, userConstructor; + beforeEach(function () { + webStorage = jasmine.createSpyObj("webStorage", ['add', 'get', 'remove']); + httpService = jasmine.createSpyObj("HttpService", ['setAuthorization', 'cancelAuthorization']); + resourceFactory = {userResource: { + get: jasmine.createSpy('userResource.get()').andCallFake(function (params, callback) { + resourceCallback = callback; + }) + }}; + userConstructor = spyOn(mifosX.models, 'LoggedInUser').andReturn({id: "test_user"}); - this.sessionManager = new mifosX.services.SessionManager(webStorage, httpService, resourceFactory); - }); + this.sessionManager = new mifosX.services.SessionManager(webStorage, httpService, resourceFactory); + }); - describe("Session restore", function() { - describe("when sessionData exists in the storage", function() { - beforeEach(function() { - webStorage.get.andCallFake(function(key) { - if (key === 'sessionData') return {userId: "test_user", authenticationKey: "test_key"}; + describe("Session restore", function () { + describe("when sessionData exists in the storage", function () { + beforeEach(function () { + webStorage.get.andCallFake(function (key) { + if (key === 'sessionData') return {userId: "test_user", authenticationKey: "test_key"}; + }); + var self = this; + this.sessionManager.restore(function (session) { + self.session = session; + }); + }); + + it("should set the http authorization", function () { + expect(httpService.setAuthorization).toHaveBeenCalledWith("test_key"); + }); + it("should retrieve the current user", function () { + expect(resourceFactory.userResource.get).toHaveBeenCalledWith({userId: "test_user"}, jasmine.any(Function)) + }); + it("should return a session with the user", function () { + resourceCallback("test_user_data"); + expect(userConstructor).toHaveBeenCalledWith("test_user_data"); + expect(this.session).toEqual({user: {id: "test_user"}}); + }); }); - var self = this; - this.sessionManager.restore(function(session) {self.session = session;}); - }); - it("should set the http authorization", function() { - expect(httpService.setAuthorization).toHaveBeenCalledWith("test_key"); - }); - it("should retrieve the current user", function() { - expect(resourceFactory.userResource.get).toHaveBeenCalledWith({userId: "test_user"}, jasmine.any(Function)) - }); - it("should return a session with the user", function() { - resourceCallback("test_user_data"); - expect(userConstructor).toHaveBeenCalledWith("test_user_data"); - expect(this.session).toEqual({user: {id: "test_user"}}); - }); - }); - - describe("when sessionData does not exist in the storage", function() { - beforeEach(function() { - webStorage.get.andReturn(null); - var self = this; - this.sessionManager.restore(function(session) {self.session = session;}); - }); + describe("when sessionData does not exist in the storage", function () { + beforeEach(function () { + webStorage.get.andReturn(null); + var self = this; + this.sessionManager.restore(function (session) { + self.session = session; + }); + }); - it("should return an empty session", function() { - expect(this.session).toBeEmpty(); - }); - }); - }); - - describe("Session start", function() { - beforeEach(function() { - this.session = this.sessionManager.get({userId: "test_user", base64EncodedAuthenticationKey: "test_key"}); + it("should return an empty session", function () { + expect(this.session).toBeEmpty(); + }); + }); }); - it("should set the http authorization", function() { - expect(httpService.setAuthorization).toHaveBeenCalledWith("test_key"); - }); - it("should store the session data", function() { - expect(webStorage.add).toHaveBeenCalledWith("sessionData", {userId: "test_user", authenticationKey: "test_key"}); - }); - it("should return a session with the user", function() { - expect(userConstructor).toHaveBeenCalledWith({userId: "test_user", base64EncodedAuthenticationKey: "test_key"}); - expect(this.session).toEqual({user: {id: "test_user"}}); - }); - }); + describe("Session start", function () { + beforeEach(function () { + this.session = this.sessionManager.get({userId: "test_user", base64EncodedAuthenticationKey: "test_key"}); + }); - describe("Session clear", function() { - beforeEach(function() { - this.session = this.sessionManager.clear(); + it("should set the http authorization", function () { + expect(httpService.setAuthorization).toHaveBeenCalledWith("test_key"); + }); + it("should store the session data", function () { + expect(webStorage.add).toHaveBeenCalledWith("sessionData", {userId: "test_user", authenticationKey: "test_key"}); + }); + it("should return a session with the user", function () { + expect(userConstructor).toHaveBeenCalledWith({userId: "test_user", base64EncodedAuthenticationKey: "test_key"}); + expect(this.session).toEqual({user: {id: "test_user"}}); + }); }); - it("should cancel the http authorization", function() { - expect(httpService.cancelAuthorization).toHaveBeenCalled(); + describe("Session clear", function () { + beforeEach(function () { + this.session = this.sessionManager.clear(); + }); + + it("should cancel the http authorization", function () { + expect(httpService.cancelAuthorization).toHaveBeenCalled(); + }); + it("should remove the session data from the storage", function () { + expect(webStorage.remove).toHaveBeenCalledWith("sessionData"); + }); + it("should return an empty session", function () { + expect(this.session).toBeEmpty(); + }); }); - it("should remove the session data from the storage", function() { - expect(webStorage.remove).toHaveBeenCalledWith("sessionData"); - }); - it("should return an empty session", function() { - expect(this.session).toBeEmpty(); - }); - }); }); \ No newline at end of file diff --git a/test/spec/specHelper.js b/test/spec/specHelper.js index 2ab8095d..95801b7e 100644 --- a/test/spec/specHelper.js +++ b/test/spec/specHelper.js @@ -1,22 +1,26 @@ -var MockModule = function() { - this.value = - this.factory = - this.service = - this.controller = - this.directive = - this.config = - this.run = function(){return this}; +var MockModule = function () { + this.value = + this.factory = + this.service = + this.controller = + this.directive = + this.config = + this.run = function () { + return this + }; }; angular.module = jasmine.createSpy().andReturn(new MockModule()) -var $, jQuery = function() {throw "you must stub or mock any call to jQuery!"}; +var $, jQuery = function () { + throw "you must stub or mock any call to jQuery!" +}; -beforeEach(function() { - this.addMatchers({ - toBeEmpty: function() { - return _.isEmpty(this.actual); - } - }); +beforeEach(function () { + this.addMatchers({ + toBeEmpty: function () { + return _.isEmpty(this.actual); + } + }); });