Skip to content

Commit

Permalink
Blacklist changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMuhimbura committed Jun 28, 2023
1 parent 513399e commit 1653d1e
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 2 deletions.
16 changes: 15 additions & 1 deletion app/global-translations/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,14 @@
"label.input.date.of.opening.balances": "Date of opening balances",
"label.input.opening.balances.contra.account": "Opening balances contra",
"label.input.smsprovider": "SMS Provider",
"label.input.dpi": "D.P.I",
"label.input.dpi": "DPI",
"label.input.nit": "NIT",
"label.input.year": "Year",
"label.input.typification": "Typification",
"label.input.agencyid": "Agency ID",
"label.input.balance": "Balance",
"label.input.disbursementAmount": "Disbursement Amount",
"label.addtoblacklist": "Add To Blacklist",
"#journalEntryType code ": ".............",
"journalEntryType.credit": "Credit",
"journalEntrytType.debit": "Debit",
Expand Down Expand Up @@ -1510,6 +1517,7 @@
"label.anchor.unassignsavingsofficer": "Unassign Savings Officer",
"label.anchor.rescheduleLoan": "Reschedule Loan",
"label.anchor.reschedulerequest": "Reschedule Request",
"label.anchor.blacklistClient": "Blacklist Customer",
"#Inputs": "..",
"label.input.grouptotal": "Group total",
"label.input.centertotal": "Center total",
Expand Down Expand Up @@ -1578,6 +1586,12 @@
"label.input.applicationdate": "Application Date",
"label.input.isTopup": "Is Topup Loan",
"label.input.loanIdToClose": "Choose loan to close",
"label.input.typification": "Typification",
"blacklist.option.direct.sanitized": "direct sanitized",
"blacklist.option.indirect.sanitized": "Indirect sanitized",
"blacklist.option.deliquent": "Delinquent",
"blacklist.option.frontman": "Frontman",
"blacklist.option.returns": "Returns",
"#Buttons": "..",
"label.button.addloancharge": "Add Loan Charge",
"label.button.addcollateral": "Add Collateral",
Expand Down
2 changes: 2 additions & 0 deletions app/global-translations/locale-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@
"label.input.additionalinformation": "Información adicional",
"label.input.changelanguage": "Cambiar el idioma:",
"label.input.dpi": "D.P.I",
"label.addtoblacklist": "Añadir a la lista negra",
"label.search.scope.all": "Todo",
"label.search.scope.clients.and.clientIdentifiers": "Clientes",
"label.search.scope.groups.and.centers": "Grupos",
Expand Down Expand Up @@ -681,6 +682,7 @@
"label.anchor.reactivate": "Reactivar",
"label.anchor.undoReject": "Deshacer Rechazo",
"label.anchor.undoWithdrawn": "Deshacer Retiro",
"label.anchor.blacklistClient": "Cliente de la lista negra",
"label.input.filterbynameaccno": "Filtrar lo que se muestra por nombre/cliente/personal/oficina",
"label.input.searchByNameAccNo": "Buscar por nombre/móvil/cliente/id. externo/identificador",
"label.input.selectclientimage": "Seleccionar imagen del cliente",
Expand Down
35 changes: 35 additions & 0 deletions app/scripts/controllers/blacklist/AddToBlacklistController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
(function (module) {
mifosX.controllers = _.extend(module, {
AddToBlacklistController: function (scope, routeParams, route, location, resourceFactory, http, $uibModal, API_VERSION, $timeout, $rootScope, Upload) {
scope.client = null;
scope.typificationOptions = [];
scope.loanProductOptions = [];

scope.formData={};


resourceFactory.blacklistTemplateResource.get({clientId: routeParams.clientId}, function (data) {
scope.client = data;
scope.formData['dpiNumber'] = data.dpi
scope.formData['clientName'] = data.clientName
scope.typificationOptions= data.typificationOptions
scope.loanProductOptions= data.loanProducts
});



scope.submit=function (){
this.formData.locale = scope.optlang.code;

resourceFactory.blacklistResource.save({clientId: routeParams.clientId}, this.formData, function (data) {
location.path('/viewclient/' + routeParams.clientId );
});
}

}
});

mifosX.ng.application.controller('AddToBlacklistController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', '$http', '$uibModal', 'API_VERSION', '$timeout', '$rootScope', 'Upload', mifosX.controllers.AddToBlacklistController]).run(function ($log) {
$log.info("AddToBlacklistController initialized");
});
}(mifosX.controllers || {}));
3 changes: 2 additions & 1 deletion app/scripts/mifosXComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ define(['Q', 'underscore', 'mifosX'], function (Q) {
'cupo/CreateCupoController',
'cupo/ViewCupoController',
'cupo/EditCupoController',
'client/ViewGroupCupoController'
'client/ViewGroupCupoController',
'blacklist/AddToBlacklistController'
],
filters: [
'StatusLookup',
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,10 @@
})
.when('/transferagency/:id', {
templateUrl: 'views/organization/transferagency.html'
}).when('/clients/blacklist', {
templateUrl: 'views/blacklist/blacklist.html'
}).when('/clients/addblacklist/:clientId', {
templateUrl: 'views/blacklist/addToBlacklist.html'
});
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(false);
Expand Down
10 changes: 10 additions & 0 deletions app/scripts/services/ResourceFactoryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@
update: { method: 'PUT'},
retrieveTransferDate: { method: 'GET', params:{}, isArray: true}
}),

blacklistResource: defineResource(apiVer + "/blacklist/:clientId", {clientId: '@clientId', status: '@status'}, {
getAllBlacklistClients: {method: 'GET', params: {limit: 1000, status: '@status'}},
save: { method: 'POST'},
update: { method: 'PUT'}
}),

blacklistTemplateResource: defineResource(apiVer + "/blacklist/template/:clientId", {clientId: '@clientId'}, {
get: {method: 'GET', params: {}},
}),
clientChargesResource: defineResource(apiVer + "/clients/:clientId/charges/:resourceType", {clientId: '@clientId', resourceType: '@resourceType'}, {
getCharges: {method: 'GET'},
waive:{method:'POST' , params:{command : 'waive'}}
Expand Down
143 changes: 143 additions & 0 deletions app/views/blacklist/addToBlacklist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<div class="content-container" ng-controller="AddToBlacklistController">
<ul class="breadcrumb">
<li><a href="#/clients">{{'label.anchor.clients' | translate}}</a></li>
<li><a href="#/viewclient/{{clientId}}">{{'label.anchor.viewclient' | translate}}</a></li>
<li class="active">{{'label.anchor.blacklistClient' | translate}}</li>
</ul>
<form name="blacklistForm" novalidate="" class="card form-horizontal well" rc-submit="submit()">
<api-validate></api-validate>
<fieldset>
<legend>{{'label.anchor.blacklistClient' | translate}}</legend>

<div class="form-group">
<label class="control-label col-sm-2" for="clientName">{{'label.input.clientName' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="clientName" type="text" name="clientName" ng-model="formData.clientName" disabled
required="required" class="form-control" required late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="dpi"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="dpiNum">{{'label.input.dpi' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="dpiNum" type="text" name="dpi" ng-model="formData.dpiNumber" disabled
required="required" class="form-control" required late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="dpi"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="dpiNum">{{'label.input.nit' | translate}}</label>

<div class="col-sm-3">
<input id="nit" type="text" name="nit" ng-model="formData.nit"
class="form-control" required late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="nit"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="typfcn">{{'label.input.typification' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<select id="typfcn" ng-model="formData.typification"
ng-options="typification.id as typification.name |translate for typification in typificationOptions"
value="{{typification.id}}" required="required" class="form-control">
</select>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="loanProd">{{'label.input.loanProduct' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<select id="loanProd" ng-model="formData.loanProduct"
ng-options="product.id as product.name |translate for product in loanProductOptions"
value="{{product.id}}" required="required" class="form-control">
</select>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="agency">{{'label.input.agencyid' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="agency" type="text" name="agency" ng-model="formData.agencyId"
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="agency"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="balance">{{'label.input.balance' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="balance" type="number" name="balance" ng-model="formData.balance"
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="balance"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="disbursement">{{'label.input.disbursementAmount' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="disbursement" type="number" name="disbursement" ng-model="formData.disbursementAmount"
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="disbursement"/>
</div>
</div>

<div class="form-group">
<label class="control-label col-sm-2" for="year">{{'label.input.year' | translate}}<span
class="required">*</span></label>

<div class="col-sm-3">
<input id="year" type="number" name="year" ng-model="formData.year"
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="year"/>
</div>
</div>


<div class="form-group">
<label class="control-label col-sm-2" for="description">{{'label.input.description' | translate}}</label>

<div class="col-sm-3">
<textarea id="description" rows="2" ng-model="formData.description" class="form-control"></textarea>
</div>
</div>

<div class="col-md-offset-3">
<a id="cancel" href="#/viewclient/{{clientId}}">
<button type="reset" class="btn btn-default">{{'label.button.cancel' | translate}}</button>
</a>
<button id="save" type="submit" has-permission='CREATE_CLIENTIDENTIFIER' class="btn btn-primary">{{'label.button.save' | translate}}</button>
</div>
</fieldset>
</form>
</div>
88 changes: 88 additions & 0 deletions app/views/blacklist/blacklist.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<div class="content-container" ng-controller="ClientController">
<ul class="breadcrumb">
<li class="active">{{'label.anchor.clients' | translate}}</li>
</ul>
<api-validate></api-validate>

<div class="card">
<div class="toolbar">
<h4 class="pull-left">List of Clients</h4>
</div>
<div class="content">
<br>
<div class="row">
<div class="col-sm-8">
<form ng-submit="search()" class="form-horizontal">
<div class="form-group">
<div class="col-md-4">
<input ng-autofocus="true" ng-model="filterText" ng-keyup="onFilter()" type="text"
class="form-control unstyled"
placeholder="{{'label.input.filterbynameaccno' | translate}}">
</div>
<div class="col-md-8">
<div class="input-group">
<input data-ng-model="searchText" type="text"
placeholder="{{'label.input.searchByNameAccNo' | translate}}"
class="form-control unstyled"/>
<span class="input-group-btn">
<button class="btn btn-primary form-control">
<span class="fa fa-search"></span>
</button>
</span>
<div class="checkbox form-control">
<label for="showAll">
<input type="checkbox" id="showAll" name="showAll" ng-model="showClosed">
&nbsp;{{'label.button.showall' | translate }}
</label>
</div>
</div>
</div>
</div>
</form>
</div>
<div class="col-sm-4">
<a href="#/createclient" class="btn btn-primary pull-right" has-permission='CREATE_CLIENT'><i
class="fa fa-plus"></i> {{'label.button.createclient' | translate}}</a> &nbsp;&nbsp;
<a href="#/bulkimportclients" style="margin-right: 5px" class="btn btn-primary pull-right" has-permission='CREATE_CLIENT'><i
class="fa fa-upload"></i>&nbsp;{{'label.button.importclients' | translate}}</a>
</div>
</div>
<hr/>
<table class="table">
<thead>
<tr>
<th>{{'label.heading.name' | translate}}</th>
<th>{{'label.heading.clientno' | translate}}</th>
<th>{{'label.heading.externalid' | translate}}</th>
<th>{{'label.heading.status' | translate}}</th>
<th>{{'label.heading.office' | translate}}</th>
<th>{{'label.heading.staff' | translate}}</th>
</tr>
</thead>

<tbody>
<tr dir-paginate="client in clients | orderBy:'displayName':reverse | filter:filterText | itemsPerPage: clientsPerPage" class="pointer-main"
total-items="totalClients" pagination-id="clients" ng-show="client.status.code != 'clientStatusType.closed' || showClosed">
<td class="pointer" data-ng-click="routeTo(client.id)">{{client.displayName}}</td>
<td class="pointer" data-ng-click="routeTo(client.id)">{{client.accountNo}}</td>
<td class="pointer" data-ng-click="routeTo(client.id)">{{client.externalId}}</td>
<td class="pointer" data-ng-click="routeTo(client.id)">
<i class="fa fa-stop {{client.status.code | StatusLookup}}" uib-tooltip="{{client.status.value}}" uib-tooltip-placement="top" ></i>
<small ng-if="client.subStatus.description">[{{client.subStatus.description}}]</small>
</td>
<td class="pointer" data-ng-click="routeTo(client.id)">{{client.officeName}}</td>
<td class="pointer" data-ng-click="routeTo(client.id)">{{client.staffName}}</td>
</tr>
</tbody>

</table>
<dir-pagination-controls align="center" boundary-links="true"
template-url="bower_components/angular-utils-pagination/dirPagination.tpl.html"
on-page-change="getResultsPage(newPageNumber)" pagination-id="clients">
</dir-pagination-controls>

</div>
</div>


</div>
4 changes: 4 additions & 0 deletions app/views/clients/viewclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ <h3 class="client-title">
<li class="{{button.icon}}">
<a href="#/selfservice/createuser/{{client.id}}">{{'label.createselfserviceuser' | translate}}</a>
</li>

<li class="{{button.icon}}" has-permission='ADD_CLIENTBLACKLIST'>
<a href="#/clients/addblacklist/{{client.id}}">{{'label.addtoblacklist' | translate}}</a>
</li>
</ul>
</span>
</div>
Expand Down

0 comments on commit 1653d1e

Please sign in to comment.