From 75400252eacfefd1b8936ce81aa0d61395255edb Mon Sep 17 00:00:00 2001 From: Madhukar Date: Tue, 17 Jun 2014 00:12:58 +0530 Subject: [PATCH] Adding UI for Financial Activities --- app/global-translations/locale-en.json | 21 ++++++-- .../AccCreateOfficeGLAccountController.js | 23 --------- .../AccEditOfficeGLAccountController.js | 24 ---------- .../AddFinancialMappingController.js | 32 +++++++++++++ .../EditFinancialActivityMappingController.js | 33 +++++++++++++ .../FinancialActivityMappingsController.js | 17 +++++++ ....js => ViewFinancialActivityController.js} | 11 ++--- app/scripts/mifosXComponents.js | 9 ++-- app/scripts/routes.js | 16 +++---- .../services/ResourceFactoryProvider.js | 1 + app/views/accounting/accounting.html | 6 +-- .../accounting/accounting_office_mapping.html | 46 ------------------ .../add_financial_accounting_mapping.html | 48 +++++++++++++++++++ .../accounting/createofficeglaccount.html | 29 ----------- .../edit_financial_activity_mapping.html | 46 ++++++++++++++++++ app/views/accounting/editofficeglaccount.html | 30 ------------ .../financial_accounting_mapping.html | 26 ++++++++++ .../accounting/view_financial_activity.html | 43 +++++++++++++++++ app/views/accounting/viewofficeglaccount.html | 46 ------------------ 19 files changed, 284 insertions(+), 223 deletions(-) delete mode 100755 app/scripts/controllers/accounting/AccCreateOfficeGLAccountController.js delete mode 100755 app/scripts/controllers/accounting/AccEditOfficeGLAccountController.js create mode 100644 app/scripts/controllers/accounting/AddFinancialMappingController.js create mode 100644 app/scripts/controllers/accounting/EditFinancialActivityMappingController.js create mode 100644 app/scripts/controllers/accounting/FinancialActivityMappingsController.js rename app/scripts/controllers/accounting/{AccViewOfficeGLAccountController.js => ViewFinancialActivityController.js} (65%) mode change 100755 => 100644 delete mode 100755 app/views/accounting/accounting_office_mapping.html create mode 100644 app/views/accounting/add_financial_accounting_mapping.html delete mode 100755 app/views/accounting/createofficeglaccount.html create mode 100644 app/views/accounting/edit_financial_activity_mapping.html delete mode 100755 app/views/accounting/editofficeglaccount.html create mode 100644 app/views/accounting/financial_accounting_mapping.html create mode 100644 app/views/accounting/view_financial_activity.html delete mode 100755 app/views/accounting/viewofficeglaccount.html diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 2ca08772..618184a1 100755 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -693,6 +693,17 @@ "label.heading.debitaccount":"Debit Account", "label.heading.creditaccount":"Credit Account", "label.heading.createclosure":"Create Closure", + "label.heading.financialactivity.accountmappings":"Accounts Linked to Financial Activities", + "label.listof.financialactivity.accountmappings":"List of Financial Activity and GL Account Mappings", + "label.heading.financial.account.type":"Financial Account Type", + "label.heading.financial.account.name":"Account Name", + "label.heading.transferredfrom": "Transferred From", + "label.heading.createdby":"Created By", + "label.heading.entryid":"Entry ID", + "label.heading.add.financial.activity.mapping":"Add Financial Activity Mapping", + "label.heading.financialactivity":"Financial Activity", + "label.heading.viewfinancialmapping":"View Financial Activity Mapping", + "label.heading.edit.financial.activity.mapping":"Edit Financial Activity Mapping", "#Menu Links": "..", "label.menu.filterbyoffice": "Filter by office", @@ -713,10 +724,11 @@ "label.anchor.viewclosure": "View Closure", "label.anchor.viewtransaction": "View Transaction", "label.anchor.viewaccounttransferdetails": "View Account Transfer Details", - "label.heading.transferredfrom": "Transferred From", - "label.heading.createdby":"Created By", - "label.heading.entryid":"Entry ID", "label.anchor.accounttransfers":"Account Transfers", + "label.anchor.financialactivity.accountmappings":"Financial Activity Mappings", + "label.anchor.addfinancialmapping":"Add Financial Activity Mapping", + "label.anchor.viewfinancialmapping":"View Financial Activity Mapping", + "label.anchor.editfinancialmapping":"Edit Financial Activity Mapping", "#Inputs": "..", "label.input.accountingrulename": "Accounting rule name", @@ -760,6 +772,7 @@ "label.button.createclosure": "Create Closure", "label.button.reverse": "Reverse", "label.button.redirecttonewtrx":"Redirect to New Transaction", + "label.button.define.new.financial.mapping":"Define New Mapping", "#Misc Labels": "..", "label.thesearepredefinedpostings": "These are predefined postings", @@ -780,6 +793,7 @@ "label.norepaymentsanddisbursalareavailable":"No repayments and disbursal are available for selected Group and meeting date", "label.transactionisreversedonce":"This transaction was reversed", "label.transactionreverse":"Transaction reversed successfully. A new journal entry has been created to reverse this transaction", + "assetTransfer":"Assest Transfer", "#Enumeration & Error Messages": "..", "accountType.loan": "Loan Account", @@ -845,6 +859,7 @@ "validation.msg.GLJournalEntry.debits[5].amount.cannot.be.blank": "Amount for the sixth debit cannot be blank", "error.msg.glclosure.invalid.accounting.closed": "Accounting Closure for this branch has already been defined for a later date `{{params[0].value}}`.", "error.msg.glclosure.invalid.delete": "An accounting closure for this branch exists at a later date `{{params[0].value}}`, please delete the same first.", + "error.msg.financialActivityAccount.exists.for.office":"Financial activity account already defined", "#tool tip for accounting":"..", "label.tooltip.click.plus.button.to.add.credit.entry":"Click on + button to add credit entry", diff --git a/app/scripts/controllers/accounting/AccCreateOfficeGLAccountController.js b/app/scripts/controllers/accounting/AccCreateOfficeGLAccountController.js deleted file mode 100755 index 12030485..00000000 --- a/app/scripts/controllers/accounting/AccCreateOfficeGLAccountController.js +++ /dev/null @@ -1,23 +0,0 @@ -(function (module) { - mifosX.controllers = _.extend(module, { - AccCreateOfficeGLAccountController: function (scope, resourceFactory, location) { - scope.liabilityOptions = []; - scope.officeOptions = []; - - resourceFactory.officeToGLAccountMappingTemplateResource.get(function (data) { - scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; - - }); - - - scope.submit = function () { - resourceFactory.officeToGLAccountMappingResource.create(this.formData, function (data) { - location.path('/viewofficeglmapping/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('AccCreateOfficeGLAccountController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCreateOfficeGLAccountController]).run(function ($log) { - $log.info("AccCreateOfficeGLAccountController initialized"); - }); -}(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/AccEditOfficeGLAccountController.js b/app/scripts/controllers/accounting/AccEditOfficeGLAccountController.js deleted file mode 100755 index 86259ccd..00000000 --- a/app/scripts/controllers/accounting/AccEditOfficeGLAccountController.js +++ /dev/null @@ -1,24 +0,0 @@ -(function (module) { - mifosX.controllers = _.extend(module, { - AccEditOfficeGLAccountController: function (scope, resourceFactory, location,routeParams) { - scope.liabilityOptions = []; - scope.officeOptions = []; - scope.formData = {}; - resourceFactory.officeToGLAccountMappingResource.withTemplate({mappingId: routeParams.mappingId},function (data) { - scope.mapping = data; - scope.liabilityOptions = data.accountingMappingOptions.liabilityAccountOptions || []; - scope.formData.liabilityTransferInSuspenseAccountId = data.glAccountData.id; - }); - - - scope.submit = function () { - resourceFactory.officeToGLAccountMappingResource.update({mappingId: routeParams.mappingId},this.formData, function (data) { - location.path('/viewofficeglmapping/' + data.resourceId); - }); - }; - } - }); - mifosX.ng.application.controller('AccEditOfficeGLAccountController', ['$scope', 'ResourceFactory', '$location','$routeParams', mifosX.controllers.AccEditOfficeGLAccountController]).run(function ($log) { - $log.info("AccEditOfficeGLAccountController initialized"); - }); -}(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/AddFinancialMappingController.js b/app/scripts/controllers/accounting/AddFinancialMappingController.js new file mode 100644 index 00000000..50e1a6ef --- /dev/null +++ b/app/scripts/controllers/accounting/AddFinancialMappingController.js @@ -0,0 +1,32 @@ +(function (module) { + mifosX.controllers = _.extend(module, { + AddFinancialMappingController: function (scope, resourceFactory, location) { + scope.formData = {}; + + resourceFactory.officeToGLAccountMappingResource.get({mappingId:'template'}, function (data) { + scope.formData.financialActivityId = 100; + scope.glAccountOptions = data.glAccountOptions; + scope.financialActivityOptions = data.financialActivityOptions; + scope.accountOptions = scope.glAccountOptions.assetAccountOptions; + }); + + scope.updateActivityOptions = function(activityId){ + if(activityId === 100){ + scope.accountOptions = scope.glAccountOptions.assetAccountOptions; + }else if(activityId === 200){ + scope.accountOptions = scope.glAccountOptions.liabilityAccountOptions; + } + }; + + scope.submit = function () { + resourceFactory.officeToGLAccountMappingResource.create(this.formData, function (data) { + location.path('/viewfinancialactivitymapping/' + data.resourceId); + }); + }; + + } + }); + mifosX.ng.application.controller('AddFinancialMappingController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddFinancialMappingController]).run(function ($log) { + $log.info("AddFinancialMappingController initialized"); + }); +}(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/EditFinancialActivityMappingController.js b/app/scripts/controllers/accounting/EditFinancialActivityMappingController.js new file mode 100644 index 00000000..232204cf --- /dev/null +++ b/app/scripts/controllers/accounting/EditFinancialActivityMappingController.js @@ -0,0 +1,33 @@ +(function (module) { + mifosX.controllers = _.extend(module, { + EditFinancialActivityMappingController: function (scope, resourceFactory, location,routeParams) { + scope.formData = {}; + scope.accountOptions = []; + resourceFactory.officeToGLAccountMappingResource.withTemplate({mappingId: routeParams.mappingId},function (data) { + scope.mapping = data; + scope.glAccountOptions = data.glAccountOptions; + scope.formData.financialActivityId = data.financialActivityData.id; + scope.formData.glAccountId = data.glAccountData.id; + scope.financialActivityOptions = data.financialActivityOptions; + scope.updateActivityOptions(scope.formData.financialActivityId); + }); + + scope.updateActivityOptions = function(activityId){ + if(activityId === 100){ + scope.accountOptions = scope.glAccountOptions.assetAccountOptions; + }else if(activityId === 200){ + scope.accountOptions = scope.glAccountOptions.liabilityAccountOptions; + } + }; + + scope.submit = function () { + resourceFactory.officeToGLAccountMappingResource.update({mappingId: routeParams.mappingId},this.formData, function (data) { + location.path('/viewfinancialactivitymapping/' + data.resourceId); + }); + }; + } + }); + mifosX.ng.application.controller('EditFinancialActivityMappingController', ['$scope', 'ResourceFactory', '$location','$routeParams', mifosX.controllers.EditFinancialActivityMappingController]).run(function ($log) { + $log.info("EditFinancialActivityMappingController initialized"); + }); +}(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/FinancialActivityMappingsController.js b/app/scripts/controllers/accounting/FinancialActivityMappingsController.js new file mode 100644 index 00000000..6b2a51fc --- /dev/null +++ b/app/scripts/controllers/accounting/FinancialActivityMappingsController.js @@ -0,0 +1,17 @@ +(function (module) { + mifosX.controllers = _.extend(module, { + FinancialActivityMappingsController: function (scope, resourceFactory, location) { + + resourceFactory.officeToGLAccountMappingResource.getAll(function (data) { + scope.mappings = data; + }); + + scope.routeTo = function (resourceId){ + location.path('/viewfinancialactivitymapping/' + resourceId); + }; + } + }); + mifosX.ng.application.controller('FinancialActivityMappingsController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.FinancialActivityMappingsController]).run(function ($log) { + $log.info("FinancialActivityMappingsController initialized"); + }); +}(mifosX.controllers || {})); diff --git a/app/scripts/controllers/accounting/AccViewOfficeGLAccountController.js b/app/scripts/controllers/accounting/ViewFinancialActivityController.js old mode 100755 new mode 100644 similarity index 65% rename from app/scripts/controllers/accounting/AccViewOfficeGLAccountController.js rename to app/scripts/controllers/accounting/ViewFinancialActivityController.js index cf1ca064..f8f2015b --- a/app/scripts/controllers/accounting/AccViewOfficeGLAccountController.js +++ b/app/scripts/controllers/accounting/ViewFinancialActivityController.js @@ -1,13 +1,10 @@ (function (module) { mifosX.controllers = _.extend(module, { - AccViewOfficeGLAccountController: function (scope, resourceFactory, routeParams, location, $modal) { - scope.liabilityOptions = []; - scope.formData = {}; + ViewFinancialActivityController: function (scope, resourceFactory, routeParams, location, $modal) { resourceFactory.officeToGLAccountMappingResource.get({mappingId: routeParams.mappingId},function (data) { scope.mapping = data; }); - scope.deletemapping = function () { $modal.open({ templateUrl: 'deletemapping.html', @@ -18,7 +15,7 @@ $scope.delete = function () { resourceFactory.officeToGLAccountMappingResource.delete({mappingId: routeParams.mappingId}, {}, function (data) { $modalInstance.close('delete'); - location.path('/listofficeglmapping'); + location.path('/financialactivityaccountmappings'); }); }; $scope.cancel = function () { @@ -27,7 +24,7 @@ }; } }); - mifosX.ng.application.controller('AccViewOfficeGLAccountController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.AccViewOfficeGLAccountController]).run(function ($log) { - $log.info("AccViewOfficeGLAccountController initialized"); + mifosX.ng.application.controller('ViewFinancialActivityController', ['$scope', 'ResourceFactory', '$routeParams', '$location', '$modal', mifosX.controllers.ViewFinancialActivityController]).run(function ($log) { + $log.info("ViewFinancialActivityController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/mifosXComponents.js b/app/scripts/mifosXComponents.js index 54b4f574..c507c770 100755 --- a/app/scripts/mifosXComponents.js +++ b/app/scripts/mifosXComponents.js @@ -103,6 +103,10 @@ define(['Q', 'underscore', 'mifosX'], function (Q) { 'accounting/AccCreateRuleController', 'accounting/AccEditRuleController', 'accounting/ViewAccRuleController', + 'accounting/FinancialActivityMappingsController', + 'accounting/AddFinancialMappingController', + 'accounting/ViewFinancialActivityController', + 'accounting/EditFinancialActivityMappingController', 'system/CodeController', 'system/EditCodeController', 'system/ViewCodeController', @@ -197,10 +201,7 @@ define(['Q', 'underscore', 'mifosX'], function (Q) { 'main/ProfileController', 'main/ViewMakerCheckerTaskController', 'main/AdHocQuerySearchController', - 'accounting/AccOGMController', - 'accounting/AccCreateOfficeGLAccountController', - 'accounting/AccEditOfficeGLAccountController', - 'accounting/AccViewOfficeGLAccountController' + 'accounting/AccOGMController' ], filters: [ 'StatusLookup', diff --git a/app/scripts/routes.js b/app/scripts/routes.js index a0e3acf5..f0635e48 100755 --- a/app/scripts/routes.js +++ b/app/scripts/routes.js @@ -613,17 +613,17 @@ .when('/advsearch', { templateUrl: 'views/search/advsearch.html' }) - .when('/createofficeglmapping', { - templateUrl: 'views/accounting/createofficeglaccount.html' + .when('/editfinancialactivitymapping/:mappingId', { + templateUrl: 'views/accounting/edit_financial_activity_mapping.html' }) - .when('/editofficeglmapping/:mappingId', { - templateUrl: 'views/accounting/editofficeglaccount.html' + .when('/viewfinancialactivitymapping/:mappingId', { + templateUrl: 'views/accounting/view_financial_activity.html' }) - .when('/viewofficeglmapping/:mappingId', { - templateUrl: 'views/accounting/viewofficeglaccount.html' + .when('/financialactivityaccountmappings', { + templateUrl: 'views/accounting/financial_accounting_mapping.html' }) - .when('/listofficeglmapping', { - templateUrl: 'views/accounting/accounting_office_mapping.html' + .when('/addfinancialmapping', { + templateUrl: 'views/accounting/add_financial_accounting_mapping.html' }); $locationProvider.html5Mode(false); }; diff --git a/app/scripts/services/ResourceFactoryProvider.js b/app/scripts/services/ResourceFactoryProvider.js index 93ad5a97..5ea10d39 100644 --- a/app/scripts/services/ResourceFactoryProvider.js +++ b/app/scripts/services/ResourceFactoryProvider.js @@ -366,6 +366,7 @@ }), officeToGLAccountMappingResource: defineResource(apiVer + "/financialactivityaccounts/:mappingId", {mappingId: '@mappingId'}, { get: {method: 'GET', params: {mappingId: '@mappingId'}}, + getAll: {method: 'GET', params: {}, isArray: true}, withTemplate: {method: 'GET', params: {mappingId: '@mappingId', template: 'true'}}, search: {method: 'GET', params: {}}, create: {method: 'POST', params: {}}, diff --git a/app/views/accounting/accounting.html b/app/views/accounting/accounting.html index f57fd2f0..422751d7 100755 --- a/app/views/accounting/accounting.html +++ b/app/views/accounting/accounting.html @@ -20,11 +20,11 @@

{{ 'label.advancesearchoptionforjournalentries' | translate}}

- +

  {{ - 'label.heading.officeglaccounts' | translate}}

+ 'label.heading.financialactivity.accountmappings' | translate}} -

{{ 'label.listofofficeglaccounts' | translate}}

+

{{ 'label.listof.financialactivity.accountmappings' | translate}}

diff --git a/app/views/accounting/accounting_office_mapping.html b/app/views/accounting/accounting_office_mapping.html deleted file mode 100755 index eb7b160f..00000000 --- a/app/views/accounting/accounting_office_mapping.html +++ /dev/null @@ -1,46 +0,0 @@ -
-
- -
- {{ 'label.heading.viewofficeglaccount' | translate }} -
- -
- -
-

{{rule.name}}

- - - - - - - - - - -
Financial ActivityLiability Transfer
{{ 'label.heading.trasnferaccpuntsuspence' | translate }}{{mapping.glAccountData.name}}
-
-
-
\ No newline at end of file diff --git a/app/views/accounting/add_financial_accounting_mapping.html b/app/views/accounting/add_financial_accounting_mapping.html new file mode 100644 index 00000000..8e0dd673 --- /dev/null +++ b/app/views/accounting/add_financial_accounting_mapping.html @@ -0,0 +1,48 @@ +
+ +
+ +
+ {{'label.heading.add.financial.activity.mapping' | translate}} +
+ + +
+ +
+
+
+ + +
+ +
+
+ +
+ {{'label.button.cancel' + | translate}} + +
+
+
+
\ No newline at end of file diff --git a/app/views/accounting/createofficeglaccount.html b/app/views/accounting/createofficeglaccount.html deleted file mode 100755 index b5fec15b..00000000 --- a/app/views/accounting/createofficeglaccount.html +++ /dev/null @@ -1,29 +0,0 @@ -
- -
-
- - {{ 'label.heading.createofficeglaccount' | translate }} - -
- - -
- -
-
- -
- {{ 'label.button.cancel' | translate }} - -
-
\ No newline at end of file diff --git a/app/views/accounting/edit_financial_activity_mapping.html b/app/views/accounting/edit_financial_activity_mapping.html new file mode 100644 index 00000000..1ea9c3e6 --- /dev/null +++ b/app/views/accounting/edit_financial_activity_mapping.html @@ -0,0 +1,46 @@ +
+ +
+ +
+ {{'label.heading.edit.financial.activity.mapping' | translate}} +
+ + +
+ +
+
+
+ + +
+ +
+
+ +
+ {{'label.button.cancel' + | translate}} + +
+
+
+
\ No newline at end of file diff --git a/app/views/accounting/editofficeglaccount.html b/app/views/accounting/editofficeglaccount.html deleted file mode 100755 index 81ac55ce..00000000 --- a/app/views/accounting/editofficeglaccount.html +++ /dev/null @@ -1,30 +0,0 @@ -
- -
-
- - {{ 'label.heading.editofficeglaccount' | translate }} - - -
- - -
- -
-
- -
- {{ 'label.button.cancel' | translate }} - -
-
\ No newline at end of file diff --git a/app/views/accounting/financial_accounting_mapping.html b/app/views/accounting/financial_accounting_mapping.html new file mode 100644 index 00000000..71ce05bf --- /dev/null +++ b/app/views/accounting/financial_accounting_mapping.html @@ -0,0 +1,26 @@ +
+
+ +
+ + + + + + + + + + + + + + +
{{'label.heading.financial.account.type' | translate}}{{'label.heading.financial.account.name' | translate}}
{{mapping.financialActivityData.mappedGLAccountType}}{{mapping.glAccountData.name}}({{mapping.glAccountData.glCode}})
+
\ No newline at end of file diff --git a/app/views/accounting/view_financial_activity.html b/app/views/accounting/view_financial_activity.html new file mode 100644 index 00000000..40eacd5e --- /dev/null +++ b/app/views/accounting/view_financial_activity.html @@ -0,0 +1,43 @@ +
+ + {{ 'label.heading.viewfinancialmapping' | translate }} +
+ +
+ + + + + + + + + + + +
{{'label.heading.financialactivity' | translate}}{{mapping.financialActivityData.name | translate }}
{{ 'label.heading.financial.account.name' | translate }}{{mapping.glAccountData.name}}({{mapping.glAccountData.glCode}})
+
\ No newline at end of file diff --git a/app/views/accounting/viewofficeglaccount.html b/app/views/accounting/viewofficeglaccount.html deleted file mode 100755 index eb7b160f..00000000 --- a/app/views/accounting/viewofficeglaccount.html +++ /dev/null @@ -1,46 +0,0 @@ -
-
- -
- {{ 'label.heading.viewofficeglaccount' | translate }} -
- -
- -
-

{{rule.name}}

- - - - - - - - - - -
Financial ActivityLiability Transfer
{{ 'label.heading.trasnferaccpuntsuspence' | translate }}{{mapping.glAccountData.name}}
-
-
-
\ No newline at end of file