reformatting project

This commit is contained in:
Vishwas Babu A J 2014-03-02 04:09:27 -08:00
parent 3de104e7c8
commit 294d541013
391 changed files with 25838 additions and 22732 deletions

View File

@ -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<data.length;i++){
if (data[i].type.value == "ASSET") {
if (data[i].parentId == null) data[i].parentId = -1;
} else if (data[i].type.value == "LIABILITY") {
if (data[i].parentId == null) data[i].parentId = -2;
} else if (data[i].type.value == "EQUITY") {
if (data[i].parentId == null) data[i].parentId = -3;
} else if (data[i].type.value == "INCOME") {
if (data[i].parentId == null) data[i].parentId = -4;
} else if (data[i].type.value == "EXPENSE") {
if (data[i].parentId == null) data[i].parentId = -5;
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;
}
delete data[i].disabled;
delete data[i].manualEntriesAllowed;
delete data[i].type;
delete data[i].usage;
delete data[i].description;
delete data[i].nameDecorated;
delete data[i].tagId;
data[i].children = [];
idToNodeMap[data[i].id] = data[i];
}
function sortByParentId(a, b){
return a.parentId - b.parentId;
}
data.sort(sortByParentId);
var glAccountsArray = rootArray.concat(data);
resourceFactory.accountCoaResource.getAllAccountCoas(function (data) {
scope.coadatas = scope.deepCopy(data);
var root = [];
for(var i = 0; i < glAccountsArray.length; i++) {
var currentObj = glAccountsArray[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;
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 < data.length; i++) {
if (data[i].type.value == "ASSET") {
if (data[i].parentId == null) data[i].parentId = -1;
} else if (data[i].type.value == "LIABILITY") {
if (data[i].parentId == null) data[i].parentId = -2;
} else if (data[i].type.value == "EQUITY") {
if (data[i].parentId == null) data[i].parentId = -3;
} else if (data[i].type.value == "INCOME") {
if (data[i].parentId == null) data[i].parentId = -4;
} else if (data[i].type.value == "EXPENSE") {
if (data[i].parentId == null) data[i].parentId = -5;
}
delete data[i].disabled;
delete data[i].manualEntriesAllowed;
delete data[i].type;
delete data[i].usage;
delete data[i].description;
delete data[i].nameDecorated;
delete data[i].tagId;
data[i].children = [];
idToNodeMap[data[i].id] = data[i];
}
function sortByParentId(a, b) {
return a.parentId - b.parentId;
}
data.sort(sortByParentId);
var glAccountsArray = rootArray.concat(data);
var root = [];
for (var i = 0; i < glAccountsArray.length; i++) {
var currentObj = glAccountsArray[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('AccCoaController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.AccCoaController]).run(function($log) {
$log.info("AccCoaController initialized");
});
});
}
});
mifosX.ng.application.controller('AccCoaController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCoaController]).run(function ($log) {
$log.info("AccCoaController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,57 +1,57 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccCreateGLAccountController: function(scope, resourceFactory, location) {
scope.coadata = [];
scope.accountTypes = [];
scope.usageTypes = [];
scope.headerTypes = [];
resourceFactory.accountCoaTemplateResource.get({type: '0'}, function(data) {
scope.coadata = data;
scope.accountTypes = data.accountTypeOptions;
scope.usageTypes = data.usageOptions;
(function (module) {
mifosX.controllers = _.extend(module, {
AccCreateGLAccountController: function (scope, resourceFactory, location) {
scope.coadata = [];
scope.accountTypes = [];
scope.usageTypes = [];
scope.headerTypes = [];
scope.formData = {
manualEntriesAllowed: true,
type: scope.accountTypes[0].id,
usage: scope.usageTypes[0].id,
resourceFactory.accountCoaTemplateResource.get({type: '0'}, function (data) {
scope.coadata = data;
scope.accountTypes = data.accountTypeOptions;
scope.usageTypes = data.usageOptions;
scope.formData = {
manualEntriesAllowed: true,
type: scope.accountTypes[0].id,
usage: scope.usageTypes[0].id,
};
//by default display assetTagsOptions and assetHeaderAccountOptions
scope.types = data.allowedAssetsTagOptions,
scope.headerTypes = data.assetHeaderAccountOptions
scope.changeType = function (value) {
if (value == 1) {
scope.types = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions
} else if (value == 2) {
scope.types = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if (value == 3) {
scope.types = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if (value == 4) {
scope.types = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if (value == 5) {
scope.types = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
}
});
scope.submit = function () {
resourceFactory.accountCoaResource.save(this.formData, function (data) {
location.path('/viewglaccount/' + data.resourceId);
});
};
//by default display assetTagsOptions and assetHeaderAccountOptions
scope.types = data.allowedAssetsTagOptions,
scope.headerTypes = data.assetHeaderAccountOptions
scope.changeType = function (value) {
if(value == 1) {
scope.types = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions
} else if(value == 2) {
scope.types = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if(value == 3) {
scope.types = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if(value == 4) {
scope.types = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if(value == 5) {
scope.types = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
}
});
scope.submit = function() {
resourceFactory.accountCoaResource.save(this.formData,function(data){
location.path('/viewglaccount/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('AccCreateGLAccountController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCreateGLAccountController]).run(function($log) {
$log.info("AccCreateGLAccountController initialized");
});
}
});
mifosX.ng.application.controller('AccCreateGLAccountController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCreateGLAccountController]).run(function ($log) {
$log.info("AccCreateGLAccountController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,89 +1,89 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccCreateRuleController: function(scope, resourceFactory, location) {
(function (module) {
mifosX.controllers = _.extend(module, {
AccCreateRuleController: function (scope, resourceFactory, location) {
scope.formData = {};
scope.creditRuleType='Account';
scope.debitRuleType='Account';
scope.formData.creditTags=[];
scope.formData.debitTags=[];
scope.formData = {};
scope.creditRuleType = 'Account';
scope.debitRuleType = 'Account';
scope.formData.creditTags = [];
scope.formData.debitTags = [];
resourceFactory.accountingRulesTemplateResource.get(function(data){
scope.glAccounts = data.allowedAccounts;
scope.offices = data.allowedOffices;
scope.creditTagOptions = data.allowedCreditTagOptions;
scope.debitTagOptions = data.allowedDebitTagOptions;
scope.formData.officeId = scope.offices[0].id;
scope.formData.accountToCredit = scope.glAccounts[0];
scope.formData.accountToDebit = scope.glAccounts[1];
});
scope.addCreditTag = function () {
if (scope.formData.creditTagTemplate != undefined) {
scope.formData.creditTags.push({id: scope.formData.creditTagTemplate.id, name: scope.formData.creditTagTemplate.name});
scope.formData.creditTagTemplate = undefined;
}
}
scope.removeCrTag = function (index){
scope.formData.creditTags.splice(index,1);
}
scope.resetCredits = function(){
scope.formData.creditTags = [];
}
scope.addDebitTag = function () {
if (scope.formData.debitTagTemplate != undefined) {
scope.formData.debitTags.push({id: scope.formData.debitTagTemplate.id, name: scope.formData.debitTagTemplate.name});
scope.formData.debitTagTemplate = undefined;
}
}
scope.resetDebits = function (){
scope.formData.debitTags=[];
}
scope.removeDebitTag = function (index){
scope.formData.debitTags.splice(index,1);
}
scope.submit = function() {
var accountingRule = new Object();
accountingRule.name=this.formData.name;
accountingRule.officeId=this.formData.officeId;
accountingRule.description = this.formData.description;
//Construct creditsTags array
if (this.creditRuleType == 'tags') {
accountingRule.allowMultipleCreditEntries=this.formData.allowMultipleCreditEntries;
accountingRule.creditTags = [];
for (var i = 0; i < this.formData.creditTags.length; i++) {
accountingRule.creditTags.push(this.formData.creditTags[i].id);
}
} else{
accountingRule.accountToCredit = this.formData.accountToCredit.id;
}
//Construct debitTags array
if (this.debitRuleType == 'tags') {
accountingRule.allowMultipleDebitEntries=this.formData.allowMultipleDebitEntries;
accountingRule.debitTags = [];
for (var i = 0; i < this.formData.debitTags.length; i++) {
accountingRule.debitTags.push(this.formData.debitTags[i].id);
}
} else{
accountingRule.accountToDebit = this.formData.accountToDebit.id;
}
resourceFactory.accountingRulesResource.save(accountingRule,function(data){
location.path('/viewaccrule/'+data.resourceId);
resourceFactory.accountingRulesTemplateResource.get(function (data) {
scope.glAccounts = data.allowedAccounts;
scope.offices = data.allowedOffices;
scope.creditTagOptions = data.allowedCreditTagOptions;
scope.debitTagOptions = data.allowedDebitTagOptions;
scope.formData.officeId = scope.offices[0].id;
scope.formData.accountToCredit = scope.glAccounts[0];
scope.formData.accountToDebit = scope.glAccounts[1];
});
}
}
});
mifosX.ng.application.controller('AccCreateRuleController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCreateRuleController]).run(function($log) {
$log.info("AccCreateRuleController initialized");
});
scope.addCreditTag = function () {
if (scope.formData.creditTagTemplate != undefined) {
scope.formData.creditTags.push({id: scope.formData.creditTagTemplate.id, name: scope.formData.creditTagTemplate.name});
scope.formData.creditTagTemplate = undefined;
}
}
scope.removeCrTag = function (index) {
scope.formData.creditTags.splice(index, 1);
}
scope.resetCredits = function () {
scope.formData.creditTags = [];
}
scope.addDebitTag = function () {
if (scope.formData.debitTagTemplate != undefined) {
scope.formData.debitTags.push({id: scope.formData.debitTagTemplate.id, name: scope.formData.debitTagTemplate.name});
scope.formData.debitTagTemplate = undefined;
}
}
scope.resetDebits = function () {
scope.formData.debitTags = [];
}
scope.removeDebitTag = function (index) {
scope.formData.debitTags.splice(index, 1);
}
scope.submit = function () {
var accountingRule = new Object();
accountingRule.name = this.formData.name;
accountingRule.officeId = this.formData.officeId;
accountingRule.description = this.formData.description;
//Construct creditsTags array
if (this.creditRuleType == 'tags') {
accountingRule.allowMultipleCreditEntries = this.formData.allowMultipleCreditEntries;
accountingRule.creditTags = [];
for (var i = 0; i < this.formData.creditTags.length; i++) {
accountingRule.creditTags.push(this.formData.creditTags[i].id);
}
} else {
accountingRule.accountToCredit = this.formData.accountToCredit.id;
}
//Construct debitTags array
if (this.debitRuleType == 'tags') {
accountingRule.allowMultipleDebitEntries = this.formData.allowMultipleDebitEntries;
accountingRule.debitTags = [];
for (var i = 0; i < this.formData.debitTags.length; i++) {
accountingRule.debitTags.push(this.formData.debitTags[i].id);
}
} else {
accountingRule.accountToDebit = this.formData.accountToDebit.id;
}
resourceFactory.accountingRulesResource.save(accountingRule, function (data) {
location.path('/viewaccrule/' + data.resourceId);
});
}
}
});
mifosX.ng.application.controller('AccCreateRuleController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AccCreateRuleController]).run(function ($log) {
$log.info("AccCreateRuleController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,77 +1,77 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccEditGLAccountController: function(scope, routeParams, resourceFactory, location) {
scope.coadata = [];
scope.accountTypes = [];
scope.usageTypes = [];
scope.headerTypes = [];
scope.accountOptions = [];
(function (module) {
mifosX.controllers = _.extend(module, {
AccEditGLAccountController: function (scope, routeParams, resourceFactory, location) {
scope.coadata = [];
scope.accountTypes = [];
scope.usageTypes = [];
scope.headerTypes = [];
scope.accountOptions = [];
resourceFactory.accountCoaResource.get({glAccountId: routeParams.id, template: 'true'}, function(data) {
scope.coadata = data;
scope.glAccountId = data.id;
scope.accountTypes = data.accountTypeOptions;
scope.usageTypes = data.usageOptions;
scope.formData = {
name : data.name,
glCode : data.glCode,
manualEntriesAllowed : data.manualEntriesAllowed,
description : data.description,
type : data.type.id,
tagId : data.tagId.id,
usage : data.usage.id,
parentId : data.parentId
};
resourceFactory.accountCoaResource.get({glAccountId: routeParams.id, template: 'true'}, function (data) {
scope.coadata = data;
scope.glAccountId = data.id;
scope.accountTypes = data.accountTypeOptions;
scope.usageTypes = data.usageOptions;
scope.formData = {
name: data.name,
glCode: data.glCode,
manualEntriesAllowed: data.manualEntriesAllowed,
description: data.description,
type: data.type.id,
tagId: data.tagId.id,
usage: data.usage.id,
parentId: data.parentId
};
//to display tag name on i/p field
if(data.type.value == "ASSET") {
scope.tags = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions;
} else if(data.type.value == "LIABILITY") {
scope.tags = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if(data.type.value == "EQUITY") {
scope.tags = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if(data.type.value == "INCOME") {
scope.tags = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if(data.type.value == "EXPENSE") {
scope.tags = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
//to display tag name on i/p field
if (data.type.value == "ASSET") {
scope.tags = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions;
} else if (data.type.value == "LIABILITY") {
scope.tags = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if (data.type.value == "EQUITY") {
scope.tags = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if (data.type.value == "INCOME") {
scope.tags = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if (data.type.value == "EXPENSE") {
scope.tags = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
//this function calls when change account types
scope.changeType = function (value) {
if(value == 1) {
scope.tags = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions;
} else if(value == 2) {
scope.tags = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if(value == 3) {
scope.tags = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if(value == 4) {
scope.tags = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if(value == 5) {
scope.tags = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
}
});
//this function calls when change account types
scope.changeType = function (value) {
if (value == 1) {
scope.tags = data.allowedAssetsTagOptions;
scope.headerTypes = data.assetHeaderAccountOptions;
} else if (value == 2) {
scope.tags = data.allowedLiabilitiesTagOptions;
scope.headerTypes = data.liabilityHeaderAccountOptions;
} else if (value == 3) {
scope.tags = data.allowedEquityTagOptions;
scope.headerTypes = data.equityHeaderAccountOptions;
} else if (value == 4) {
scope.tags = data.allowedIncomeTagOptions;
scope.headerTypes = data.incomeHeaderAccountOptions;
} else if (value == 5) {
scope.tags = data.allowedExpensesTagOptions;
scope.headerTypes = data.expenseHeaderAccountOptions;
}
}
scope.submit = function() {
resourceFactory.accountCoaResource.update({'glAccountId': routeParams.id},this.formData,function(data){
location.path('/viewglaccount/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('AccEditGLAccountController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.AccEditGLAccountController]).run(function($log) {
$log.info("AccEditGLAccountController initialized");
});
scope.submit = function () {
resourceFactory.accountCoaResource.update({'glAccountId': routeParams.id}, this.formData, function (data) {
location.path('/viewglaccount/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('AccEditGLAccountController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.AccEditGLAccountController]).run(function ($log) {
$log.info("AccEditGLAccountController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,130 +1,130 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccEditRuleController: function(scope, resourceFactory, location, routeParams) {
(function (module) {
mifosX.controllers = _.extend(module, {
AccEditRuleController: function (scope, resourceFactory, location, routeParams) {
scope.formData = {};
scope.creditRuleType='Account';
scope.debitRuleType='Account';
scope.formData.creditTags=[];
scope.formData.debitTags=[];
scope.offices=[];
scope.formData = {};
scope.creditRuleType = 'Account';
scope.debitRuleType = 'Account';
scope.formData.creditTags = [];
scope.formData.debitTags = [];
scope.offices = [];
resourceFactory.accountingRulesResource.getById({accountingRuleId:routeParams.id, template:true},function(data){
//Initialize the template options
scope.glAccounts = data.allowedAccounts;
scope.offices = data.allowedOffices;
scope.creditTagOptions = data.allowedCreditTagOptions;
scope.debitTagOptions = data.allowedDebitTagOptions;
scope.accountingRuleId = data.id;
//update text fields
scope.formData.name = data.name;
scope.formData.officeId = data.officeId;
scope.formData.description=data.description;
resourceFactory.accountingRulesResource.getById({accountingRuleId: routeParams.id, template: true}, function (data) {
//Initialize the template options
scope.glAccounts = data.allowedAccounts;
scope.offices = data.allowedOffices;
scope.creditTagOptions = data.allowedCreditTagOptions;
scope.debitTagOptions = data.allowedDebitTagOptions;
scope.accountingRuleId = data.id;
//update text fields
scope.formData.name = data.name;
scope.formData.officeId = data.officeId;
scope.formData.description = data.description;
//update formData for view previous details.
for (var i = 0; i < data.allowedOffices.length; i++) {
if (data.officeId == data.allowedOffices[i].id) {
scope.formData.office = data.allowedOffices[i].id;
}
}
//update formData for view previous details.
for (var i = 0; i < data.allowedOffices.length; i++) {
if (data.officeId == data.allowedOffices[i].id) {
scope.formData.office = data.allowedOffices[i].id;
}
}
//update credits
if (data.creditAccounts) {
//if the selected type is account then creditAccounts array will have only 1 account, which is a selected account.
scope.formData.accountToCredit = data.creditAccounts[0].id;
scope.creditRuleType='Account';
} else{
//if the selected type is tags then push the tags into creditTags array
scope.formData.creditTags = [];
scope.creditRuleType='tags';
scope.formData.allowMultipleCreditEntries=data.allowMultipleCreditEntries;
for (var i = 0; i < data.creditTags.length; i++) {
scope.formData.creditTags.push(data.creditTags[i].tag);
}
}
//update credits
if (data.creditAccounts) {
//if the selected type is account then creditAccounts array will have only 1 account, which is a selected account.
scope.formData.accountToCredit = data.creditAccounts[0].id;
scope.creditRuleType = 'Account';
} else {
//if the selected type is tags then push the tags into creditTags array
scope.formData.creditTags = [];
scope.creditRuleType = 'tags';
scope.formData.allowMultipleCreditEntries = data.allowMultipleCreditEntries;
for (var i = 0; i < data.creditTags.length; i++) {
scope.formData.creditTags.push(data.creditTags[i].tag);
}
}
//update debits
if (data.debitAccounts) {
//if the selected type is account then debitAccounts array will have only 1 account, which is a selected account.
scope.formData.accountToDebit = data.debitAccounts[0].id;
scope.debitRuleType='Account';
} else{
//if the selected type is tags then push the tags into debitTags array
scope.formData.debitTags = [];
scope.debitRuleType='tags';
scope.formData.allowMultipleDebitEntries = data.allowMultipleDebitEntries;
for (var i = 0; i < data.debitTags.length; i++) {
scope.formData.debitTags.push(data.debitTags[i].tag);
}
}
});
scope.addCreditTag = function () {
if (scope.formData.creditTagTemplate != undefined) {
scope.formData.creditTags.push({id: scope.formData.creditTagTemplate.id, name: scope.formData.creditTagTemplate.name});
scope.formData.creditTagTemplate = undefined;
}
}
scope.removeCrTag = function (index){
scope.formData.creditTags.splice(index,1);
}
scope.resetCredits = function(){
scope.formData.creditTags = [];
}
scope.addDebitTag = function () {
if (scope.formData.debitTagTemplate != undefined) {
scope.formData.debitTags.push({id: scope.formData.debitTagTemplate.id, name: scope.formData.debitTagTemplate.name});
scope.formData.debitTagTemplate = undefined;
}
}
scope.resetDebits = function (){
scope.formData.debitTags=[];
}
scope.removeDebitTag = function (index){
scope.formData.debitTags.splice(index,1);
}
scope.submit = function() {
var accountingRule = new Object();
accountingRule.name=this.formData.name;
accountingRule.officeId=this.formData.officeId;
accountingRule.description = this.formData.description;
//Construct creditsTags array
if (this.creditRuleType == 'tags') {
accountingRule.allowMultipleCreditEntries=this.formData.allowMultipleCreditEntries;
accountingRule.creditTags = [];
for (var i = 0; i < this.formData.creditTags.length; i++) {
accountingRule.creditTags.push(this.formData.creditTags[i].id);
}
} else{
accountingRule.accountToCredit = this.formData.accountToCredit;
}
//Construct debitTags array
if (this.debitRuleType == 'tags') {
accountingRule.allowMultipleDebitEntries=this.formData.allowMultipleDebitEntries;
accountingRule.debitTags = [];
for (var i = 0; i < this.formData.debitTags.length; i++) {
accountingRule.debitTags.push(this.formData.debitTags[i].id);
}
} else{
accountingRule.accountToDebit = this.formData.accountToDebit;
}
resourceFactory.accountingRulesResource.update( {accountingRuleId:routeParams.id}, accountingRule, function(data){
location.path('/viewaccrule/'+data.resourceId);
//update debits
if (data.debitAccounts) {
//if the selected type is account then debitAccounts array will have only 1 account, which is a selected account.
scope.formData.accountToDebit = data.debitAccounts[0].id;
scope.debitRuleType = 'Account';
} else {
//if the selected type is tags then push the tags into debitTags array
scope.formData.debitTags = [];
scope.debitRuleType = 'tags';
scope.formData.allowMultipleDebitEntries = data.allowMultipleDebitEntries;
for (var i = 0; i < data.debitTags.length; i++) {
scope.formData.debitTags.push(data.debitTags[i].tag);
}
}
});
}
}
});
mifosX.ng.application.controller('AccEditRuleController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.AccEditRuleController]).run(function($log) {
$log.info("AccEditRuleController initialized");
});
scope.addCreditTag = function () {
if (scope.formData.creditTagTemplate != undefined) {
scope.formData.creditTags.push({id: scope.formData.creditTagTemplate.id, name: scope.formData.creditTagTemplate.name});
scope.formData.creditTagTemplate = undefined;
}
}
scope.removeCrTag = function (index) {
scope.formData.creditTags.splice(index, 1);
}
scope.resetCredits = function () {
scope.formData.creditTags = [];
}
scope.addDebitTag = function () {
if (scope.formData.debitTagTemplate != undefined) {
scope.formData.debitTags.push({id: scope.formData.debitTagTemplate.id, name: scope.formData.debitTagTemplate.name});
scope.formData.debitTagTemplate = undefined;
}
}
scope.resetDebits = function () {
scope.formData.debitTags = [];
}
scope.removeDebitTag = function (index) {
scope.formData.debitTags.splice(index, 1);
}
scope.submit = function () {
var accountingRule = new Object();
accountingRule.name = this.formData.name;
accountingRule.officeId = this.formData.officeId;
accountingRule.description = this.formData.description;
//Construct creditsTags array
if (this.creditRuleType == 'tags') {
accountingRule.allowMultipleCreditEntries = this.formData.allowMultipleCreditEntries;
accountingRule.creditTags = [];
for (var i = 0; i < this.formData.creditTags.length; i++) {
accountingRule.creditTags.push(this.formData.creditTags[i].id);
}
} else {
accountingRule.accountToCredit = this.formData.accountToCredit;
}
//Construct debitTags array
if (this.debitRuleType == 'tags') {
accountingRule.allowMultipleDebitEntries = this.formData.allowMultipleDebitEntries;
accountingRule.debitTags = [];
for (var i = 0; i < this.formData.debitTags.length; i++) {
accountingRule.debitTags.push(this.formData.debitTags[i].id);
}
} else {
accountingRule.accountToDebit = this.formData.accountToDebit;
}
resourceFactory.accountingRulesResource.update({accountingRuleId: routeParams.id}, accountingRule, function (data) {
location.path('/viewaccrule/' + data.resourceId);
});
}
}
});
mifosX.ng.application.controller('AccEditRuleController', ['$scope', 'ResourceFactory', '$location', '$routeParams', mifosX.controllers.AccEditRuleController]).run(function ($log) {
$log.info("AccEditRuleController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,6 +1,6 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccFreqPostingController: function(scope, resourceFactory, location,dateFilter) {
(function (module) {
mifosX.controllers = _.extend(module, {
AccFreqPostingController: function (scope, resourceFactory, location, dateFilter) {
scope.formData = {};
scope.formData.crAccounts = [];
@ -12,114 +12,114 @@
scope.errordebitevent = false;
scope.restrictDate = new Date();
resourceFactory.accountingRulesResource.getAllRules({associations : 'all'}, function(data){
scope.rules = data;
resourceFactory.accountingRulesResource.getAllRules({associations: 'all'}, function (data) {
scope.rules = 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;
});
//event for rule change
scope.resetCrAndDb = function (rule) {
scope.formData.crAccounts = [];
scope.formData.dbAccounts = [];
scope.formData.creditAccountTemplate = rule.creditAccounts[0];
scope.formData.debitAccountTemplate = rule.debitAccounts[0];
scope.allowCreditEntries = true;
scope.allowDebitEntries = true;
scope.formData.crAccounts = [];
scope.formData.dbAccounts = [];
scope.formData.creditAccountTemplate = rule.creditAccounts[0];
scope.formData.debitAccountTemplate = rule.debitAccounts[0];
scope.allowCreditEntries = true;
scope.allowDebitEntries = true;
}
//events for credits
scope.addCrAccount = function () {
if(scope.formData.crAmountTemplate != undefined){
scope.errorcreditevent = 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.rule) {
if (!scope.formData.rule.allowMultipleCreditEntries) {
scope.allowCreditEntries = false;
}
if (scope.formData.crAmountTemplate != undefined) {
scope.errorcreditevent = 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.rule) {
if (!scope.formData.rule.allowMultipleCreditEntries) {
scope.allowCreditEntries = false;
}
}
} else {
scope.errorcreditevent = true;
}
} else {
scope.errorcreditevent = true;
}
}
scope.removeCrAccount = function(index) {
scope.formData.crAccounts.splice(index,1);
if (scope.formData.crAccounts.length == 0) {
scope.allowCreditEntries = true;
}
scope.removeCrAccount = function (index) {
scope.formData.crAccounts.splice(index, 1);
if (scope.formData.crAccounts.length == 0) {
scope.allowCreditEntries = true;
}
}
//events for debits
scope.addDebitAccount = function () {
if(scope.formData.debitAmountTemplate != undefined){
scope.errordebitevent = 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.rule) {
if (!scope.formData.rule.allowMultipleDebitEntries) {
scope.allowDebitEntries = false;
}
if (scope.formData.debitAmountTemplate != undefined) {
scope.errordebitevent = 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.rule) {
if (!scope.formData.rule.allowMultipleDebitEntries) {
scope.allowDebitEntries = false;
}
}
} else {
scope.errordebitevent = true;
}
} else {
scope.errordebitevent = true;
}
}
scope.removeDebitAccount = function(index) {
scope.formData.dbAccounts.splice(index,1);
if (scope.formData.dbAccounts.length == 0) {
scope.allowDebitEntries = true;
}
scope.removeDebitAccount = function (index) {
scope.formData.dbAccounts.splice(index, 1);
if (scope.formData.dbAccounts.length == 0) {
scope.allowDebitEntries = true;
}
}
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;
if ( this.formData.rule) {
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;
if (this.formData.rule) {
jeTransaction.accountingRule = this.formData.rule.id;
}
jeTransaction.currencyCode = this.formData.currencyCode;
}
jeTransaction.currencyCode = this.formData.currencyCode;
//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('AccFreqPostingController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.AccFreqPostingController]).run(function($log) {
$log.info("AccFreqPostingController initialized");
});
}
});
mifosX.ng.application.controller('AccFreqPostingController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.AccFreqPostingController]).run(function ($log) {
$log.info("AccFreqPostingController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,76 +1,76 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccViewGLAccountContoller: function(scope, routeParams , location, resourceFactory, route,$modal) {
scope.glaccountdata = [];
scope.accountOptions = [];
(function (module) {
mifosX.controllers = _.extend(module, {
AccViewGLAccountContoller: function (scope, routeParams, location, resourceFactory, route, $modal) {
scope.glaccountdata = [];
scope.accountOptions = [];
resourceFactory.accountCoaResource.get({glAccountId: routeParams.id , template: 'true'} , function(data) {
//to display parent name
if(data.type.value == "ASSET") {
scope.accountOptions = data.assetHeaderAccountOptions || [];
for(var i=0; i<scope.accountOptions.length; i++) {
if(scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
resourceFactory.accountCoaResource.get({glAccountId: routeParams.id, template: 'true'}, function (data) {
//to display parent name
if (data.type.value == "ASSET") {
scope.accountOptions = data.assetHeaderAccountOptions || [];
for (var i = 0; i < scope.accountOptions.length; i++) {
if (scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if (data.type.value == "LIABILITY") {
scope.accountOptions = data.liabilityHeaderAccountOptions || [];
for (var i = 0; i < scope.accountOptions.length; i++) {
if (scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if (data.type.value == "EQUITY") {
scope.accountOptions = data.equityHeaderAccountOptions || [];
for (var i = 0; i < scope.accountOptions.length; i++) {
if (scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if (data.type.value == "INCOME") {
scope.accountOptions = data.incomeHeaderAccountOptions || [];
for (var i = 0; i < scope.accountOptions.length; i++) {
if (scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if (data.type.value == "EXPENSE") {
scope.accountOptions = data.expenseHeaderAccountOptions || [];
for (var i = 0; i < scope.accountOptions.length; i++) {
if (scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
}
}
} else if(data.type.value == "LIABILITY") {
scope.accountOptions = data.liabilityHeaderAccountOptions || [];
for(var i=0; i<scope.accountOptions.length; i++) {
if(scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if(data.type.value == "EQUITY") {
scope.accountOptions = data.equityHeaderAccountOptions || [];
for(var i=0; i<scope.accountOptions.length; i++) {
if(scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if(data.type.value == "INCOME") {
scope.accountOptions = data.incomeHeaderAccountOptions || [];
for(var i=0; i<scope.accountOptions.length; i++) {
if(scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
} else if(data.type.value == "EXPENSE") {
scope.accountOptions = data.expenseHeaderAccountOptions || [];
for(var i=0; i<scope.accountOptions.length; i++) {
if(scope.accountOptions[i].id == data.parentId) {
data.parentName = scope.accountOptions[i].name;
}
}
}
scope.glaccount = data;
});
scope.deleteGLAccount = function (){
$modal.open({
templateUrl: 'deleteglacc.html',
controller: GlAccDeleteCtrl
scope.glaccount = data;
});
};
var GlAccDeleteCtrl = function ($scope, $modalInstance) {
$scope.delete = function () {
resourceFactory.accountCoaResource.delete({glAccountId: routeParams.id} , {} , function(data) {
location.path('/accounting_coa');
scope.deleteGLAccount = function () {
$modal.open({
templateUrl: 'deleteglacc.html',
controller: GlAccDeleteCtrl
});
$modalInstance.close('delete');
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
var GlAccDeleteCtrl = function ($scope, $modalInstance) {
$scope.delete = function () {
resourceFactory.accountCoaResource.delete({glAccountId: routeParams.id}, {}, function (data) {
location.path('/accounting_coa');
});
$modalInstance.close('delete');
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
};
scope.changeState = function (disabled){
resourceFactory.accountCoaResource.update({'glAccountId': routeParams.id},{disabled:!disabled},function(data){
route.reload();
});
};
}
});
mifosX.ng.application.controller('AccViewGLAccountContoller', ['$scope', '$routeParams', '$location', 'ResourceFactory', '$route','$modal', mifosX.controllers.AccViewGLAccountContoller]).run(function($log) {
$log.info("AccViewGLAccountContoller initialized");
});
scope.changeState = function (disabled) {
resourceFactory.accountCoaResource.update({'glAccountId': routeParams.id}, {disabled: !disabled}, function (data) {
route.reload();
});
};
}
});
mifosX.ng.application.controller('AccViewGLAccountContoller', ['$scope', '$routeParams', '$location', 'ResourceFactory', '$route', '$modal', mifosX.controllers.AccViewGLAccountContoller]).run(function ($log) {
$log.info("AccViewGLAccountContoller initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,51 +1,51 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AccountingClosureController: function(scope, resourceFactory, location, translate, routeParams,dateFilter) {
(function (module) {
mifosX.controllers = _.extend(module, {
AccountingClosureController: function (scope, resourceFactory, location, translate, routeParams, dateFilter) {
scope.first = {};
scope.formData = {};
scope.first.date = new Date();
scope.accountClosures=[];
scope.accountClosures = [];
scope.restrictDate = new Date();
resourceFactory.officeResource.getAllOffices(function(data){
scope.offices = data;
resourceFactory.officeResource.getAllOffices(function (data) {
scope.offices = data;
});
var params = {}
if (routeParams.officeId != undefined) {
params.officeId = routeParams.officeId;
params.officeId = routeParams.officeId;
}
resourceFactory.accountingClosureResource.get(params, function(data){
scope.accountClosures = data;
resourceFactory.accountingClosureResource.get(params, function (data) {
scope.accountClosures = data;
});
scope.submit = function() {
var reqDate = dateFilter(scope.first.date,scope.df);
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.closingDate = reqDate;
resourceFactory.accountingClosureResource.save(this.formData,function(data){
location.path('/view_close_accounting/'+data.resourceId);
});
scope.submit = function () {
var reqDate = dateFilter(scope.first.date, scope.df);
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.closingDate = reqDate;
resourceFactory.accountingClosureResource.save(this.formData, function (data) {
location.path('/view_close_accounting/' + data.resourceId);
});
}
scope.updateLastClosed = function (officeId) {
resourceFactory.accountingClosureResource.get({officeId: officeId}, function(data){
scope.accountClosures = data;
scope.lastClosed = undefined;
if (data.length > 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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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<scope.clients.length;i++)
{
this.formData.clientsAttendance[i] ={clientId:scope.clients[i].id,attendanceType:this.tempData[scope.clients[i].id]};
this.formData.clientsAttendance = [];
for (var i = 0; i < scope.clients.length; i++) {
this.formData.clientsAttendance[i] = {clientId: scope.clients[i].id, attendanceType: this.tempData[scope.clients[i].id]};
}
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.calendarId = id;
resourceFactory.centerMeetingResource.save({centerId: routeParams.centerId,calendarId: routeParams.calendarId},this.formData, function(data) {
resourceFactory.centerMeetingResource.save({centerId: routeParams.centerId, calendarId: routeParams.calendarId}, this.formData, function (data) {
location.path('/viewcenter/' + routeParams.centerId);
});
}
}
});
mifosX.ng.application.controller('CenterAttendanceController', ['$scope', 'ResourceFactory', '$routeParams','$location','dateFilter', mifosX.controllers.CenterAttendanceController]).run(function($log) {
mifosX.ng.application.controller('CenterAttendanceController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.CenterAttendanceController]).run(function ($log) {
$log.info("CenterAttendanceController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,21 +1,21 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
CenterController: function(scope, resourceFactory , paginatorService,location) {
CenterController: function (scope, resourceFactory, paginatorService, location) {
scope.centers = [];
scope.routeTo = function(id){
location.path('/viewcenter/' + id);
scope.routeTo = function (id) {
location.path('/viewcenter/' + id);
};
var fetchFunction = function(offset, limit, callback) {
resourceFactory.centerResource.get({offset: offset, limit: limit, paged: 'true',
orderBy: 'name', sortOrder: 'ASC'} , callback);
var fetchFunction = function (offset, limit, callback) {
resourceFactory.centerResource.get({offset: offset, limit: limit, paged: 'true',
orderBy: 'name', sortOrder: 'ASC'}, callback);
};
scope.centers = paginatorService.paginate(fetchFunction, 14);
}
});
mifosX.ng.application.controller('CenterController', ['$scope', 'ResourceFactory', 'PaginatorService','$location', mifosX.controllers.CenterController]).run(function($log) {
mifosX.ng.application.controller('CenterController', ['$scope', 'ResourceFactory', 'PaginatorService', '$location', mifosX.controllers.CenterController]).run(function ($log) {
$log.info("CenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,32 +1,32 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
CloseCenterController: function(scope, routeParams, route, location, resourceFactory,dateFilter) {
CloseCenterController: function (scope, routeParams, route, location, resourceFactory, dateFilter) {
scope.template = [];
scope.center = [];
scope.first = {};
scope.formData = {};
scope.restrictDate = new Date();
scope.first.date = new Date();
resourceFactory.centerResource.get({centerId: routeParams.id,associations:'groupMembers,collectionMeetingCalendar'} , function(data) {
resourceFactory.centerResource.get({centerId: routeParams.id, associations: 'groupMembers,collectionMeetingCalendar'}, function (data) {
scope.center = data;
});
resourceFactory.centerTemplateResource.get({command:'close'}, function(data){
resourceFactory.centerTemplateResource.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.centerResource.save({centerId: routeParams.id ,command:'close'},this.formData, function(data){
resourceFactory.centerResource.save({centerId: routeParams.id, command: 'close'}, this.formData, function (data) {
location.path('/viewcenter/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('CloseCenterController', ['$scope', '$routeParams','$route', '$location', 'ResourceFactory','dateFilter', mifosX.controllers.CloseCenterController]).run(function($log) {
mifosX.ng.application.controller('CloseCenterController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', 'dateFilter', mifosX.controllers.CloseCenterController]).run(function ($log) {
$log.info("CloseCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,6 +1,6 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
CreateCenterController: function(scope, resourceFactory, location, dateFilter) {
CreateCenterController: function (scope, resourceFactory, location, dateFilter) {
scope.offices = [];
scope.staffs = [];
scope.data = {};
@ -8,49 +8,49 @@
scope.formData = {};
scope.restrictDate = new Date();
scope.first.date = new Date();
resourceFactory.centerTemplateResource.get(function(data) {
resourceFactory.centerTemplateResource.get(function (data) {
scope.offices = data.officeOptions;
scope.staffs = data.staffOptions;
scope.groups = data.groupMembersOptions;
scope.formData.officeId = data.officeOptions[0].id;
});
scope.changeOffice =function() {
resourceFactory.centerTemplateResource.get({staffInSelectedOfficeOnly : false, officeId : scope.formData.officeId
}, function(data) {
scope.changeOffice = function () {
resourceFactory.centerTemplateResource.get({staffInSelectedOfficeOnly: false, officeId: scope.formData.officeId
}, function (data) {
scope.staffs = data.staffOptions;
});
resourceFactory.centerTemplateResource.get({officeId : scope.formData.officeId }, function(data) {
resourceFactory.centerTemplateResource.get({officeId: scope.formData.officeId }, function (data) {
scope.groups = data.groupMembersOptions;
});
};
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() {
var reqDate = dateFilter(scope.first.date,scope.df);
scope.submit = function () {
var reqDate = dateFilter(scope.first.date, scope.df);
this.formData.activationDate = reqDate;
if (scope.first.submitondate) {
reqDate = dateFilter(scope.first.submitondate,scope.df);
reqDate = dateFilter(scope.first.submitondate, scope.df);
this.formData.submittedOnDate = reqDate;
}
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.centerResource.save(this.formData,function(data){
resourceFactory.centerResource.save(this.formData, function (data) {
location.path('/viewcenter/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('CreateCenterController', ['$scope', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.CreateCenterController]).run(function($log) {
mifosX.ng.application.controller('CreateCenterController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateCenterController]).run(function ($log) {
$log.info("CreateCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,22 +1,22 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
EditCenterController: function(scope, resourceFactory,location, routeParams,dateFilter ) {
EditCenterController: function (scope, resourceFactory, location, routeParams, dateFilter) {
scope.managecode = routeParams.managecode;
scope.first = {};
scope.first.date = new Date();
scope.centerId = routeParams.id;
scope.restrictDate = new Date();
resourceFactory.centerResource.get({centerId: routeParams.id,template: 'true'} , function(data) {
resourceFactory.centerResource.get({centerId: routeParams.id, template: 'true'}, function (data) {
scope.edit = data;
scope.staffs = data.staffOptions;
scope.formData = {
name:data.name,
externalId:data.externalId,
staffId:data.staffId
name: data.name,
externalId: data.externalId,
staffId: data.staffId
};
if (data.activationDate) {
var newDate = dateFilter(data.activationDate,scope.df);
var newDate = dateFilter(data.activationDate, scope.df);
scope.first.date = new Date(newDate);
}
@ -25,28 +25,28 @@
}
});
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 = scope.optlang.code;
this.formData.dateFormat = scope.df;
resourceFactory.centerResource.update({centerId:routeParams.id},this.formData , function(data) {
location.path('/viewcenter/'+routeParams.id);
resourceFactory.centerResource.update({centerId: routeParams.id}, this.formData, function (data) {
location.path('/viewcenter/' + 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.centerResource.save({centerId : routeParams.id,command:'activate'},newActivation, function(data){
location.path('/viewcenter/'+routeParams.id);
resourceFactory.centerResource.save({centerId: routeParams.id, command: 'activate'}, newActivation, function (data) {
location.path('/viewcenter/' + routeParams.id);
});
};
}
});
mifosX.ng.application.controller('EditCenterController', ['$scope','ResourceFactory','$location','$routeParams','dateFilter', mifosX.controllers.EditCenterController]).run(function($log) {
mifosX.ng.application.controller('EditCenterController', ['$scope', 'ResourceFactory', '$location', '$routeParams', 'dateFilter', mifosX.controllers.EditCenterController]).run(function ($log) {
$log.info("EditCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,26 +1,26 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
ViewCenterController: function(scope, routeParams , route, location, resourceFactory,$modal) {
ViewCenterController: function (scope, routeParams, route, location, resourceFactory, $modal) {
scope.center = [];
scope.staffData = {};
resourceFactory.centerResource.get({centerId: routeParams.id,associations:'groupMembers,collectionMeetingCalendar'} , function(data) {
resourceFactory.centerResource.get({centerId: routeParams.id, associations: 'groupMembers,collectionMeetingCalendar'}, function (data) {
scope.center = data;
scope.staffData.staffId = data.staffId;
scope.meeting = data.collectionMeetingCalendar;
});
scope.routeTo = function(id){
scope.routeTo = function (id) {
location.path('/viewsavingaccount/' + id);
};
scope.routeToGroup = function(id){
scope.routeToGroup = function (id) {
location.path('/viewgroup/' + id);
}
resourceFactory.runReportsResource.get({reportSource: 'GroupSummaryCounts',genericResultSet: 'false',R_groupId: routeParams.id} , function(data) {
resourceFactory.runReportsResource.get({reportSource: 'GroupSummaryCounts', genericResultSet: 'false', R_groupId: routeParams.id}, function (data) {
scope.summary = data[0];
});
resourceFactory.centerAccountResource.get({centerId: routeParams.id} , function(data) {
resourceFactory.centerAccountResource.get({centerId: routeParams.id}, function (data) {
scope.accounts = data;
});
resourceFactory.groupNotesResource.getAllNotes({groupId: routeParams.id} , function(data) {
resourceFactory.groupNotesResource.getAllNotes({groupId: routeParams.id}, function (data) {
scope.notes = data;
});
scope.deleteCenter = function () {
@ -37,7 +37,7 @@
};
var CenterDeleteCtrl = function ($scope, $modalInstance) {
$scope.delete = function () {
resourceFactory.centerResource.delete({centerId: routeParams.id}, {}, function(data) {
resourceFactory.centerResource.delete({centerId: routeParams.id}, {}, function (data) {
location.path('/centers');
});
$modalInstance.close('activate');
@ -49,7 +49,7 @@
};
var CenterUnassignCtrl = function ($scope, $modalInstance) {
$scope.unassign = function () {
resourceFactory.groupResource.save({groupId: routeParams.id,command: 'unassignStaff'}, scope.staffData, function(data) {
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'unassignStaff'}, scope.staffData, function (data) {
route.reload();
});
$modalInstance.close('activate');
@ -58,57 +58,58 @@
$modalInstance.dismiss('cancel');
};
};
scope.saveNote = function() {
resourceFactory.groupNotesResource.save({groupId: routeParams.id}, this.formData,function(data){
scope.saveNote = function () {
resourceFactory.groupNotesResource.save({groupId: routeParams.id}, this.formData, function (data) {
var today = new Date();
temp = { id: data.resourceId , note : scope.formData.note , createdByUsername : "test" , createdOn : today } ;
temp = { id: data.resourceId, note: scope.formData.note, createdByUsername: "test", createdOn: today };
scope.notes.push(temp);
scope.formData.note = "";
scope.predicate = '-id';
});
}
resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_center'} , function(data) {
resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_center'}, function (data) {
scope.centerdatatables = data;
});
scope.dataTableChange = function(datatable) {
resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, entityId: routeParams.id, genericResultSet: 'true'} , function(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) {
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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('<html><head>');
templateWindow.document.write('</head><body>');
templateWindow.document.write(template);
templateWindow.document.write('</body></html>');
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('<html><head>');
templateWindow.document.write('</head><body>');
templateWindow.document.write(template);
templateWindow.document.write('</body></html>');
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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<scope.clients.length;i++) {
for (var i = 0; i < scope.clients.length; i++) {
scope.clients[i].attendanceType = data.attendanceTypeOptions[0].id;
}
});
scope.attendanceUpdate = function (id) {
var reqDate = dateFilter(scope.first.date,scope.df);
var reqDate = dateFilter(scope.first.date, scope.df);
this.formData.clientsAttendance = [];
for(var i=0; i<scope.clients.length;i++)
{
this.formData.clientsAttendance[i] ={clientId : scope.clients[i].id,attendanceType : scope.clients[i].attendanceType};
for (var i = 0; i < scope.clients.length; i++) {
this.formData.clientsAttendance[i] = {clientId: scope.clients[i].id, attendanceType: scope.clients[i].attendanceType};
}
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.calendarId = id;
this.formData.meetingDate = reqDate;
resourceFactory.groupMeetingResource.save({groupId: routeParams.groupId,calenderId: routeParams.calendarId},this.formData, function(data) {
resourceFactory.groupMeetingResource.save({groupId: routeParams.groupId, calenderId: routeParams.calendarId}, this.formData, function (data) {
location.path('/viewgroup/' + routeParams.groupId);
});
};
}
});
mifosX.ng.application.controller('GroupAttendanceController', ['$scope', 'ResourceFactory', '$routeParams','$location','dateFilter', mifosX.controllers.GroupAttendanceController]).run(function($log) {
mifosX.ng.application.controller('GroupAttendanceController', ['$scope', 'ResourceFactory', '$routeParams', '$location', 'dateFilter', mifosX.controllers.GroupAttendanceController]).run(function ($log) {
$log.info("GroupAttendanceController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,22 +1,22 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
GroupController: function(scope, resourceFactory , paginatorService,location) {
GroupController: function (scope, resourceFactory, paginatorService, location) {
scope.groups = [];
scope.routeTo = function(id){
scope.routeTo = function (id) {
location.path('/viewgroup/' + id);
};
var fetchFunction = function(offset, limit, callback) {
resourceFactory.groupResource.get({offset: offset, limit: limit, paged: 'true',
orderBy: 'name', sortOrder: 'ASC'} , callback);
var fetchFunction = function (offset, limit, callback) {
resourceFactory.groupResource.get({offset: offset, limit: limit, paged: 'true',
orderBy: 'name', sortOrder: 'ASC'}, callback);
};
scope.groups = paginatorService.paginate(fetchFunction, 14);
}
});
mifosX.ng.application.controller('GroupController', ['$scope', 'ResourceFactory', 'PaginatorService','$location', mifosX.controllers.GroupController]).run(function($log) {
mifosX.ng.application.controller('GroupController', ['$scope', 'ResourceFactory', 'PaginatorService', '$location', mifosX.controllers.GroupController]).run(function ($log) {
$log.info("GroupController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,34 +1,34 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
MemberManageController: function(scope, routeParams , route, location, resourceFactory) {
MemberManageController: function (scope, routeParams, route, location, resourceFactory) {
scope.group = [];
scope.managecode = routeParams.managecode;
resourceFactory.groupResource.get({groupId: routeParams.id,associations:'all'} , function(data) {
resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'all'}, function (data) {
scope.group = data;
});
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.allClients = data.clientOptions;
scope.allMembers = data.clientMembers;
});
scope.associate = function(){
resourceFactory.groupResource.save({groupId: routeParams.id,command:'associateClients'} ,this.formData, function(data) {
scope.associate = function () {
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'associateClients'}, this.formData, function (data) {
location.path('/viewgroup/' + data.groupId);
});
};
scope.disassociate = function() {
scope.disassociate = function () {
var disassociateMembers = new Object();
disassociateMembers.clientMembers = this.formData.clientMembers;
resourceFactory.groupResource.save({groupId:routeParams.id,command:'disassociateClients'},disassociateMembers, function(data) {
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'disassociateClients'}, disassociateMembers, function (data) {
location.path('/viewgroup/' + data.groupId);
});
};
}
});
mifosX.ng.application.controller('MemberManageController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', mifosX.controllers.MemberManageController]).run(function($log) {
mifosX.ng.application.controller('MemberManageController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', mifosX.controllers.MemberManageController]).run(function ($log) {
$log.info("MemberManageController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,33 +1,34 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
TransferClientsController: function(scope, routeParams , route, location, resourceFactory) {
TransferClientsController: function (scope, routeParams, route, location, resourceFactory) {
scope.group = [];
scope.tempData = [];
resourceFactory.groupResource.get({paged: 'true', orderBy: 'name', sortOrder: 'ASC'} , function(data) {
scope.groups = _.reject(data.pageItems, function(group){ return group.id == routeParams.id; });
resourceFactory.groupResource.get({paged: 'true', orderBy: 'name', sortOrder: 'ASC'}, function (data) {
scope.groups = _.reject(data.pageItems, function (group) {
return group.id == routeParams.id;
});
});
resourceFactory.groupResource.get({groupId: routeParams.id,associations:'all'} , function(data) {
resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'all'}, function (data) {
scope.group = data;
scope.allMembers = data.clientMembers;
});
scope.viewgroup = function(id){
resourceFactory.groupResource.get({groupId: id,associations:'all'} , function(data) {
scope.viewgroup = function (id) {
resourceFactory.groupResource.get({groupId: id, associations: 'all'}, function (data) {
scope.groupdata = data;
});
scope.view = 1;
};
scope.transfer = function(){
scope.transfer = function () {
this.formData.locale = scope.optlang.code;
this.formData.clients=[];
this.formData.clients = [];
var temp = new Object();
for(var i=0; i<scope.tempData.length;i++)
{
temp ={id:this.tempData[i]};
for (var i = 0; i < scope.tempData.length; i++) {
temp = {id: this.tempData[i]};
this.formData.clients.push(temp);
}
this.formData.inheritDestinationGroupLoanOfficer = this.formData.inheritDestinationGroupLoanOfficer || false;
resourceFactory.groupResource.save({groupId: routeParams.id,command:'transferClients'} ,this.formData, function(data) {
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'transferClients'}, this.formData, function (data) {
location.path('/viewgroup/' + data.resourceId);
});
};
@ -35,7 +36,7 @@
}
});
mifosX.ng.application.controller('TransferClientsController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', mifosX.controllers.TransferClientsController]).run(function($log) {
mifosX.ng.application.controller('TransferClientsController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', mifosX.controllers.TransferClientsController]).run(function ($log) {
$log.info("TransferClientsController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,37 +1,37 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
ViewGroupController: function(scope, routeParams , route, location, resourceFactory,dateFilter,$modal) {
ViewGroupController: function (scope, routeParams, route, location, resourceFactory, dateFilter, $modal) {
scope.group = [];
scope.template = [];
scope.choice = 0;
scope.staffData = {};
scope.openLoan = true;
scope.openSaving = true;
scope.routeToLoan = function(id){
scope.routeToLoan = function (id) {
location.path('/viewloanaccount/' + id);
};
scope.routeToSaving = function(id){
scope.routeToSaving = function (id) {
location.path('/viewsavingaccount/' + id);
};
scope.routeToMem = function(id){
scope.routeToMem = function (id) {
location.path('/viewclient/' + id);
};
resourceFactory.groupResource.get({groupId: routeParams.id,associations:'all'} , function(data) {
scope.group = data;
scope.staffData.staffId = data.staffId;
resourceFactory.groupResource.get({groupId: routeParams.id, associations: 'all'}, function (data) {
scope.group = data;
scope.staffData.staffId = data.staffId;
});
resourceFactory.runReportsResource.get({reportSource: 'GroupSummaryCounts',genericResultSet: 'false',R_groupId: routeParams.id} , function(data) {
resourceFactory.runReportsResource.get({reportSource: 'GroupSummaryCounts', genericResultSet: 'false', R_groupId: routeParams.id}, function (data) {
scope.summary = data[0];
});
resourceFactory.groupAccountResource.get({groupId: routeParams.id} , function(data) {
resourceFactory.groupAccountResource.get({groupId: routeParams.id}, function (data) {
scope.groupAccounts = data;
});
resourceFactory.groupNotesResource.getAllNotes({groupId: routeParams.id} , function(data) {
resourceFactory.groupNotesResource.getAllNotes({groupId: routeParams.id}, function (data) {
scope.groupNotes = data;
});
scope.delrole = function(id){
resourceFactory.groupResource.save({groupId: routeParams.id,command: 'unassignRole',roleId:id}, {}, function(data) {
resourceFactory.groupResource.get({groupId: routeParams.id}, function(data){
scope.delrole = function (id) {
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'unassignRole', roleId: id}, {}, function (data) {
resourceFactory.groupResource.get({groupId: routeParams.id}, function (data) {
route.reload();
});
});
@ -50,7 +50,7 @@
};
var GroupUnassignCtrl = function ($scope, $modalInstance) {
$scope.unassign = function () {
resourceFactory.groupResource.save({groupId: routeParams.id, command : 'unassignstaff'}, scope.staffData,function(data){
resourceFactory.groupResource.save({groupId: routeParams.id, command: 'unassignstaff'}, scope.staffData, function (data) {
route.reload();
});
$modalInstance.close('unassign');
@ -61,7 +61,7 @@
};
var GroupDeleteCtrl = function ($scope, $modalInstance) {
$scope.delete = function () {
resourceFactory.groupResource.delete({groupId: routeParams.id}, {}, function(data) {
resourceFactory.groupResource.delete({groupId: routeParams.id}, {}, function (data) {
location.path('/groups');
});
$modalInstance.close('delete');
@ -70,118 +70,119 @@
$modalInstance.dismiss('cancel');
};
};
scope.cancel = function(id){
resourceFactory.groupResource.get({groupId: id}, function(data){
scope.cancel = function (id) {
resourceFactory.groupResource.get({groupId: id}, function (data) {
route.reload();
});
};
scope.saveNote = function() {
resourceFactory.groupResource.save({groupId: routeParams.id, anotherresource: 'notes'}, this.formData,function(data){
scope.saveNote = function () {
resourceFactory.groupResource.save({groupId: routeParams.id, anotherresource: 'notes'}, this.formData, function (data) {
var today = new Date();
temp = { id: data.resourceId , note : scope.formData.note , createdByUsername : "test" , createdOn : today } ;
temp = { id: data.resourceId, note: scope.formData.note, createdByUsername: "test", createdOn: today };
scope.groupNotes.push(temp);
scope.formData.note = "";
scope.predicate = '-id';
});
};
scope.isLoanClosed = function(loanaccount) {
if(loanaccount.status.code === "loanStatusType.closed.written.off" ||
scope.isLoanClosed = function (loanaccount) {
if (loanaccount.status.code === "loanStatusType.closed.written.off" ||
loanaccount.status.code === "loanStatusType.closed.obligations.met" ||
loanaccount.status.code === "loanStatusType.closed.reschedule.outstanding.amount" ||
loanaccount.status.code === "loanStatusType.withdrawn.by.client" ||
loanaccount.status.code === "loanStatusType.rejected") {
return true;
} else{
} else {
return false;
}
};
scope.setLoan = function(){
if(scope.openLoan){
scope.setLoan = function () {
if (scope.openLoan) {
scope.openLoan = false
}else{
} else {
scope.openLoan = true;
}
};
scope.setSaving = function(){
if(scope.openSaving){
scope.setSaving = function () {
if (scope.openSaving) {
scope.openSaving = false;
}else{
} else {
scope.openSaving = true;
}
};
scope.isSavingClosed = function(savingaccount) {
scope.isSavingClosed = function (savingaccount) {
if (savingaccount.status.code === "savingsAccountStatusType.withdrawn.by.applicant" ||
savingaccount.status.code === "savingsAccountStatusType.closed" ||
savingaccount.status.code === "savingsAccountStatusType.rejected") {
return true;
} else{
} else {
return false;
}
};
scope.isLoanNotClosed = function(loanaccount) {
if(loanaccount.status.code === "loanStatusType.closed.written.off" ||
loanaccount.status.code === "loanStatusType.closed.obligations.met" ||
loanaccount.status.code === "loanStatusType.closed.reschedule.outstanding.amount" ||
loanaccount.status.code === "loanStatusType.withdrawn.by.client" ||
loanaccount.status.code === "loanStatusType.rejected") {
return false;
} else{
return true;
}
scope.isLoanNotClosed = function (loanaccount) {
if (loanaccount.status.code === "loanStatusType.closed.written.off" ||
loanaccount.status.code === "loanStatusType.closed.obligations.met" ||
loanaccount.status.code === "loanStatusType.closed.reschedule.outstanding.amount" ||
loanaccount.status.code === "loanStatusType.withdrawn.by.client" ||
loanaccount.status.code === "loanStatusType.rejected") {
return false;
} else {
return true;
}
};
scope.isSavingNotClosed = function(savingaccount) {
if (savingaccount.status.code === "savingsAccountStatusType.withdrawn.by.applicant" ||
savingaccount.status.code === "savingsAccountStatusType.closed" ||
savingaccount.status.code === "savingsAccountStatusType.rejected") {
return false;
} else {
return true;
}
scope.isSavingNotClosed = function (savingaccount) {
if (savingaccount.status.code === "savingsAccountStatusType.withdrawn.by.applicant" ||
savingaccount.status.code === "savingsAccountStatusType.closed" ||
savingaccount.status.code === "savingsAccountStatusType.rejected") {
return false;
} else {
return true;
}
};
resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_group'} , function(data) {
resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_group'}, function (data) {
scope.groupdatatables = data;
});
scope.dataTableChange = function(datatable) {
resourceFactory.DataTablesResource.getTableDetails({datatablename: datatable.registeredTableName, entityId: routeParams.id, genericResultSet: 'true'} , function(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) {
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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('<html><head>');
templateWindow.document.write('</head><body>');
templateWindow.document.write(template);
templateWindow.document.write('</body></html>');
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('<html><head>');
templateWindow.document.write('</head><body>');
templateWindow.document.write(template);
templateWindow.document.write('</body></html>');
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 = '<span>Mifos X is designed by the <a href="http://www.openmf.org/">Mifos Initiative</a>.'+
'<a href="http://mifos.org/community"> A global community </a> thats aims to speed the elimination of poverty by enabling Organizations to more effectively and efficiently deliver responsible financial services to the worlds poor and unbanked </span><br/>'+
'<span>Sounds interesting?<a href="http://mifos.org/community/news/how-you-can-get-involved"> Get involved!</a></span>';
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 = '<span>Mifos X is designed by the <a href="http://www.openmf.org/">Mifos Initiative</a>.' +
'<a href="http://mifos.org/community"> A global community </a> thats aims to speed the elimination of poverty by enabling Organizations to more effectively and efficiently deliver responsible financial services to the worlds poor and unbanked </span><br/>' +
'<span>Sounds interesting?<a href="http://mifos.org/community/news/how-you-can-get-involved"> Get involved!</a></span>';
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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<scope.selectedCurrOptions.length; i++){
if(scope.selectedCurrOptions[i].code == code){
scope.selectedCurrOptions.splice(i, 1); //removes 1 element at position i
break;
}
}
};
});
scope.addCur = function (){
if(scope.selected != undefined && scope.selected.hasOwnProperty('code')) {
scope.selectedCurrOptions.push(scope.selected);
for(var i=0; i<scope.allCurrOptions.length; i++){
if(scope.allCurrOptions[i].code == scope.selected.code){
scope.allCurrOptions.splice(i, 1); //removes 1 element at position i
break;
}
}
}
scope.selected = undefined;
};
scope.deleteCur = function (code) {
for (var i = 0; i < scope.selectedCurrOptions.length; i++) {
if (scope.selectedCurrOptions[i].code == code) {
scope.selectedCurrOptions.splice(i, 1); //removes 1 element at position i
break;
}
}
};
scope.submit = function () {
scope.addCur = function () {
if (scope.selected != undefined && scope.selected.hasOwnProperty('code')) {
scope.selectedCurrOptions.push(scope.selected);
for (var i = 0; i < scope.allCurrOptions.length; i++) {
if (scope.allCurrOptions[i].code == scope.selected.code) {
scope.allCurrOptions.splice(i, 1); //removes 1 element at position i
break;
}
}
}
scope.selected = undefined;
};
scope.submit = function () {
var currencies = [];
var curr = {};
for(var i=0; i < scope.selectedCurrOptions.length; i++){
for (var i = 0; i < scope.selectedCurrOptions.length; i++) {
currencies.push(scope.selectedCurrOptions[i].code);
}
curr["currencies"] = currencies;
resourceFactory.currencyConfigResource.upd(curr , function(data){
resourceFactory.currencyConfigResource.upd(curr, function (data) {
route.reload();
});
};
};
scope.cancel = function () {
route.reload();
}
scope.cancel = function() {
route.reload();
}
}
});
mifosX.ng.application.controller('CurrencyConfigController', ['$scope', 'ResourceFactory', '$route', mifosX.controllers.CurrencyConfigController]).run(function($log) {
$log.info("CurrencyConfigController initialized");
});
});
mifosX.ng.application.controller('CurrencyConfigController', ['$scope', 'ResourceFactory', '$route', mifosX.controllers.CurrencyConfigController]).run(function ($log) {
$log.info("CurrencyConfigController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,14 +1,14 @@
(function(module) {
mifosX.controllers = _.extend(module, {
DataTableController: function(scope, resourceFactory) {
(function (module) {
mifosX.controllers = _.extend(module, {
DataTableController: function (scope, resourceFactory) {
resourceFactory.DataTablesResource.getAllDataTables(function(data) {
scope.datatables = data;
});
resourceFactory.DataTablesResource.getAllDataTables(function (data) {
scope.datatables = data;
});
}
});
mifosX.ng.application.controller('DataTableController', ['$scope', 'ResourceFactory', mifosX.controllers.DataTableController]).run(function($log) {
$log.info("DataTableController initialized");
});
}
});
mifosX.ng.application.controller('DataTableController', ['$scope', 'ResourceFactory', mifosX.controllers.DataTableController]).run(function ($log) {
$log.info("DataTableController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,29 +1,29 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditEmployeeController: function(scope, routeParams, resourceFactory, location) {
scope.offices = [];
(function (module) {
mifosX.controllers = _.extend(module, {
EditEmployeeController: function (scope, routeParams, resourceFactory, location) {
scope.offices = [];
resourceFactory.employeeResource.get({staffId: routeParams.id, template: 'true'} , function(data) {
scope.offices = data.allowedOffices;
scope.staffId = data.id;
scope.formData = {
firstname : data.firstname,
lastname : data.lastname,
isLoanOfficer: data.isLoanOfficer,
officeId : data.officeId,
mobileNo : data.mobileNo
resourceFactory.employeeResource.get({staffId: routeParams.id, template: 'true'}, function (data) {
scope.offices = data.allowedOffices;
scope.staffId = data.id;
scope.formData = {
firstname: data.firstname,
lastname: data.lastname,
isLoanOfficer: data.isLoanOfficer,
officeId: data.officeId,
mobileNo: data.mobileNo
};
});
scope.submit = function () {
resourceFactory.employeeResource.update({'staffId': routeParams.id}, this.formData, function (data) {
location.path('/viewemployee/' + data.resourceId);
});
};
});
scope.submit = function() {
resourceFactory.employeeResource.update({'staffId': routeParams.id},this.formData,function(data){
location.path('/viewemployee/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('EditEmployeeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditEmployeeController]).run(function($log) {
$log.info("EditEmployeeController initialized");
});
}
});
mifosX.ng.application.controller('EditEmployeeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditEmployeeController]).run(function ($log) {
$log.info("EditEmployeeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,48 +1,48 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditHolidayController: function(scope, routeParams, resourceFactory, location,dateFilter) {
scope.formData = {};
scope.date = {};
scope.restrictDate = new Date();
(function (module) {
mifosX.controllers = _.extend(module, {
EditHolidayController: function (scope, routeParams, resourceFactory, location, dateFilter) {
scope.formData = {};
scope.date = {};
scope.restrictDate = new Date();
resourceFactory.holValueResource.getholvalues({holId: routeParams.id} , function(data) {
scope.holiday = data;
scope.formData = {
name : data.name,
description : data.description,
};
resourceFactory.holValueResource.getholvalues({holId: routeParams.id}, function (data) {
scope.holiday = data;
scope.formData = {
name: data.name,
description: data.description,
};
scope.holidayStatusActive = false;
if (data.status.value === "Active") {
scope.holidayStatusActive = true;
}
scope.holidayStatusActive = false;
if (data.status.value === "Active") {
scope.holidayStatusActive = true;
}
var fromDate = dateFilter(data.fromDate,scope.df);
scope.date.fromDate = new Date(fromDate);
var fromDate = dateFilter(data.fromDate, scope.df);
scope.date.fromDate = new Date(fromDate);
var toDate = dateFilter(data.toDate,scope.df);
scope.date.toDate = new Date(toDate);
var toDate = dateFilter(data.toDate, scope.df);
scope.date.toDate = new Date(toDate);
var repaymentsRescheduledTo = dateFilter(data.repaymentsRescheduledTo,scope.df);
scope.date.repaymentsRescheduledTo = new Date(repaymentsRescheduledTo);
var repaymentsRescheduledTo = dateFilter(data.repaymentsRescheduledTo, scope.df);
scope.date.repaymentsRescheduledTo = new Date(repaymentsRescheduledTo);
});
scope.submit = function() {
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
if (!scope.holidayStatusActive) {
this.formData.fromDate = dateFilter(scope.date.fromDate,scope.df);
this.formData.toDate = dateFilter(scope.date.toDate,scope.df);
}
this.formData.repaymentsRescheduledTo = dateFilter(scope.date.repaymentsRescheduledTo,scope.df);
resourceFactory.holValueResource.update({holId: routeParams.id},this.formData,function(data){
location.path('/viewholiday/' + routeParams.id);
});
};
}
});
mifosX.ng.application.controller('EditHolidayController', ['$scope', '$routeParams', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.EditHolidayController]).run(function($log) {
$log.info("EditHolidayController initialized");
});
scope.submit = function () {
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
if (!scope.holidayStatusActive) {
this.formData.fromDate = dateFilter(scope.date.fromDate, scope.df);
this.formData.toDate = dateFilter(scope.date.toDate, scope.df);
}
this.formData.repaymentsRescheduledTo = dateFilter(scope.date.repaymentsRescheduledTo, scope.df);
resourceFactory.holValueResource.update({holId: routeParams.id}, this.formData, function (data) {
location.path('/viewholiday/' + routeParams.id);
});
};
}
});
mifosX.ng.application.controller('EditHolidayController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditHolidayController]).run(function ($log) {
$log.info("EditHolidayController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,38 +1,39 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditOfficeController: function(scope, routeParams, resourceFactory, location,dateFilter) {
scope.formData = {};
scope.first = {};
scope.restrictDate = new Date();
resourceFactory.officeResource.getAllOffices(function(data) {
scope.parentId = scope.offices[0].id;
});
resourceFactory.officeResource.get({officeId: routeParams.id, template: 'true'} , function(data) {
scope.offices = data.allowedParents;
scope.id = data.id;
if(data.openingDate){
var editDate = dateFilter(data.openingDate,scope.df);
scope.first.date = new Date(editDate); }
scope.formData =
{
name : data.name,
externalId : data.externalId,
parentId : data.parentId
}
});
scope.submit = function() {
var reqDate = dateFilter(scope.first.date,scope.df);
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.openingDate = reqDate;
resourceFactory.officeResource.update({'officeId': routeParams.id},this.formData,function(data){
location.path('/viewoffice/' + data.resourceId);
(function (module) {
mifosX.controllers = _.extend(module, {
EditOfficeController: function (scope, routeParams, resourceFactory, location, dateFilter) {
scope.formData = {};
scope.first = {};
scope.restrictDate = new Date();
resourceFactory.officeResource.getAllOffices(function (data) {
scope.parentId = scope.offices[0].id;
});
};
}
});
mifosX.ng.application.controller('EditOfficeController', ['$scope', '$routeParams', 'ResourceFactory', '$location','dateFilter', mifosX.controllers.EditOfficeController]).run(function($log) {
$log.info("EditOfficeController initialized");
});
resourceFactory.officeResource.get({officeId: routeParams.id, template: 'true'}, function (data) {
scope.offices = data.allowedParents;
scope.id = data.id;
if (data.openingDate) {
var editDate = dateFilter(data.openingDate, scope.df);
scope.first.date = new Date(editDate);
}
scope.formData =
{
name: data.name,
externalId: data.externalId,
parentId: data.parentId
}
});
scope.submit = function () {
var reqDate = dateFilter(scope.first.date, scope.df);
this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
this.formData.openingDate = reqDate;
resourceFactory.officeResource.update({'officeId': routeParams.id}, this.formData, function (data) {
location.path('/viewoffice/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('EditOfficeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditOfficeController]).run(function ($log) {
$log.info("EditOfficeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,42 +1,42 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditUserController: function(scope, routeParams, resourceFactory, location) {
scope.offices = [];
scope.availableRoles = [];
scope.user = [];
scope.selectedRoles = [];
resourceFactory.userListResource.get({userId: routeParams.id, template: 'true'} , function(data) {
scope.formData = data;
scope.userId = data.id;
scope.offices = data.allowedOffices;
scope.availableRoles = data.availableRoles.concat(data.selectedRoles);
(function (module) {
mifosX.controllers = _.extend(module, {
EditUserController: function (scope, routeParams, resourceFactory, location) {
scope.offices = [];
scope.availableRoles = [];
scope.user = [];
scope.selectedRoles = [];
resourceFactory.userListResource.get({userId: routeParams.id, template: 'true'}, function (data) {
scope.formData = data;
scope.userId = data.id;
scope.offices = data.allowedOffices;
scope.availableRoles = data.availableRoles.concat(data.selectedRoles);
});
scope.submit = function() {
delete this.formData.allowedOffices; // removing allowed office list
delete this.formData.availableRoles; // removing allowed roles list
delete this.formData.officeName; //
});
scope.submit = function () {
delete this.formData.allowedOffices; // removing allowed office list
delete this.formData.availableRoles; // removing allowed roles list
delete this.formData.officeName; //
// reformatting selected roles
var userId = this.formData.id;
delete this.formData.id;
// reformatting selected roles
var userId = this.formData.id;
delete this.formData.id;
var roles = [];
for(var i=0; i< scope.formData.selectedRoles.length; i++){
var roles = [];
for (var i = 0; i < scope.formData.selectedRoles.length; i++) {
roles.push(scope.formData.selectedRoles[i].id);
}
}
this.formData.roles = roles;
delete this.formData.selectedRoles;
this.formData.roles = roles;
delete this.formData.selectedRoles;
resourceFactory.userListResource.update({'userId': userId},this.formData,function(data){
location.path('/viewuser/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('EditUserController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditUserController]).run(function($log) {
$log.info("EditUserController initialized");
});
resourceFactory.userListResource.update({'userId': userId}, this.formData, function (data) {
location.path('/viewuser/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('EditUserController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditUserController]).run(function ($log) {
$log.info("EditUserController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,16 +1,16 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EmployeeController: function(scope, resourceFactory,location) {
scope.employees = [];
scope.routeTo = function(id){
location.path('/viewemployee/' + id);
};
resourceFactory.employeeResource.getAllEmployees(function(data) {
scope.employees = data;
});
}
});
mifosX.ng.application.controller('EmployeeController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.EmployeeController]).run(function($log) {
$log.info("EmployeeController initialized");
});
(function (module) {
mifosX.controllers = _.extend(module, {
EmployeeController: function (scope, resourceFactory, location) {
scope.employees = [];
scope.routeTo = function (id) {
location.path('/viewemployee/' + id);
};
resourceFactory.employeeResource.getAllEmployees(function (data) {
scope.employees = data;
});
}
});
mifosX.ng.application.controller('EmployeeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.EmployeeController]).run(function ($log) {
$log.info("EmployeeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,26 +1,26 @@
(function(module) {
(function (module) {
mifosX.controllers = _.extend(module, {
HolController: function(scope, resourceFactory,location) {
HolController: function (scope, resourceFactory, location) {
scope.holidays = [];
scope.offices = [];
scope.formData={officeId:1};
resourceFactory.holResource.getAllHols({officeId:scope.formData.officeId},function(data){
scope.formData = {officeId: 1};
resourceFactory.holResource.getAllHols({officeId: scope.formData.officeId}, function (data) {
scope.holidays = data;
});
scope.routeTo = function(id){
scope.routeTo = function (id) {
location.path('/viewholiday/' + id);
};
resourceFactory.officeResource.getAllOffices(function(data){
resourceFactory.officeResource.getAllOffices(function (data) {
scope.offices = data;
});
scope.getHolidays = function(){
resourceFactory.holResource.getAllHols({officeId:scope.formData.officeId},function(data){
scope.getHolidays = function () {
resourceFactory.holResource.getAllHols({officeId: scope.formData.officeId}, function (data) {
scope.holidays = data;
});
};
}
});
mifosX.ng.application.controller('HolController', ['$scope', 'ResourceFactory','$location', mifosX.controllers.HolController]).run(function($log) {
mifosX.ng.application.controller('HolController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.HolController]).run(function ($log) {
$log.info("HolController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,80 +1,81 @@
(function(module) {
mifosX.controllers = _.extend(module, {
MakerCheckerController: function(scope, route, resourceFactory) {
scope.permissions = [];
scope.groupings = [];
scope.formData = {};
scope.isDisabled = true;
var tempPermissionUIData = [];
(function (module) {
mifosX.controllers = _.extend(module, {
MakerCheckerController: function (scope, route, resourceFactory) {
resourceFactory.permissionResource.get({makerCheckerable:true}, function(data) {
scope.permissions = [];
scope.groupings = [];
scope.formData = {};
scope.isDisabled = true;
var tempPermissionUIData = [];
var currentGrouping = "";
for (var i in data) {
if (data[i].grouping != currentGrouping)
{
currentGrouping = data[i].grouping;
scope.groupings.push(currentGrouping);
var newEntry = { permissions: [] };
tempPermissionUIData[currentGrouping] = newEntry;
}
var temp = { code:data[i].code};
scope.formData[data[i].code] = data[i].selected;
tempPermissionUIData[currentGrouping].permissions.push(temp);
resourceFactory.permissionResource.get({makerCheckerable: true}, function (data) {
var currentGrouping = "";
for (var i in data) {
if (data[i].grouping != currentGrouping) {
currentGrouping = data[i].grouping;
scope.groupings.push(currentGrouping);
var newEntry = { permissions: [] };
tempPermissionUIData[currentGrouping] = newEntry;
}
var temp = { code: data[i].code};
scope.formData[data[i].code] = data[i].selected;
tempPermissionUIData[currentGrouping].permissions.push(temp);
}
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;
});
};
}
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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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 || {}));

Some files were not shown because too many files have changed in this diff Show More