-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from villagereach/SELV3-775
SELV3-775: Added translations to home page alerts
- Loading branch information
Showing
3 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"alerts.panel.title": "My Facility data", | ||
"label.requisitionsToBeCreated": "Number of Requisitions to be created this month", | ||
"label.messagesIssuedBySystem": "Number of Messages or issued by by the system", | ||
"label.lateCreationOfInventories": "Late creation of inventories", | ||
"label.updatesOfRequisitions": "Updates on requisitions", | ||
"label.updatesOfOrdersAndPod": "Updates on orders and POD", | ||
"requisition.status.APPROVED": "Approved", | ||
"requisition.status.AUTHORIZED": "Authorized", | ||
"requisition.status.INITIATED": "Initiated", | ||
"requisition.status.IN_APPROVAL": "In Approval", | ||
"requisition.status.REJECTED": "Rejected", | ||
"requisition.status.RELEASED": "Released", | ||
"requisition.status.RELEASED_WITHOUT_ORDER": "Released Without Order", | ||
"requisition.status.SKIPPED": "Skipped", | ||
"requisition.status.SUBMITTED": "Submitted", | ||
"orders.status.CREATING": "Creating", | ||
"orders.status.FULFILLING": "Fulfilling", | ||
"orders.status.IN_ROUTE": "In Route", | ||
"orders.status.ORDERED": "Ordered", | ||
"orders.status.READY_TO_PACK": "Ready To Pack", | ||
"orders.status.RECEIVED": "Received", | ||
"orders.status.SHIPPED": "Shipped", | ||
"orders.status.TRANSFER_FAILED": "Transfer Failed" | ||
} |
59 changes: 59 additions & 0 deletions
59
src/openlmis-home-alerts-panel/openlmis-home-alerts-panel.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact [email protected]. | ||
*/ | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('openlmis-home-alerts-panel') | ||
.controller('openlmisHomeAlertsPanelController', controller); | ||
|
||
controller.$inject = ['openlmisHomeAlertsPanelService']; | ||
|
||
function controller(openlmisHomeAlertsPanelService) { | ||
var $ctrl = this; | ||
$ctrl.requisitionsStatusesStats = undefined; | ||
$ctrl.ordersStatusesStats = undefined; | ||
$ctrl.requisitionsToBeCreated = undefined; | ||
var requisitionsImportantData = ['SUBMITTED', 'AUTHORIZED', 'IN_APPROVAL']; | ||
var ordersImportantData = ['ORDERED', 'FULFILLING', 'SHIPPED', 'IN_ROUTE']; | ||
var REQUISITION_PREFIX = 'requisition'; | ||
var ORDERS_PREFIX = 'orders'; | ||
|
||
$ctrl.$onInit = onInit; | ||
|
||
function onInit() { | ||
openlmisHomeAlertsPanelService.getRequisitionsStatusesData() | ||
.then(function(requisitionsData) { | ||
$ctrl.requisitionsStatusesStats = | ||
openlmisHomeAlertsPanelService. | ||
getMappedStatussesStats( | ||
REQUISITION_PREFIX, | ||
requisitionsData.statusesStats, | ||
requisitionsImportantData | ||
); | ||
|
||
$ctrl.requisitionsToBeCreated = requisitionsData.requisitionsToBeCreated; | ||
}); | ||
|
||
openlmisHomeAlertsPanelService.getOrdersStatusesData() | ||
.then(function(ordersData) { | ||
$ctrl.ordersStatusesStats = | ||
openlmisHomeAlertsPanelService. | ||
getMappedStatussesStats(ORDERS_PREFIX, ordersData.statusesStats, ordersImportantData); | ||
}); | ||
} | ||
} | ||
})(); |
78 changes: 78 additions & 0 deletions
78
src/openlmis-home-alerts-panel/openlmis-home-alerts-panel.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* This program is part of the OpenLMIS logistics management information system platform software. | ||
* Copyright © 2017 VillageReach | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under the terms | ||
* of the GNU Affero General Public License as published by the Free Software Foundation, either | ||
* version 3 of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
* See the GNU Affero General Public License for more details. You should have received a copy of | ||
* the GNU Affero General Public License along with this program. If not, see | ||
* http://www.gnu.org/licenses. For additional information contact [email protected]. | ||
*/ | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('openlmis-home-alerts-panel') | ||
.service('openlmisHomeAlertsPanelService', openlmisHomeAlertsPanelService); | ||
|
||
openlmisHomeAlertsPanelService.$inject = ['$resource', 'openlmisUrlFactory', 'messageService']; | ||
|
||
function openlmisHomeAlertsPanelService($resource, openlmisUrlFactory, messageService) { | ||
var STATUS_PREFIX = 'status'; | ||
var requisitionStatusesResource = $resource( | ||
openlmisUrlFactory('/api'), {}, { | ||
get: { | ||
method: 'GET', | ||
url: openlmisUrlFactory('/api/requisitions/statusesStatsData') | ||
} | ||
} | ||
); | ||
|
||
var orderStatusesResource = $resource( | ||
openlmisUrlFactory('/api/orders/statusesStatsData'), {}, { | ||
get: { | ||
method: 'GET', | ||
url: openlmisUrlFactory('/api/orders/statusesStatsData') | ||
} | ||
} | ||
); | ||
|
||
return { | ||
getRequisitionsStatusesData: getRequisitionsStatusesData, | ||
getOrdersStatusesData: getOrdersStatusesData, | ||
getMappedStatussesStats: getMappedStatussesStats | ||
}; | ||
|
||
function getRequisitionsStatusesData() { | ||
return requisitionStatusesResource.get().$promise; | ||
} | ||
|
||
function getOrdersStatusesData() { | ||
return orderStatusesResource.get().$promise; | ||
} | ||
|
||
function getMappedStatussesStats(tableName, statusesStats, importantData) { | ||
var mappedStatussesStats = []; | ||
|
||
for (var statName in statusesStats) { | ||
mappedStatussesStats.push({ | ||
key: getTranslatedKey(tableName, statName), | ||
value: statusesStats[statName], | ||
isImportant: importantData.indexOf(statName) !== -1 | ||
}); | ||
} | ||
|
||
return mappedStatussesStats; | ||
} | ||
|
||
function getTranslatedKey(tableName, statName) { | ||
var key = tableName + '.' + STATUS_PREFIX + '.' + statName; | ||
return messageService.get(key); | ||
} | ||
} | ||
})(); |