FINERACT-1391:AccountNumberPrefix (#3450)

thanks for the review @luckyman20
This commit is contained in:
Rahul Pawar 2022-01-03 21:47:45 +05:30 committed by GitHub
parent e8309643ee
commit da49511968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 104 additions and 29 deletions

View File

@ -2616,6 +2616,7 @@
"label.heading.madedate": "Made Date",
"label.heading.checker": "Checker",
"label.heading.checkeddate": "Checked Date",
"label.heading.prefix": "Prefix",
"label.heading.accountNumberPreferences": "Account Number Preferences",
"label.heading.addAccountNumberPreferences": "Add Account Number Preferences",
"label.heading.viewAccountNumberPreferences": "View Account Number Preferences",
@ -2719,6 +2720,7 @@
"label.input.accountType": "Select Account Type",
"label.input.addPrefix": "Add Prefix to Account",
"label.input.prefixField": "Prefix Field",
"label.input.prefixcharacter": "Prefix Character",
"label.input.searchsurveys": "Search Surveys",
"#Localize system defined codes": "...",
"Customer Identifier": "Customer identifier",

View File

@ -3,6 +3,7 @@
AddAccountNumberPreferencesController: function (scope, resourceFactory, location, routeParams) {
scope.formData = {};
scope.addPrefix = true;
scope.addCharacter = false;
resourceFactory.accountNumberTemplateResource.get(function(data){
scope.data = data;
@ -27,6 +28,28 @@
}
}
scope.accountNumberPrefix = function (prefixType) {
for (var i in scope.prefixTypeOptions) {
if (prefixType === scope.prefixTypeOptions[i].id) {
if (scope.prefixTypeOptions[i].value == "PREFIX_SHORT_NAME"){
scope.addCharacter = true;
}
else{
scope.addCharacter = false;
}
}
}
}
resourceFactory.configurationResource.get({'id': 40},function (data) {
scope.isMaxlengthEnable = data.enabled;
if(scope.isMaxlengthEnable == true){
scope.maxlength = data.value - 1;
}
else{
scope.maxlength = 8;
}
});
scope.cancel = function(){
location.path('/accountnumberpreferences');
}

View File

@ -3,16 +3,35 @@
EditAccountNumberPreferencesController: function (scope,resourceFactory, location,routeParams) {
scope.resourceId = routeParams.id;
scope.addPrefix = false;
resourceFactory.accountNumberResources.getPrefixType({accountNumberFormatId:scope.resourceId},function(data){
scope.accountType = data["accountType"].value;
scope.formData ={
prefixType:data.prefixType.id
}
scope.prefixTypeOptions = data.prefixTypeOptions[data["accountType"].code]
if(scope.formData.prefixType != null){
scope.addPrefix = true;
}
});
resourceFactory.configurationResource.get({'id': 40},function (data) {
scope.isMaxlengthEnable = data.enabled;
if(scope.isMaxlengthEnable == true){
scope.maxlength = data.value - 1;
}
else{
scope.maxlength = 8;
}
});
resourceFactory.accountNumberResources.getPrefixType({accountNumberFormatId:scope.resourceId},function(data){
scope.accountType = data["accountType"].value;
scope.formData ={
prefixType:data.prefixType.id,
prefixCharacter:data.prefixCharacter
}
scope.prefixTypeOptions = data.prefixTypeOptions[data["accountType"].code]
scope.prefixCharacter = data.prefixCharacter;
scope.prefixTypeValue = data["prefixType"].value;
if(scope.prefixTypeValue == 'PREFIX_SHORT_NAME'){
scope.addCharacter = true;
}
if(scope.formData.prefixType != null){
scope.addPrefix = true;
}
});
scope.cancel = function(){
location.path('/accountnumberpreferences');
@ -22,9 +41,22 @@
location.path('/viewaccountnumberpreferences/' + data.resourceId );
});
}
scope.accountNumberPrefix = function (prefixType) {
for (var i in scope.prefixTypeOptions) {
if (prefixType === scope.prefixTypeOptions[i].id) {
if (scope.prefixTypeOptions[i].value == "PREFIX_SHORT_NAME"){
scope.addCharacter = true;
}
else{
scope.addCharacter = false;
}
}
}
};
}
});
mifosX.ng.application.controller('EditAccountNumberPreferencesController', ['$scope', 'ResourceFactory', '$location','$routeParams',mifosX.controllers.EditAccountNumberPreferencesController]).run(function ($log) {
$log.info("EditAccountNumberPreferencesController initialized");
});
}(mifosX.controllers || {}));
}(mifosX.controllers || {}));

View File

@ -3,12 +3,17 @@
ViewAccountNumberPreferencesController: function (scope, resourceFactory, location,routeParams,$uibModal) {
scope.resourceId = routeParams.id;
scope.addPrefix = false;
scope.addCharacter = false;
resourceFactory.accountNumberResources.get({accountNumberFormatId:scope.resourceId},function(data){
scope.accountType = data["accountType"].value;
scope.prefixType = data["prefixType"].value;
if(scope.prefixType != null){
scope.addPrefix = true;
}
scope.prefixCharacter = data.prefixCharacter;
if(scope.prefixType == 'PREFIX_SHORT_NAME'){
scope.addCharacter = true;
}
});
scope.cancel = function(){

View File

@ -19,16 +19,18 @@
<hr/>
<table class="table">
<thead>
<tr class="graybg">
<th>{{ 'label.heading.accountNumberPreferences' | translate }}</th>
</tr>
<tr class="graybg">
<th>{{ 'label.heading.accountNumberPreferences' | translate }}</th>
<th>{{ 'label.heading.prefix' | translate }}</th>
</tr>
</thead>
<tbody>
<tr class="pointer-main" data-ng-repeat="preference in preferences | filter:filterText">
<td class="pointer" data-ng-click="routeTo(preference.id)">{{preference["accountType"].value}}</td>
</tr>
<tr class="pointer-main" data-ng-repeat="preference in preferences | filter:filterText">
<td class="pointer" data-ng-click="routeTo(preference.id)">{{preference["accountType"].value}}</td>
<td class="pointer" data-ng-click="routeTo(preference.id)">{{preference["prefixType"].value}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>

View File

@ -19,11 +19,10 @@
<select chosen="accountTypeOptions" id="accountType" ng-model="formData.accountType" name="accountType" class="form-control"
ng-options="accountType.id as accountType.value for accountType in accountTypeOptions" value="{{accountType.id}}"
ng-change="getPrefixTypeOptions(formData.accountType)" required late-validate>
<option value="">--{{'label.menu.selectAccountType' | translate}}--</option>
<option value="">--{{'label.menu.selectAccountType' | translate}}--</option>
</select>
<form-validate valattributeform="addprefform" valattribute="accountType"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">{{'label.input.addPrefix' | translate}}</label>
@ -34,12 +33,18 @@
</div>
<div class="form-group" ng-show="addPrefix">
<label class="control-label col-sm-2">{{'label.input.prefixField' | translate}}</label>
<div class="col-sm-3">
<select chosen="prefixTypeOptions" id="accountNumberPrefixType" ng-model="formData.prefixType" class="form-control"
ng-options="accountNumberPrefixType.id as accountNumberPrefixType.value for accountNumberPrefixType in prefixTypeOptions" value="{{accountType.id}}">
ng-options="accountNumberPrefixType.id as accountNumberPrefixType.value for accountNumberPrefixType in prefixTypeOptions" value="{{accountType.id}}"
ng-change="accountNumberPrefix(formData.prefixType)">
<option value="">--{{'label.menu.selectPrefixField' | translate}}--</option>
</select>
</div>
<div class="col-sm-3" ng-show="addCharacter">
<input type="text" name="prefixCharacter" ng-model="formData.prefixCharacter" ng-maxlength="maxlength"/>
<span style="color:red" ng-show="addprefform.prefixCharacter.$error.maxlength">Prefix should NOT EXCEED length of the Account Number Length</span>
</div>
</div>
<div class="col-md-offset-5">
<button id="cancel" type="reset" class="btn btn-default" ng-click="cancel()">{{'label.button.cancel' | translate}}</button>
@ -49,4 +54,4 @@
</form>
</div>
</div>
</div>
</div>

View File

@ -30,10 +30,14 @@
<label class="control-label col-sm-2">{{'label.input.prefixField' | translate}}</label>
<div class="col-sm-3">
<select chosen="prefixTypeOptions" id="prefixType" ng-model="formData.prefixType" class="form-control"
ng-options="accountNumberPrefixType.id as accountNumberPrefixType.value for accountNumberPrefixType in prefixTypeOptions"
value="{{accountNumberPrefixType.id}}">
ng-options="accountNumberPrefixType.id as accountNumberPrefixType.value for accountNumberPrefixType in prefixTypeOptions"
value="{{accountNumberPrefixType.id}}" ng-change="accountNumberPrefix(formData.prefixType)">
</select>
</div>
<div class="col-sm-3" ng-show="addCharacter">
<input type="text" name="prefixCharacter" ng-model="formData.prefixCharacter" ng-maxlength="maxlength"/>
<span style="color:red" ng-show="editprefform.prefixCharacter.$error.maxlength">Prefix should NOT EXCEED length of the Account Number Length</span>
</div>
</div>
<div class="col-md-offset-5">
<button id="cancel" type="reset" class="btn btn-default" ng-click="cancel()">{{'label.button.cancel' | translate}}</button>
@ -43,4 +47,4 @@
</form>
</div>
</div>
</div>
</div>

View File

@ -48,9 +48,11 @@
</div>
<div class="form-group" ng-show="addPrefix">
<label class="col-sm-2">{{'label.input.prefixField' | translate}}</label>
<div class="col-sm-3">
{{prefixType}}
</div>
<div class="col-sm-3">{{prefixType}}</div>
</div>
<div class="form-group" ng-show="addCharacter">
<label class="col-sm-2">{{'label.input.prefixcharacter' | translate}}</label>
<div class="col-sm-3">{{prefixCharacter}}</div>
</div>
<div class="col-md-offset-5">
<button id="cancel" type="reset" class="btn btn-default" ng-click="cancel()">{{'label.button.back' | translate}}</button>
@ -59,4 +61,4 @@
</form>
</div>
</div>
</div>
</div>