From 11161cce51eda8f7ade0668f82769c012d1620f9 Mon Sep 17 00:00:00 2001 From: nikpawar89 Date: Mon, 3 Jul 2017 19:43:48 +0530 Subject: [PATCH] family members --- app/global-translations/locale-en.json | 9 ++ .../client/AddFamilyMembersController.js | 60 +++++++ .../client/CreateClientController.js | 92 ++++++++++- .../client/EditFamilyMemberController.js | 76 +++++++++ .../client/ViewClientController.js | 53 ++++++ app/scripts/mifosXComponents.js | 7 +- app/scripts/routes.js | 8 +- .../services/ResourceFactoryProvider.js | 21 ++- app/views/clients/addfamilymembers.html | 149 +++++++++++++++++ app/views/clients/createclient.html | 149 +++++++++++++++++ app/views/clients/editfamilymembers.html | 152 ++++++++++++++++++ app/views/clients/viewclient.html | 145 +++++++++++++++++ .../client/ViewClientControllerSpec.js | 15 ++ 13 files changed, 931 insertions(+), 5 deletions(-) create mode 100644 app/scripts/controllers/client/AddFamilyMembersController.js create mode 100644 app/scripts/controllers/client/EditFamilyMemberController.js create mode 100644 app/views/clients/addfamilymembers.html create mode 100644 app/views/clients/editfamilymembers.html diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 97c8108c..b680b442 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -196,6 +196,12 @@ "label.input.firstname": "First name", "label.input.lastname": "Last name", "label.input.middlename": "Middle name", + "label.input.qualification":"Qualification", + "label.input.mobileNumber":"Mobile Number", + "label.input.age":"age", + "label.input.isDependent":"is Dependent?", + "label.input.maritalstatus":"Marital Status", + "label.input.profession":"Profession", "label.input.fullname": "Name", "label.input.legalForm": "Legal Form", "label.input.accno": "Account#", @@ -599,6 +605,7 @@ "#Headings": "..", "label.heading.address":"Address", + "label.heading.familymembers":"Family Members", "label.heading.identities": "Identities", "label.heading.uniqueidentification": "Unique ID #", "label.heading.identitydocs": "Identity Documents", @@ -1067,6 +1074,8 @@ "journalEntrytType.debit": "Debit", "#Buttons": "..", + "label.button.addAddress":"Add Address", + "label.button.addfamilymember":"Add Family Member", "label.button.listview": "List View", "label.button.treeview": "Tree View", "label.button.addaccount": "Add Account", diff --git a/app/scripts/controllers/client/AddFamilyMembersController.js b/app/scripts/controllers/client/AddFamilyMembersController.js new file mode 100644 index 00000000..14b9a5d3 --- /dev/null +++ b/app/scripts/controllers/client/AddFamilyMembersController.js @@ -0,0 +1,60 @@ +/** + * Created by nikpa on 26-06-2017. + */ + +(function (module) { + mifosX.controllers = _.extend(module, { + AddFamilyMembersController: function (scope, resourceFactory, routeParams,dateFilter, location) { + + scope.formData={}; + scope.date = {}; + clientId=routeParams.clientId; + familyMemberId=routeParams.familyMemberId; + + resourceFactory.familyMemberTemplate.get({clientId:clientId},function(data) + { + scope.relationshipIdOptions=data.relationshipIdOptions; + scope.genderIdOptions=data.genderIdOptions; + scope.maritalStatusIdOptions=data.maritalStatusIdOptions; + scope.professionIdOptions=data.professionIdOptions; + + }); + + + + + + scope.routeTo=function() + { + location.path('/viewclient/'+clientId); + } + + scope.addClientMember=function() + { + + + this.formData.locale = scope.optlang.code; + this.formData.dateFormat = scope.df; + + if(scope.date.dateOfBirth){ + this.formData.dateOfBirth = dateFilter(scope.date.dateOfBirth, scope.df); + } + resourceFactory.familyMembers.post({clientId:clientId},scope.formData,function(data) + { + + location.path('/viewclient/'+clientId); + + + }) + } + + } + + + }); + mifosX.ng.application.controller('AddFamilyMembersController', ['$scope','ResourceFactory', '$routeParams','dateFilter', '$location', mifosX.controllers.AddFamilyMembersController]).run(function ($log) { + $log.info("AddFamilyMemberController initialized"); + }); + +} +(mifosX.controllers || {})); diff --git a/app/scripts/controllers/client/CreateClientController.js b/app/scripts/controllers/client/CreateClientController.js index aea35249..78a25a79 100755 --- a/app/scripts/controllers/client/CreateClientController.js +++ b/app/scripts/controllers/client/CreateClientController.js @@ -26,6 +26,9 @@ entityname="ADDRESS"; scope.addressArray=[]; scope.formData.address=[]; + //familymembers + scope.formData.familyMembers=[]; + scope.familyArray=[]; scope.datatables = []; scope.noOfTabs = 1; scope.step = '-'; @@ -124,6 +127,14 @@ } + + scope.relationshipIdOptions=data.familyMemberOptions.relationshipIdOptions; + scope.genderIdOptions=data.familyMemberOptions.genderIdOptions; + scope.maritalStatusIdOptions=data.familyMemberOptions.maritalStatusIdOptions; + scope.professionIdOptions=data.familyMemberOptions.professionIdOptions; + + + }); scope.updateColumnHeaders = function(columnHeaderData) { @@ -153,7 +164,23 @@ -// end of address + // end of address + + + // family members + + scope.addFamilyMember=function() + { + scope.familyArray.push({}); + } + + scope.removeFamilyMember=function(index) + { + scope.familyArray.splice(index,1); + } + + + // end of family members @@ -356,6 +383,69 @@ } + // family array + + for(var i=0;i + + +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + +
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+ + +
+ +
+ +
+ + +
+ + + + + + +
+ +
+ +
+ \ No newline at end of file diff --git a/app/views/clients/createclient.html b/app/views/clients/createclient.html index dc4de83b..fce912ae 100755 --- a/app/views/clients/createclient.html +++ b/app/views/clients/createclient.html @@ -273,6 +273,155 @@ +
+
+
+

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

+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ + +
+ +
+ +
+ + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+ + +
+ +
+ +
+ + + + + + +
+ +
+
diff --git a/app/views/clients/editfamilymembers.html b/app/views/clients/editfamilymembers.html new file mode 100644 index 00000000..5e08a61f --- /dev/null +++ b/app/views/clients/editfamilymembers.html @@ -0,0 +1,152 @@ +
+ + +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + +
+ + +
+ +
+ +
+ + +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ +
+ + +
+ +
+ +
+ + + + +
+
+ +
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ + +
+
+ +
+
+ +
+
+ +
+ + +
+ +
+ +
+ + +
+ + + + + + +
+ +
+ +
+
\ No newline at end of file diff --git a/app/views/clients/viewclient.html b/app/views/clients/viewclient.html index 908bb135..7a8998e6 100755 --- a/app/views/clients/viewclient.html +++ b/app/views/clients/viewclient.html @@ -746,6 +746,151 @@ + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{family.relationship}} + + + +
+ {{'label.input.firstname' | translate }} + + {{family.firstName}} +
+ {{'label.input.middlename' | translate }} + + {{family.middleName}} +
+ {{'label.input.lastname' | translate }} + + {{family.lastName}} +
+ {{'label.input.qualification' | translate }} + + {{family.qualification}} +
+ {{'label.input.mobileNumber' | translate }} + + {{family.mobileNumber}} +
+ {{'label.input.age' | translate }} + + {{family.age}} +
+ {{'label.input.isDependent' | translate }} + + {{family.isDependent}} +
+ {{'label.input.maritalstatus' | translate }} + + {{family.maritalStatus}} +
+ {{'label.input.gender' | translate }} + + {{family.gender}} +
+ {{'label.input.profession' | translate }} + + {{family.profession}} +
+ {{'label.input.dateofbirth' | translate }} + + {{family.dateOfBirth | DateFormat }} +
+ +
+
+ + + +
diff --git a/test/spec/controllers/client/ViewClientControllerSpec.js b/test/spec/controllers/client/ViewClientControllerSpec.js index 2e39b2ce..743c7a53 100644 --- a/test/spec/controllers/client/ViewClientControllerSpec.js +++ b/test/spec/controllers/client/ViewClientControllerSpec.js @@ -8,6 +8,21 @@ describe("ViewClientController", function () { this.scope = {}; this.resourceFactory = { + familyMember:{ + get:jasmine.createSpy('familyMember.get()').andCallFake(function(query, callback){ + familyMemberCallback=callback; + }) + }, + familyMembers:{ + get:jasmine.createSpy('familyMembers.get()').andCallFake(function(query, callback){ + familyMembersCallback=callback; + }) + }, + familyMemberTemplate:{ + get:jasmine.createSpy('familyMemberTemplate.get()').andCallFake(function(query, callback){ + familyMemberTemplateCallback=callback; + }) + }, addressFieldConfiguration:{ get:jasmine.createSpy('addressFieldConfiguration.get()').andCallFake(function(query, callback){ addressFieldConfigurationCallback=callback;