Skip to content

Commit

Permalink
FB - Release/1.0.0 prepare (#14)
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]>

---------

Co-authored-by: Leonardo Hildt <[email protected]>
  • Loading branch information
fiterlatam and leonardohildt authored May 19, 2023
1 parent abbdf0c commit e929e39
Show file tree
Hide file tree
Showing 18 changed files with 892 additions and 57 deletions.
44 changes: 44 additions & 0 deletions app/global-translations/locale-es.json
Original file line number Diff line number Diff line change
Expand Up @@ -4148,9 +4148,53 @@
"label.input.portfolioResponsibleUser": "Responsable",
"label.heading.centers": "Lista de Centros vinculados",
"label.heading.centerName": "Centro",
"label.anchor.manageportfolioCenters": "Gestionar centros de la cartera",
"label.heading.nextMeetingDate": "Fecha próxima reunión",
"label.input.centerName": "Nombre Centro",
"label.input.nextMeetingDate": "Fecha próxima reunión",
"label.anchor.editportfoliocenter": "Gestionar centro",
"label.input.centerLegacyNumber": "Antiguo Nro. Centro",
"label.input.centerCity": "Ciudad",
"label.input.centerDepartment": "Departamento",
"label.input.centerDistance": "Distancia desde Agencia",
"label.input.centerType": "Tipo de Centro",
"label.input.centerStatus": "Estado de Centro",
"label.input.centercreateddate": "Fecha de creación",
"label.heading.editportfoliocenter": "Editar Centro",
"label.selectcentertype": "Seleccione tipo de centro",
"portfolioCenterStatus.active": "Activo",
"portfolioCenterStatus.inactive": "Inactivo",
"label.heading.centereditegroups": "Editar grupos",
"label.heading.center.groups": "Lista de Grupos vinculados",
"label.anchor.managecentergroups": "Gestionar grupos del centro",
"label.input.groupname": "Nombre del Grupo",
"label.heading.centertype": "Tipo de centro",
"label.heading.centermeetingday": "Día y horarios de reunión",
"label.input.centerMeetingDay": "Día de reunión",
"label.input.meetingStartTime": "Reunión hora inicio",
"label.input.meetingEndTime": "Reunión hora fin",
"label.button.createcentergroup": "Crear grupo",
"label.anchor.createCenterGroup": "Crear grupo",
"label.input.centerGroupName": "Nombre del grupo",
"label.input.legacyGroupNumber": "Antiguo No. Grupo",
"label.input.groupformationdate": "Fecha de formación",
"label.input.groupSize": "Tamaño del grupo",
"label.heading.createcentergroup": "Crear grupo",
"label.input.portfolioCenter": "Centro",
"label.input.groupLatitude": "Latitud",
"label.input.groupLongitude": "Longitud",
"label.input.groupResponsibleUser": "Grupo Formado Por",
"label.input.centerGroupStatus": "Estado Grupo",
"centerGroupStatus.active": "Activo",
"centerGroupStatus.inactive": "Inactivo",
"label.anchor.editcentergroup": "Editar grupo",
"label.heading.editcentergroup": "Editar grupo",
"validation.msg.center_group.size.cannot.be.blank": "Tamaño del grupo es requerido y debe ser igual o mayor a cero",
"validation.msg.center_group.legacyGroupNumber.not.greater.than.zero": "Antiguo No. Grupo debe ser mayor a cero ",
"label.input.transfergroup": "Transferir a otro centro",
"label.anchor.transfercentergroup": "Transferir grupo",
"label.heading.availability.centers": "Centros y horarios disponibles",
"label.heading.transfergroup": "Transferir grupo",
"label.heading.centermeetingtimes": "Horarios de reunión",
"----End---": "---Fin del archivo---"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
(function (module) {
mifosX.controllers = _.extend(module, {
CreateCenterGroupController: function (scope, routeParams, resourceFactory, location, dateFilter) {
scope.formData = {};
scope.parentOfficesOptions = [];
scope.responsibleUserOptions = [];
scope.statusOptions = [];
scope.portfolioCenterOptions = [];
scope.tf = "HH:mm";
let portfolioId = routeParams.portfolioId
let portfolioCenterId = routeParams.portfolioCenterId;

resourceFactory.portfolioCenterByCurrentUserResource.get({portfolioId:portfolioId},function(data)
{
scope.portfolioCenterOptions = data;
});

resourceFactory.centerGroupTemplateResource.get({portfolioCenterId:portfolioCenterId}, function (data) {
scope.parentOfficesOptions = data.parentOfficesOptions;
scope.responsibleUserOptions = data.responsibleUserOptions;
scope.statusOptions = data.statusOptions;
scope.formData = {
portfolioCenterId: parseInt(portfolioCenterId),
portfolioId: parseInt(portfolioId)
}
});

scope.submit = function () {
// remove extra fields from form data
delete this.formData.parentName;
delete this.formData.status;
delete this.formData.responsibleUserName;
delete this.formData.portfolioId;

this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;

this.formData.formationDate = dateFilter(scope.formData.formationDate, scope.df);

if (scope.formData.meetingStartTime) {
this.formData.meetingStartTime = dateFilter(scope.formData.meetingStartTime, scope.tf);
}
if (scope.formData.meetingEndTime) {
this.formData.meetingEndTime = dateFilter(scope.formData.meetingEndTime, scope.tf);
}

resourceFactory.centerGroupResource.save({'portfolioId': portfolioId, 'portfolioCenterId': portfolioCenterId}, this.formData, function (data) {
location.path('/viewcentergroups/' + portfolioId + "/" + portfolioCenterId);
});
};
}
});
mifosX.ng.application.controller('CreateCenterGroupController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateCenterGroupController]).run(function ($log) {
$log.info("CreateCenterGroupController initialized");
});
}(mifosX.controllers || {}));
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
var date = new Date();
scope.formData.openHourAfternoon = new Date(date.getFullYear(), date.getMonth(), date.getDay(), data.openHourAfternoon[0], data.openHourAfternoon[1], 0);
}

});

scope.submit = function () {
Expand Down
73 changes: 73 additions & 0 deletions app/scripts/controllers/organization/EditCenterGroupController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
(function (module) {
mifosX.controllers = _.extend(module, {
EditCenterGroupController: function (scope, routeParams, resourceFactory, location, dateFilter) {
scope.formData = {};
scope.parentOfficesOptions = [];
scope.responsibleUserOptions = [];
scope.statusOptions = [];
scope.portfolioCenterOptions = [];
scope.tf = "HH:mm";
let portfolioId = routeParams.portfolioId
let portfolioCenterId = routeParams.portfolioCenterId;
let centerGroupId = routeParams.centerGroupId;

resourceFactory.centerGroupTemplateResource.get({portfolioCenterId:portfolioCenterId}, function (data) {
scope.parentOfficesOptions = data.parentOfficesOptions;
scope.responsibleUserOptions = data.responsibleUserOptions;
scope.statusOptions = data.statusOptions;
});

resourceFactory.portfolioCenterByCurrentUserResource.get({portfolioId:portfolioId}, function (data) {
scope.portfolioCenterOptions = data;
});

resourceFactory.centerGroupResource.get({portfolioCenterId: portfolioCenterId, centerGroupId:centerGroupId}, function (data) {
scope.formData = data;
scope.formData.statusId = data.status.id;
scope.formData.portfolioId = parseInt(portfolioId);

if (data.formationDate) {
let formationDate = dateFilter(data.formationDate, scope.df);
scope.formData.formationDate = new Date(formationDate);
}

var date = new Date();
if (data.meetingStartTime) {
scope.formData.meetingStartTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), data.meetingStartTime[0], data.meetingStartTime[1], 0);
}

if (data.meetingEndTime) {
scope.formData.meetingEndTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), data.meetingEndTime[0], data.meetingEndTime[1], 0);
}
});

scope.submit = function () {
// remove extra fields from form data
delete this.formData.parentName;
delete this.formData.status;
delete this.formData.portfolioCenterName;
delete this.formData.responsibleUserName;
delete this.formData.portfolioId;

this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;

this.formData.formationDate = dateFilter(scope.formData.formationDate, scope.df);

if (scope.formData.meetingStartTime) {
this.formData.meetingStartTime = dateFilter(scope.formData.meetingStartTime, scope.tf);
}
if (scope.formData.meetingEndTime) {
this.formData.meetingEndTime = dateFilter(scope.formData.meetingEndTime, scope.tf);
}

resourceFactory.centerGroupResource.update({'portfolioCenterId':portfolioCenterId, 'centerGroupId': centerGroupId}, this.formData, function (data) {
location.path('/viewcentergroups/' + portfolioId + "/" + portfolioCenterId);
});
};
}
});
mifosX.ng.application.controller('EditCenterGroupController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditCenterGroupController]).run(function ($log) {
$log.info("EditCenterGroupController initialized");
});
}(mifosX.controllers || {}));
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,73 @@
scope.formData = {};
scope.cityOptions = [];
scope.stateOptions = [];
scope.countryOptions = [];
scope.parentOfficesOptions = [];
scope.responsibleUserOptions = [];
scope.typeOptions = [];
scope.statusOptions = [];
scope.meetingDayOptions = [];
scope.tf = "HH:mm";
scope.portfolioId = routeParams.portfolioId;

portfolioId = routeParams.portfolioId;
portfolioCenterId = routeParams.portfolioCenterId;
let portfolioId = routeParams.portfolioId;
let portfolioCenterId = routeParams.portfolioCenterId;

let requestParams = {orderBy: 'description', sortOrder: 'ASC'};
resourceFactory.portfolioCenterTemplateResource.get({portfolioId:portfolioId}, function (data) {
scope.cityOptions = data.cityOptions;
scope.stateOptions = data.stateOptions;
scope.countryOptions = data.countryOptions;
scope.parentOfficesOptions = data.parentOfficesOptions;
scope.responsibleUserOptions = data.responsibleUserOptions;
scope.cityOptions = data.cityOptions;
scope.stateOptions = data.stateOptions;
scope.typeOptions = data.typeOptions;
scope.statusOptions = data.statusOptions;
scope.meetingDayOptions = data.meetingDayOptions;
});

resourceFactory.portfolioCenterResource.get({portfolioId:portfolioId, portfolioCenterId: portfolioCenterId}, function (data) {
scope.formData = data;
scope.formData.cityId = data.city.id;
scope.formData.stateId = data.state.id;
scope.formData.countryId = data.country.id;
scope.formData.centerTypeId = data.type.id;
scope.formData.statusId = data.status.id;

if (data.createdDate) {
let editDate = dateFilter(data.createdDate, scope.df);
scope.formData.createdDate = new Date(editDate);
}

if (data.meetingStartTime) {
var date = new Date();
var meetingStartSplitted = data.meetingStartTime.split(":", 2);
scope.formData.meetingStartTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), meetingStartSplitted[0], meetingStartSplitted[1], 0);
}

if (data.meetingEndTime) {
var date = new Date();
var meetingEndSplitted = data.meetingEndTime.split(":", 2);
scope.formData.meetingEndTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), meetingEndSplitted[0], meetingEndSplitted[1], 0);
}
});

scope.submit = function () {
// remove extra fields from form data
delete this.formData.parentName;
delete this.formData.city;
delete this.formData.state;
delete this.formData.country;
delete this.formData.status;
delete this.formData.type;
delete this.formData.responsibleUserName;
delete this.formData.meetingDayName;
delete this.formData.groups;

this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;

resourceFactory.portfolioCenterResource.update({'portfolioCenterId': portfolioCenterId}, this.formData, function (data) {
if (scope.formData.meetingStartTime) {
this.formData.meetingStartTime = dateFilter(scope.formData.meetingStartTime, scope.tf);
}
if (scope.formData.meetingEndTime) {
this.formData.meetingEndTime = dateFilter(scope.formData.meetingEndTime, scope.tf);
}

resourceFactory.portfolioCenterResource.update({'portfolioId':portfolioId, 'portfolioCenterId': portfolioCenterId}, this.formData, function (data) {
location.path('/viewportfolio/' + portfolioId);
});
};
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.centers;

this.formData.locale = scope.optlang.code;
this.formData.dateFormat = scope.df;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
(function (module) {
mifosX.controllers = _.extend(module, {
TransferCenterGroupController: function (scope, resourceFactory, route, location, routeParams, $uibModal, dateFilter) {
scope.centersAvailability = [];
scope.tf = "HH:mm";
let portfolioId = routeParams.portfolioId
let portfolioCenterId = routeParams.portfolioCenterId;
let centerGroupId = routeParams.centerGroupId;
scope.centerData = {};

resourceFactory.centerGroupResource.get({portfolioCenterId: portfolioCenterId, centerGroupId:centerGroupId}, function (data) {
scope.centerGroup = data;

var date = new Date();
if (data.meetingStartTime) {
scope.centerGroup.meetingStartTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), data.meetingStartTime[0], data.meetingStartTime[1], 0);
}

if (data.meetingEndTime) {
scope.centerGroup.meetingEndTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), data.meetingEndTime[0], data.meetingEndTime[1], 0);
}
});

resourceFactory.portfolioAllCentersAvailabilityResource.get({portfolioId: portfolioId}, function (data) {
let date = new Date();
for (var i = 0; i < data.length; i++) {
let centerId = data[i].portfolioCenterId;
let centerName = data[i].portfolioCenterName;
let centerTimes = data[i].availableMeetingTimes;

if (portfolioCenterId != centerId) {
// iterate over available meetings times
for (var j = 0; j < centerTimes.length; j++) {
let meetingTimes = centerTimes[j];
let availableMeetingStartTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), meetingTimes.meetingStartTime[0], meetingTimes.meetingStartTime[1], 0);
let availableMeetingEndTime = new Date(date.getFullYear(), date.getMonth(), date.getDay(), meetingTimes.meetingEndTime[0], meetingTimes.meetingEndTime[1], 0);
scope.centersAvailability.push({portfolioCenterId: centerId, portfolioCenterName: centerName, meetingStartTime: availableMeetingStartTime, meetingEndTime: availableMeetingEndTime})
}
}
}
});

scope.transferGroup = function (portfolioCenterId, meetingStartTime, meetingEndTime) {
scope.centerData.newPortfolioCenterId = portfolioCenterId;
scope.centerData.meetingStartTime = meetingStartTime;
scope.centerData.meetingEndTime = meetingEndTime;

$uibModal.open({
templateUrl: 'transferGroupToCenter.html',
controller: TransferGroupCtrl
});
}

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

if (scope.centerData.meetingStartTime) {
scope.centerData.meetingStartTime = dateFilter(scope.centerData.meetingStartTime, scope.tf);
}
if (scope.centerData.meetingEndTime) {
scope.centerData.meetingEndTime = dateFilter(scope.centerData.meetingEndTime, scope.tf);
}

resourceFactory.transferCenterGroupResource.transfer({'portfolioCenterId':portfolioCenterId, 'centerGroupId': centerGroupId}, scope.centerData, function (data) {
$uibModalInstance.close('transfer');
location.path('/viewcentergroups/' + portfolioId + "/" + portfolioCenterId);
});
};
$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('TransferCenterGroupController', ['$scope', 'ResourceFactory', '$route', '$location', '$routeParams', '$uibModal', 'dateFilter', mifosX.controllers.TransferCenterGroupController]).run(function ($log) {
$log.info("TransferCenterGroupController initialized");
});
}(mifosX.controllers || {}));
Loading

0 comments on commit e929e39

Please sign in to comment.