Skip to content

Commit

Permalink
Release/1.0.1 prepare (#21)
Browse files Browse the repository at this point in the history
* FBR-75 Refactor the creation of a center and added the ability to edit an existing center (#9)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-102 Como líder de Agencia, quiero crear uno o mas grupos (#10)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-102 - Fix edition of Portfolio (#11)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-101 - Necesito trasladar grupos a otro centro (#12)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-101 Fix parameter validation (#13)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-151 Feedback Sprint 4 (#15)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-137 Como gerente quiero mover una agencia a otra región (#16)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-108 Planificación para facilitadores (#17)

Co-authored-by: Leonardo Hildt <[email protected]>

* FBR-142 Asignación de responsables por estructura Fiter (#18)

Co-authored-by: Leonardo Hildt <[email protected]>

* Mostrar usuario responsable (facilitador) en gestión de cartera (#19)

Co-authored-by: Leonardo Hildt <[email protected]>

* Fix for FBR-175 - Error when editing a portfolio (#20)

Co-authored-by: Leonardo Hildt <[email protected]>

---------

Co-authored-by: Leonardo Hildt <[email protected]>
  • Loading branch information
fiterlatam and leonardohildt authored Jun 8, 2023
1 parent e929e39 commit c00fcbf
Show file tree
Hide file tree
Showing 16 changed files with 404 additions and 20 deletions.
17 changes: 17 additions & 0 deletions app/global-translations/locale-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4196,5 +4196,22 @@
"label.heading.availability.centers": "Centros y horarios disponibles",
"label.heading.transfergroup": "Transferir grupo",
"label.heading.centermeetingtimes": "Horarios de reunión",
"label.input.centerReferencePoint": "Punto de referencia",
"label.heading.transferAgency": "Transferir agencia",
"label.heading.availability.regions": "Regiones disponibles",
"label.anchor.manageagency": "Gestionar agencias",
"label.anchor.transferagency": "Transferir agencia",
"label.heading.regionName": "Nombre de la región",
"label.anchor.portfoliosplanning": "Planificación de carteras",
"label.portfolioplanning": "Acceso a la planificación por cartera",
"label.heading.agencyName": "Agencia",
"label.heading.portfolioplanning": "Planificación de la cartera",
"label.heading.planningDay": "Día",
"label.heading.meetingStartTime": "Hora",
"label.heading.portfolioCenterId": "Nro. Centro",
"label.heading.centerGroupId": "Nro. Grupo",
"label.heading.centerGroupName": "Grupo",
"validation.msg.user.roles.not.supported.more.than.one.role": "Solo es posible asignar un rol al usuario.",
"label.heading.responsibleUser": "Usuario responsable",
"----End---": "---Fin del archivo---"
}
5 changes: 5 additions & 0 deletions app/scripts/controllers/organization/AgenciesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
data.sort(sortByParentId);

});

scope.transferAgency=function(agencyId)
{
location.path('/transferagency/'+ agencyId);
}
}
});
mifosX.ng.application.controller('AgenciesController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AgenciesController]).run(function ($log) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
scope.submit = function () {
// remove extra fields from form data
delete this.formData.parentName;
delete this.formData.responsibleUserName;
delete this.formData.centers;

this.formData.locale = scope.optlang.code;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
(function (module) {
mifosX.controllers = _.extend(module, {
PortfoliosPlanningController: function (scope, resourceFactory, location) {

scope.routeTo = function (id) {
location.path('/viewportfolioplanning/' + 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.PortfoliosPerPage =15;
resourceFactory.portfolioResource.getAllPortfoliosForCurrentUser(function (data) {
scope.portfolios = scope.deepCopy(data);

function sortByParentId(a, b) {
return a.parentId - b.parentId;
}

data.sort(sortByParentId);

});
}
});
mifosX.ng.application.controller('PortfoliosPlanningController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.PortfoliosPlanningController]).run(function ($log) {
$log.info("PortfoliosPlanningController initialized");
});
}(mifosX.controllers || {}));
65 changes: 65 additions & 0 deletions app/scripts/controllers/organization/TransferAgencyController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
(function (module) {
mifosX.controllers = _.extend(module, {
TransferAgencyController: function (scope, resourceFactory, route, location, routeParams, $uibModal, dateFilter) {
scope.regionsAvailability = [];
scope.agencyData = {};
scope.tf = "HH:mm";
let agencyId = routeParams.id;
let currentParentId = 0;

resourceFactory.agencyResource.get({agencyId: routeParams.id}, function (data) {
scope.agency = data;
if(data.parentId) {
currentParentId = data.parentId;
}

let requestParams = {orderBy: 'description', sortOrder: 'ASC'};
resourceFactory.officeChildrenByUserResource.get(requestParams, function (data) {
// list of offices related to regions available to transfer the agency
for (var i = 0; i < data.length; i++) {
let id = data[i].id;
let name = data[i].name;
if (currentParentId != id) {
scope.regionsAvailability.push({parentId: id, parentName: name})
}
}
});
});

scope.transferAgency = function (parentId) {
scope.agencyData.newRegionId = parentId;

$uibModal.open({
templateUrl: 'transferAgency.html',
controller: TransferAgency
});
}

var TransferAgency = function ($scope, $uibModalInstance) {
$scope.transfer = function () {

resourceFactory.transferAgencyResource.transfer({'agencyId':agencyId}, scope.agencyData, function (data) {
$uibModalInstance.close('transfer');
location.path('/agencies/');
});
};
$scope.cancel = function () {
$uibModalInstance.dismiss('cancel');
};
};

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

resourceFactory.transferCenterGroupResource.transfer({'portfolioCenterId':portfolioCenterId, 'centerGroupId': centerGroupId}, this.formData, function (data) {
location.path('/viewcentergroups/' + portfolioId + "/" + portfolioCenterId);
});
};
}
});
mifosX.ng.application.controller('TransferAgencyController', ['$scope', 'ResourceFactory', '$route', '$location', '$routeParams', '$uibModal', 'dateFilter', mifosX.controllers.TransferAgencyController]).run(function ($log) {
$log.info("TransferAgencyController initialized");
});
}(mifosX.controllers || {}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(function (module) {
mifosX.controllers = _.extend(module, {
ViewPortfolioPlanningController: function (scope, routeParams, route, location, resourceFactory) {
scope.centers=[];

resourceFactory.portfolioPlanningResource.get({portfolioId: routeParams.id}, function (data) {
scope.portfolio = data;

// centers associated with this portfolio
if (data.detailedPlanningData) {
scope.detailedPlanningData = data.detailedPlanningData;
scope.convertTimeArrayToObject('meetingStartTime');
scope.convertTimeArrayToObject('meetingEndTime');
}
});

scope.convertTimeArrayToObject = function(timeFieldName){
var date = new Date();
for(var i in scope.detailedPlanningData){
scope.detailedPlanningData[i][timeFieldName] = new Date(date.getFullYear(), date.getMonth(), date.getDay(), scope.detailedPlanningData[i][timeFieldName][0], scope.detailedPlanningData[i][timeFieldName][1], 0);
}
};
}

});
mifosX.ng.application.controller('ViewPortfolioPlanningController', ['$scope', '$routeParams', '$route', '$location', 'ResourceFactory', mifosX.controllers.ViewPortfolioPlanningController]).run(function ($log) {
$log.info("ViewPortfolioPlanningController initialized");
});
}(mifosX.controllers || {}));
3 changes: 3 additions & 0 deletions app/scripts/mifosXComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ define(['Q', 'underscore', 'mifosX'], function (Q) {
'organization/CreateCenterGroupController',
'organization/EditCenterGroupController',
'organization/TransferCenterGroupController',
'organization/TransferAgencyController',
'organization/PortfoliosPlanningController',
'organization/ViewPortfolioPlanningController',
'organization/CurrencyConfigController',
'organization/CreateUserController',
'organization/EditUserController',
Expand Down
9 changes: 9 additions & 0 deletions app/scripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,18 @@
.when('/portfolios', {
templateUrl: 'views/organization/portfolios.html'
})
.when('/planningportfolios', {
templateUrl: 'views/organization/planningportfolios.html'
})
.when('/createportfolio', {
templateUrl: 'views/organization/createportfolio.html'
})
.when('/viewportfolio/:id', {
templateUrl: 'views/organization/viewportfolio.html'
})
.when('/viewportfolioplanning/:id', {
templateUrl: 'views/organization/viewportfolioplanning.html'
})
.when('/editportfolio/:id', {
templateUrl: 'views/organization/editportfolio.html'
})
Expand All @@ -1186,6 +1192,9 @@
})
.when('/transfercentergroup/:portfolioId/:portfolioCenterId/:centerGroupId', {
templateUrl: 'views/organization/transfercentergroup.html'
})
.when('/transferagency/:id', {
templateUrl: 'views/organization/transferagency.html'
});
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(false);
Expand Down
23 changes: 23 additions & 0 deletions app/scripts/services/ResourceFactoryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
officeImportTemplateResource: defineResource(apiVer + "/offices/bulkimporttemplate", {}, {
get: {method: 'GET', params: {}}
}),
officeChildrenByUserResource: defineResource(apiVer + "/offices/user", {}, {
get: {method: 'GET', params: {}, isArray: true}
}),
importResource: defineResource(apiVer + "/imports", {}, {
getImports: {method: 'GET', params: {}, isArray: true}
}),
Expand Down Expand Up @@ -887,6 +890,9 @@
portfolioCenterTemplateResource: defineResource(apiVer + "/portfolios/:portfolioId/centers/template", {}, {
get: {method: 'GET', params: {}}
}),
portfolioPlanningResource: defineResource(apiVer + "/portfolios/:portfolioId/planning", {}, {
get: {method: 'GET', params: {}}
}),
portfolioCenterByCurrentUserResource: defineResource(apiVer + "/portfolios/:portfolioId/centers", {}, {
get: {method: 'GET', params: {}, isArray: true}
}),
Expand All @@ -905,9 +911,26 @@
save: {method: 'POST', params: {}},
update: { method: 'PUT'}
}),
portfolioAllCentersAvailabilityResource: defineResource(apiVer + "/portfolios/:portfolioId/centers/availability", {portfolioId: "@portfolioId"}, {
get: {method: 'GET', params: {}, isArray: true},
}),
centerGroupTemplateResource: defineResource(apiVer + "/centers/:portfolioCenterId/groups/template", {}, {
get: {method: 'GET', params: {}}
}),
centerGroupResource: defineResource(apiVer + "/centers/:portfolioCenterId/groups/:centerGroupId", {portfolioCenterId: "@portfolioCenterId", centerGroupId: "@centerGroupId"}, {
get: {method: 'GET', params: {}, isArray: false},
save: {method: 'POST', params: {}},
update: { method: 'PUT'}
}),
transferCenterGroupResource: defineResource(apiVer + "/centers/:portfolioCenterId/groups/:centerGroupId/transfer", {portfolioCenterId: "@portfolioCenterId", centerGroupId: "@centerGroupId"}, {
transfer: { method: 'PUT'}
}),
transferCenterGroupResource: defineResource(apiVer + "/centers/:portfolioCenterId/groups/:centerGroupId/transfer", {portfolioCenterId: "@portfolioCenterId", centerGroupId: "@centerGroupId"}, {
transfer: { method: 'PUT'}
}),
transferAgencyResource: defineResource(apiVer + "/agencies/:agencyId/transfer", {agencyId: "@agencyId"}, {
transfer: { method: 'PUT'}
}),
};
}];
}
Expand Down
9 changes: 8 additions & 1 deletion app/views/administration/organization.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ <h5 class="list-group-item-heading"><i class="fa fa-credit-card fa fa-large"></i
<p class="list-group-item-text">{{'label.addnewsupervisionormodifysupervision'
| translate}}</p>
</a>
<a class="list-group-item" href="#/portfolios" has-permission='READ_PORTFOLIO'>
<a class="list-group-item" href="#/portfolios" has-permission='MANAGEMENT_PORTFOLIO'>
<h5 class="list-group-item-heading"><i class="fa fa-book fa fa-large"></i>&nbsp;&nbsp;{{'label.anchor.manageportfolios'
| translate}}</h5>

<p class="list-group-item-text">{{'label.addnewportfolioormodifyportfolio'
| translate}}</p>
</a>
<a class="list-group-item" href="#/planningportfolios" has-permission='PLANNING_PORTFOLIO'>
<h5 class="list-group-item-heading"><i class="fa fa-book fa fa-large"></i>&nbsp;&nbsp;{{'label.anchor.portfoliosplanning'
| translate}}</h5>

<p class="list-group-item-text">{{'label.portfolioplanning'
| translate}}</p>
</a>
<a class="list-group-item" href="#/holidays" has-permission='READ_HOLIDAY'>
<h5 class="list-group-item-heading"><i class="fa fa-calendar fa fa-large"></i>&nbsp;&nbsp;{{'label.anchor.manageholidays'
| translate}}</h5>
Expand Down
2 changes: 2 additions & 0 deletions app/views/organization/agencies.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
<tr class="graybg">
<th>{{'label.heading.officeName' | translate}}</th>
<th>{{'label.heading.parentoffice' | translate}}</th>
<th>{{'label.heading.transferAgency' | translate}}</th>
</tr>
</thead>
<tbody>
<tr class="pointer-main" dir-paginate="agency in agencies | orderBy:'name':reverse | filter:filterText | itemsPerPage: AgenciesPerPage">
<td class="pointer" data-ng-click="routeTo(agency.id)">{{agency.name}}</td>
<td class="pointer" data-ng-click="routeTo(agency.id)">{{agency.parentName}}</td>
<td><button class="btn btn-default" data-ng-click="transferAgency(agency.id)"><i class="fa fa-adjust"></i></button></td>
</tr>
</tbody>
</table>
Expand Down
45 changes: 26 additions & 19 deletions app/views/organization/editportfoliocenter.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<div class="content-container">
<ul class="breadcrumb">
<li><a href="#/organization">{{'label.anchor.organization' | translate}}</a></li>
<li><a href="#/portfolios">{{'label.anchor.manageportfolioCenters' | translate}}</a></li>
<li class="active">{{'label.anchor.editportfoliocenter' | translate}}</li>
</ul>
<div class="card">
<div class="content">
<form name="editportfoliocenterform" novalidate="" class="form-horizontal"
ng-controller="EditPortfolioCenterController"
rc-submit="submit()">
<api-validate></api-validate>
<fieldset>
<legend>{{'label.heading.editportfoliocenter' | translate}}</legend>
<ul class="breadcrumb">
<li><a href="#/organization">{{'label.anchor.organization' | translate}}</a></li>
<li><a href="#/portfolios">{{'label.anchor.manageportfolioCenters' | translate}}</a></li>
<li class="active">{{'label.anchor.editportfoliocenter' | translate}}</li>
</ul>
<div class="card">
<div class="content">
<form name="editportfoliocenterform" novalidate="" class="form-horizontal"
ng-controller="EditPortfolioCenterController"
rc-submit="submit()">
<api-validate></api-validate>
<fieldset>
<legend>{{'label.heading.editportfoliocenter' | translate}}</legend>
<!--portfolio name-->
<div class="form-group">
<label class="control-label col-sm-2">{{ 'label.input.portfolio' | translate }}<span class="required">*</span></label>
Expand All @@ -28,7 +28,7 @@
<label class="control-label col-sm-2">{{ 'label.input.centerName' | translate }}<span
class="required">*</span></label>
<div class="col-sm-3">
<input id="name" ng-autofocus="true" type="text" name="name" ng-model="formData.name" class="form-control"
<input id="name" ng-autofocus="true" type="text" name="name" ng-model="formData.name" class="form-control" readonly
required late-Validate/>
</div>
<div class="col-sm-3">
Expand Down Expand Up @@ -60,13 +60,20 @@
value="{{state.id}}"></select>
</div>
</div>
<!--reference point-->
<div class="form-group">
<label class="control-label col-sm-2">{{ 'label.input.centerReferencePoint' | translate }}</label>
<div class="col-sm-3">
<input id="centerReferencePoint" type="text" name="centerReferencePoint" ng-model="formData.referencePoint" class="form-control"/>
</div>
</div>
<!--center type-->
<div class="form-group">
<label class="control-label col-sm-2">{{ 'label.input.centerType' | translate }}</label>
<div class="col-sm-3">
<select id="centerType" ng-model="formData.centerTypeId" class="form-control" name="centerTypeId"
ng-options="type.id as type.name for type in typeOptions">
value="{{type.id}}"></select>
value="{{type.id}}"></select>
<!-- <option value="">{{'label.selectcentertype' | translate}}</option> -->
</div>
</div>
Expand Down Expand Up @@ -127,8 +134,8 @@
</a>
<button id="save" type="submit" class="btn btn-primary" has-permission='UPDATE_PORTFOLIO_CENTER'>{{'label.button.save' | translate}}</button>
</div>
</fieldset>
</form>
</div>
</div>
</fieldset>
</form>
</div>
</div>
</div>
Loading

0 comments on commit c00fcbf

Please sign in to comment.