Skip to content

Commit

Permalink
Merge pull request #53 from EyeSeeTea/hotbugfixing
Browse files Browse the repository at this point in the history
Hotbugfixing
  • Loading branch information
josemp10 authored Jul 11, 2016
2 parents 44dc248 + 73a79bb commit dfb17b5
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 39 deletions.
4 changes: 4 additions & 0 deletions core/dhis2Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ var ougroupsetId = { ProjectType: "rQjuGZcxNxE"
,HealthServiceType: "akYeq1mMz2N"
,SiteType: "ZxNjaKVXY1D"};

var codeDataSets = {codeDataSetProject:"DS_VST_3"
,codeDataSetSite:"DS_DEM"};

var levelMSF = {OperationalCenter: "2"
,Mission: "3"
,Project: "4"
Expand All @@ -72,6 +75,7 @@ Dhis2Api.factory("commonvariable", function () {
var Vari={
url: urlApi,
urlbase: urlBase,
codedatasets: codeDataSets,
OrganisationUnitList:[],
OrganisationUnit:"",
RefreshTreeOU:false,
Expand Down
23 changes: 11 additions & 12 deletions directives/periodtype/periodTypeView.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
along with Project Configuration. If not, see <http://www.gnu.org/licenses/>. -->


<div ng-controller="d2periodtypeController">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
{{PeriodSelected?PeriodSelected:'PERIOD_LIST' | translate}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownCountry">
<li ng-repeat="period in Listperiod">
<a ng-click='selectperiod(period)'>{{period.name}}</a>
</li>
</ul>
</div>
</div>
<div ng-controller="d2periodtypeController">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
{{PeriodSelected?PeriodSelected:'PERIOD_LIST' | translate}}
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownCountry">
<li ng-repeat="period in Listperiod">
<a ng-click='selectperiod(period)'>{{period.name | translate}}</a>
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Dhis2Api.directive('d2Resourcejsondataset', function(){
}
}
});
Dhis2Api.controller("d2ResourcejsondatasetController", ['$scope', '$filter', '$interval', "commonvariable", "loadjsonresource", "OrgUnit", "DataSets", function ($scope,$filter, $interval, commonvariable, loadjsonresource, OrgUnit, DataSets) {
Dhis2Api.controller("d2ResourcejsondatasetController", ['$scope', '$filter', '$interval', "commonvariable", "loadjsonresource", "OrgUnit", "DataSets", "commonService",
function ($scope,$filter, $interval, commonvariable, loadjsonresource, OrgUnit, DataSets, commonService) {


var stop;
Expand Down Expand Up @@ -108,7 +109,11 @@ Dhis2Api.controller("d2ResourcejsondatasetController", ['$scope', '$filter', '$i
if ($scope.services.length == skey + 1 && $scope.levels.length == 0){
$scope.messages.push({ type: "danger", text: "code " + commonvariable.healhservicesCodeOUG + " not found in file" });
}

});

$scope.levels = commonService.sortByKey($scope.levels, 'name');

});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Dhis2Api.directive('d2Resourcejsonvaccination', function(){
}
}
});
Dhis2Api.controller("d2ResourcejsonvaccinationController", ['$scope', '$filter', '$interval', "commonvariable", "loadjsonresource", "DataElements", "DataSets", "OrgUnit", function ($scope, $filter, $interval, commonvariable, loadjsonresource, DataElements, DataSets, OrgUnit) {
Dhis2Api.controller("d2ResourcejsonvaccinationController", ['$scope', '$filter', '$interval', "commonvariable", "loadjsonresource", "DataElements", "DataSets", "OrgUnit", "validatorService",
function ($scope, $filter, $interval, commonvariable, loadjsonresource, DataElements, DataSets, OrgUnit, validatorService) {
$scope.style=[];
var $translate = $filter('translate');

Expand Down Expand Up @@ -149,16 +150,25 @@ Dhis2Api.controller("d2ResourcejsonvaccinationController", ['$scope', '$filter',
dataElements: $scope.DataElementSelectedforPUT,
organisationUnits: $scope.childOU
};
DataSets.Post({}, newDataSet)
.$promise.then(function (data) {
if (data.response.status == "SUCCESS") {
$scope.messages.push({ type: "success", text: $translate('VACCINATION_DATASET_SAVED') });
$scope.hideFormvaccination();
}
else {
$scope.messages.push({ type: "danger", text: $translate('VACCINATION_DATASET_NOSAVED') });
}
});

validatorService.emptyValue(newDataSet).then(function (result) {

if (result == false){
DataSets.Post({}, newDataSet)
.$promise.then(function (data) {
if (data.response.status == "SUCCESS") {
$scope.messages.push({ type: "success", text: $translate('VACCINATION_DATASET_SAVED') });
$scope.hideFormvaccination();
}
else {
$scope.messages.push({ type: "danger", text: $translate('VACCINATION_DATASET_NOSAVED') });
}
});
}
else
$scope.messages.push({type: "warning", text: $translate("FORM_MSG_EMPTYFIELD")});
});

};

$scope.updateDatasetVaccination = function () {
Expand Down
5 changes: 5 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"DISABLED_TITLE": "The Organsation Unit Selected is disabled",
"CANCEL": "Clear Form",
"FORM_MSG_EMPTYFIELD": "verify that the form does not have empty fields",
"PERIOD_LIST": "Select period",
"PERIODTYPE_DAILY":"Daily",
"PERIODTYPE_WEEKLY":"Weekly",
"PERIODTYPE_MONTHLY":"Monthly",
"PERIODTYPE_YEARLY": "Yearly",

"_____________MODAL": "modal for delete _____",
"CLOSE_DATE": "Close Date",
Expand Down
7 changes: 6 additions & 1 deletion languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
"DISABLED_TITLE": "La Unidad Organizativa seleccionada se encuentra desabilitada",
"CANCEL": "Cancelar",
"FORM_MSG_EMPTYFIELD": "Verifique que el formulario no contenga campos vacios",

"PERIOD_LIST": "Seleccione un periodo",
"PERIODTYPE_DAILY":"Diariamente",
"PERIODTYPE_WEEKLY":"Semanalmente",
"PERIODTYPE_MONTHLY":"Mensualmente",
"PERIODTYPE_YEARLY": "Anualmente",

"_____________MODAL": "modal for delete _____",
"CLOSE_DATE": "Close Date",
"MISSION_DELETE_TITTLE": " Delete mission",
Expand Down
1 change: 0 additions & 1 deletion modules/Mission/missionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ appConfigProjectMSF.controller('missionController', ["$scope", '$filter', "commo
try {

$scope.missionname = commonvariable.OrganisationUnit.name;
$scope.missioncreated = commonvariable.OrganisationUnit.openingDate;
$scope.prevOu = commonvariable.OrganisationUnit.id;

$scope.hideForm();
Expand Down
7 changes: 1 addition & 6 deletions modules/Mission/missionView.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,11 @@
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-6">
<div class="col-md-12">
<label for="InputName2">{{'MISSION_NAME' | translate}}</label>
<d2-findorganisationunit field="name" value="{{missionname}}" operation="{{operation}}" placeholder="{{'MISSION_NAME' | translate}}"></d2-findorganisationunit>

</div>

<div class="col-md-6">
<label for="InputName3">{{'CREATION_DATE' | translate}}</label>
<input datepicker-popup="yyyy-MM-dd" ng-model="missioncreated" type="text" class="form-control" id="MissionName" ng-disabled="operation=='show'">
</div>
</div>

<br/>
Expand Down
7 changes: 4 additions & 3 deletions modules/Project/projectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ appConfigProjectMSF.controller('projectController', ["$scope", '$filter', "commo
code: codeOrgUnit,
openingDate: $filter('date')($scope.siteDate, 'yyyy-MM-dd'),
parent: commonvariable.OrganisationUnitParentConf,
healthsitetype: commonvariable.orgUnitGroupSet[commonvariable.ouGroupsetId.SiteType],
userforValidate: commonvariable.userDirective
healthsitetype: commonvariable.orgUnitGroupSet[commonvariable.ouGroupsetId.SiteType]
};
///validate if object is ok.
validatorService.emptyValue(newOu).then(function (result) {
Expand All @@ -62,7 +61,9 @@ appConfigProjectMSF.controller('projectController', ["$scope", '$filter', "commo
if (result == true) {

commonvariable.RefreshTreeOU = true;
projectService.saveSiteUser();

if (commonvariable.userDirective.trim() != "")
projectService.saveSiteUser();

//set message variable
$scope.messages.push({
Expand Down
8 changes: 8 additions & 0 deletions services/commonservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ Dhis2Api.service('commonService', ['$q', 'commonvariable', 'OrgUnitGroupByOrgUni


}

this.sortByKey = function (array, key) {
return array.sort(function(a, b) {
var x = a[key]; var y = b[key];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
});
}



}]);
2 changes: 1 addition & 1 deletion services/missionservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Dhis2Api.service('missionService', ['$q', 'commonvariable', 'User', 'OrgUnitGrou
OrgUnitGroupsOrgUnit.POST({ uidgroup: commonvariable.orgUnitGroupSet[commonvariable.ouGroupsetId.Context].id, uidorgunit: newOu.id });


FilterResource.GET({resource:'dataSets', filter:'code:eq:'+"DS_VST_3"}).$promise
FilterResource.GET({resource:'dataSets', filter:'code:eq:'+commonvariable.codedatasets.codeDataSetProject}).$promise
.then(function(response){
if (response.dataSets.length>0) {
var dataSet = response.dataSets[0];
Expand Down
6 changes: 3 additions & 3 deletions services/projectservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
You should have received a copy of the GNU General Public License
along with Project Configuration. If not, see <http://www.gnu.org/licenses/>. */

Dhis2Api.service('projectService', ['$q', 'commonvariable', 'User', 'OrgUnitOrgUnitGroups', 'OrgUnit', 'OrgUnitGroupsOrgUnit', 'FilterResource', 'OrgUnitGroupByOrgUnit', 'OrganisationUnitChildren',
function ($q, commonvariable, User, OrgUnitOrgUnitGroups, OrgUnit, OrgUnitGroupsOrgUnit, FilterResource, OrgUnitGroupByOrgUnit, OrganisationUnitChildren) {
Dhis2Api.service('projectService', ['$q', 'commonvariable', 'User', 'OrgUnitOrgUnitGroups', 'OrgUnit', 'OrgUnitGroupsOrgUnit', 'FilterResource', 'OrgUnitGroupByOrgUnit', 'OrganisationUnitChildren', 'DataSetsOrgUnit',
function ($q, commonvariable, User, OrgUnitOrgUnitGroups, OrgUnit, OrgUnitGroupsOrgUnit, FilterResource, OrgUnitGroupByOrgUnit, OrganisationUnitChildren, DataSetsOrgUnit) {


this.initValue=function($scope) {
Expand Down Expand Up @@ -211,7 +211,7 @@ Dhis2Api.service('projectService', ['$q', 'commonvariable', 'User', 'OrgUnitOrgU

});

FilterResource.GET({ resource: 'dataSets', filter: 'code:eq:' + "DS_INFR_3" }).$promise
FilterResource.GET({ resource: 'dataSets', filter: 'code:eq:' + commonvariable.codedatasets.codeDataSetSite }).$promise
.then(function (response) {

if (response.dataSets.length > 0) {
Expand Down

0 comments on commit dfb17b5

Please sign in to comment.