Skip to content

Commit

Permalink
Remove client from blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMuhimbura committed Jul 4, 2023
1 parent 14f2fbd commit 19c7609
Show file tree
Hide file tree
Showing 10 changed files with 230 additions and 11 deletions.
5 changes: 5 additions & 0 deletions app/global-translations/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@
"label.anchor.advsearch": "Advanced search",
"label.anchor.keyboardshortcut": "Keyboard Shortcuts",
"label.anchor.save": "Save",
"label.anchor.removeblacklist": "Remove From Blacklist",
"#Inputs": "..",
"label.input.searchbyuser": "Search by user",
"label.input.clienttemplate": "Client Template",
Expand All @@ -660,6 +661,7 @@
"label.input.additionalinformation": "Additional information",
"label.input.personalinformation": "Personal information",
"label.input.changelanguage": "Change language:",
"label.input.supportingDocuments": "Supporting Documents",
"#Search": "..",
"label.search.scope.all": "All",
"label.search.scope.clients.and.clientIdentifiers": "Clients",
Expand Down Expand Up @@ -734,6 +736,7 @@
"label.anchor.reactivate": "Reactivate",
"label.anchor.undoReject": "Undo Rejection",
"label.anchor.undoWithdrawn": "Undo Withdrawal",
"label.anchor.uploadDocuments": "Upload Supporting Documents(Zip Format)",
"#Inputs": "..",
"label.input.filterbynameaccno": "Filter display by name/client number/staff/office",
"label.input.searchByNameAccNo": "Find by name/mobile/client number/external ID/identifier",
Expand Down Expand Up @@ -795,6 +798,7 @@
"label.button.viewactiveshares": "View Active Shares",
"label.button.undoReject": "Undo Rejection",
"label.button.undoWithdrawn": "Undo Withdrawal",
"label.button.showinactive": "Show Inactive Blacklist",
"#Misc Labels": "..",
"label.numofloancycles": "Number of loan cycle(s)",
"label.lastloanamount": "Last loan amount",
Expand Down Expand Up @@ -835,6 +839,7 @@
"error.msg.client.duplicate.externalId": "A client with external id `{{params[0].value}}` already exists.",
"error.msg.client.duplicate.accountNo": "A client with account no. `{{params[0].value}}` already exists.",
"error.msg.client.duplicate.dpi": "A client with dpi. `{{params[0].value}}` already exists.",
"error.msg.client.blacklisted": "This person is blacklisted. REASON: `{{params[0].value}}` ",
"error.msg.client.already.blacklisted": "A client with dpi. `{{params[0].value}}` is already blacklisted.",
"error.msg.client.id.invalid": "Client does not exist.",
"error.msg.client.not.active.exception": "The Client with ID `{{params[0].value}}` is not active.",
Expand Down
5 changes: 5 additions & 0 deletions app/global-translations/locale-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,7 @@
"error.msg.client.duplicate.externalId": "Un cliente con ID externa `{{params[0].value}}` ya existe.",
"error.msg.client.duplicate.accountNo": "Ya existe un cliente con el número de cuenta `{{params[0].value}}`.",
"error.msg.client.duplicate.dpi": "Un cliente con dpi. `{{params[0].value}}` ya existe.",
"error.msg.client.blacklisted": "Esta persona esta en la lista negra. MOTIVO: `{{params[0].value}}` ",
"error.msg.client.id.invalid": "El cliente no existe.",
"error.msg.client.not.active.exception": "El Cliente con el ID `{{params[0].value}}` no está activo.",
"validation.msg.clientIdentifier.documentKey.cannot.be.blank": "El n.º de identificación es obligatorio.",
Expand Down Expand Up @@ -1023,6 +1024,7 @@
"label.anchor.editfinancialmapping": "Editar mapeo de actividad financiera",
"label.anchor.journalentries": "Entradas de Diario",
"label.anchor.viewjournalentries": "Ver Entradas de Diario",
"label.anchor.removeblacklist": "Eliminar de la lista negra",
"label.input.accountingrulename": "Nombre de la regla de contabilidad",
"label.input.affectedentries": "Entradas afectadas",
"label.input.accountingrules": "Normas de contabilidad",
Expand Down Expand Up @@ -1062,6 +1064,7 @@
"label.input.date.of.opening.balances": "Fecha de saldos de apertura",
"label.input.opening.balances.contra.account": "Saldos de apertura de contra",
"label.input.smsprovider": "Proveedor de SMS",
"label.input.supportingDocuments": "Documentos de respaldo",
"journalEntryType.credit": "Crédito",
"journalEntrytType.debit": "Débito",
"label.button.addfamilymember": "Añadir miembro de la familia",
Expand Down Expand Up @@ -1394,6 +1397,7 @@
"label.anchor.unassignsavingsofficer": "Desasignar agente de ahorros",
"label.anchor.rescheduleLoan": "Reprogramar Préstamo",
"label.anchor.reschedulerequest": "Reschedule Petición",
"label.anchor.uploadDocuments": "Subir documentos de respaldo (formato zip)",
"label.input.grouptotal": "Grupo total",
"label.input.centertotal": "Centro total",
"label.input.charge": "Cargo",
Expand Down Expand Up @@ -1483,6 +1487,7 @@
"label.button.reschedule": "Reprogramar",
"label.button.recreate": "Recrear",
"label.button.foreclosure": "Foreclosure",
"label.button.showinactive": "Mostrar lista negra inactiva",
"label.selectpurpose": "Seleccione propósito",
"label.selectloanproduct": "Seleccione producto de préstamo",
"label.selectsavingsofficer": "Seleccionar agente de ahorros",
Expand Down
9 changes: 9 additions & 0 deletions app/scripts/controllers/blacklist/BlacklistController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
BlacklistController: function (scope, routeParams, route, location, resourceFactory, http, $uibModal, API_VERSION, $timeout, $rootScope, Upload) {
scope.blacklist = [];
scope.actualBlacklist = [];
scope.showInactive = false;

scope.formData={};
scope.searchText;
Expand All @@ -17,6 +18,7 @@
var items = resourceFactory.blacklistResource.getAllBlacklistClients({
offset: ((pageNumber - 1) * scope.clientsPerPage),
limit: scope.clientsPerPage,
status: scope.showInactive? 'INACTIVE' : 'ACTIVE',
searchText:scope.searchText
}, function (data) {
scope.totalClients = data.totalFilteredRecords;
Expand All @@ -27,6 +29,7 @@
resourceFactory.blacklistResource.getAllBlacklistClients({
offset: 0,
limit: scope.clientsPerPage,
status: scope.showInactive? 'INACTIVE' : 'ACTIVE',
searchText:scope.searchText
}, function (data) {
scope.totalClients = data.totalFilteredRecords;
Expand All @@ -37,7 +40,13 @@
location.path(path);
}

scope.getActiveInactive = function () {
scope.showInactive = !scope.showInactive;
scope.getResultsPage(1);
}

}

});

mifosX.ng.application.controller('BlacklistController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', '$http', '$uibModal', 'API_VERSION', '$timeout', '$rootScope', 'Upload', mifosX.controllers.BlacklistController]).run(function ($log) {
Expand Down
62 changes: 62 additions & 0 deletions app/scripts/controllers/blacklist/RemoveBlacklistController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
(function (module) {
mifosX.controllers = _.extend(module, {
RemoveBlacklistController: function (scope, routeParams, route, location, resourceFactory, http, $uibModal, API_VERSION, $timeout, $rootScope, Upload) {
scope.client = null;
scope.dpi = null;
scope.typificationOptions = [];
scope.loanProductOptions = [];
scope.blacklistDocuments = [];
scope.action = routeParams.action;

scope.formData={};


resourceFactory.blacklistResource.getOne({blacklistId: routeParams.blacklistId}, function (data) {
scope.client = data;
});

resourceFactory.blacklistDocumentsResource.getAllDocuments({blacklistId: routeParams.blacklistId}, function (data) {
for (var l in data) {

var bldocs = {};
bldocs = API_VERSION + '/' + data[l].parentEntityType + '/' + data[l].parentEntityId + '/documents/' + data[l].id + '/attachment?tenantIdentifier=' + $rootScope.tenantIdentifier;
data[l].docUrl = bldocs;
if (data[l].fileName)
if (data[l].fileName.toLowerCase().indexOf('.jpg') != -1 || data[l].fileName.toLowerCase().indexOf('.jpeg') != -1 || data[l].fileName.toLowerCase().indexOf('.png') != -1)
data[l].fileIsImage = true;
if (data[l].type)
if (data[l].type.toLowerCase().indexOf('image') != -1)
data[l].fileIsImage = true;
}
scope.blacklistDocuments = data;
});

scope.submit = function () {
Upload.upload({
url: $rootScope.hostUrl + API_VERSION + '/blacklist/' + routeParams.blacklistId+ '/removeblacklist',
data: { name : scope.client.clientName, description : scope.formData.description, file: scope.formData.file},
}).then(function (data) {
// to fix IE not refreshing the model
if (!scope.$$phase) {
scope.$apply();
}
location.path('/blacklist');
});
};
scope.routeTo = async ()=>{
await setTimeout(function (){
location.path('/blacklist' );
},3000);
}

scope.onFileSelect = function (files) {
scope.formData.file = files[0];
};

}
});

mifosX.ng.application.controller('RemoveBlacklistController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', '$http', '$uibModal', 'API_VERSION', '$timeout', '$rootScope', 'Upload', mifosX.controllers.RemoveBlacklistController]).run(function ($log) {
$log.info("RemoveBlacklistController 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 @@ -386,7 +386,8 @@ define(['Q', 'underscore', 'mifosX'], function (Q) {
'cupo/EditCupoController',
'client/ViewGroupCupoController',
'blacklist/AddToBlacklistController',
'blacklist/BlacklistController'
'blacklist/BlacklistController',
'blacklist/RemoveBlacklistController'
],
filters: [
'StatusLookup',
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,8 @@
templateUrl: 'views/organization/transferagency.html'
}).when('/blacklist', {
templateUrl: 'views/blacklist/blacklist.html'
}).when('/blacklist/:blacklistId/:action', {
templateUrl: 'views/blacklist/removeblacklist.html'
}).when('/clients/addblacklist/:clientId', {
templateUrl: 'views/blacklist/addToBlacklist.html'
});
Expand Down
7 changes: 6 additions & 1 deletion app/scripts/services/ResourceFactoryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,17 @@
retrieveTransferDate: { method: 'GET', params:{}, isArray: true}
}),

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

blacklistDocumentsResource: defineResource(apiVer + "/blacklist/:blacklistId/documents/:documentId", {blacklistId: '@blacklistId', documentId: '@documentId'}, {
getAllDocuments: {method: 'GET', params: {}, isArray: true}
}),

blacklistTemplateResource: defineResource(apiVer + "/blacklist/template/:clientId", {clientId: '@clientId'}, {
get: {method: 'GET', params: {}},
}),
Expand Down
16 changes: 8 additions & 8 deletions app/views/blacklist/addToBlacklist.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
required="required" class="form-control" required late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="dpi"/>
<form-validate valattributeform="blacklistForm" valattribute="dpi"/>
</div>
</div>

Expand All @@ -43,7 +43,7 @@
class="form-control" required late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="nit"/>
<form-validate valattributeform="blacklistForm" valattribute="nit"/>
</div>
</div>

Expand Down Expand Up @@ -80,7 +80,7 @@
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="agency"/>
<form-validate valattributeform="blacklistForm" valattribute="agency"/>
</div>
</div>

Expand All @@ -93,7 +93,7 @@
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="balance"/>
<form-validate valattributeform="blacklistForm" valattribute="balance"/>
</div>
</div>

Expand All @@ -106,7 +106,7 @@
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="disbursement"/>
<form-validate valattributeform="blacklistForm" valattribute="disbursement"/>
</div>
</div>

Expand All @@ -119,7 +119,7 @@
required="required" class="form-control" late-Validate/>
</div>
<div class="col-sm-3">
<form-validate valattributeform="clientidentifierform" valattribute="year"/>
<form-validate valattributeform="blacklistForm" valattribute="year"/>
</div>
</div>

Expand All @@ -133,10 +133,10 @@
</div>

<div class="col-md-offset-3">
<a id="cancel" href="#/viewclient/{{clientId}}">
<a id="cancel" href="#/blacklist">
<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>
<button id="save" type="submit" has-permission='ADD_BLACKLIST' class="btn btn-primary">{{'label.button.save' | translate}}</button>
</div>
</fieldset>
</form>
Expand Down
17 changes: 16 additions & 1 deletion app/views/blacklist/blacklist.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ <h4 class="pull-left">Blacklisted Clients</h4>
</div>
</form>
</div>
<!-- <div class="col-sm-4">-->

<div class="col-sm-4">
<div class="checkbox">
<label for="showAll">
<input type="checkbox" id="showAll" name="showAll" ng-model="showAll" ng-change="getActiveInactive()">
&nbsp;{{'label.button.showinactive' | translate }}
</label>
</div>
</div>
<!-- <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-->
Expand All @@ -50,6 +58,7 @@ <h4 class="pull-left">Blacklisted Clients</h4>
<th>{{'label.input.agencyId' | translate}}</th>
<th>{{'label.input.balance' | translate}}</th>
<th>{{'label.input.disbursementAmount' | translate}}</th>
<th>{{'label.heading.action' | translate}}</th>
</tr>
</thead>

Expand All @@ -67,6 +76,12 @@ <h4 class="pull-left">Blacklisted Clients</h4>
<td class="pointer">{{client.agencyId}}</td>
<td class="pointer">{{client.balance |number}}</td>
<td class="pointer">{{client.disbursementAmount |number}}</td>
<td class="pointer">
<a ng-if="client.status=='ACTIVE'" href="#/blacklist/{{client.id}}/removeblacklist" has-permission='REMOVE_BLACKLIST'>
<i class="fa fa-minus-square-o fa fa-2x" title="Remove From Blacklist"></i></a>
<a ng-if="client.status!='ACTIVE'" href="#/blacklist/{{client.id}}/viewdetails" has-permission='VIEW_BLACKLIST'>
<i class="fa fa-search fa fa-2x" title="Remove From Blacklist"></i></a>
</td>
</tr>
</tbody>

Expand Down
Loading

0 comments on commit 19c7609

Please sign in to comment.