Index: src/stock-adjustment-creation/adjustment-creation.controller.js =================================================================== diff -u -N -r9b0a924db32ec9c83f4a094ef60311ff17a09b2c -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.controller.js (.../adjustment-creation.controller.js) (revision 9b0a924db32ec9c83f4a094ef60311ff17a09b2c) +++ src/stock-adjustment-creation/adjustment-creation.controller.js (.../adjustment-creation.controller.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -28,18 +28,30 @@ .module('stock-adjustment-creation') .controller('StockAdjustmentCreationController', controller); - controller.$inject = - ['$scope', '$state', '$stateParams', '$filter', 'confirmDiscardService', 'program', 'facility', + controller.$inject = [ + '$scope', '$state', '$stateParams', '$filter', 'confirmDiscardService', 'program', 'facility', 'stockCardSummaries', 'reasons', 'confirmService', 'messageService', 'user', 'adjustmentType', 'srcDstAssignments', 'stockAdjustmentCreationService', 'notificationService', - 'orderableLotUtilService', 'MAX_INTEGER_VALUE']; + 'orderableLotUtilService', 'MAX_INTEGER_VALUE', 'VVM_STATUS' + ]; function controller($scope, $state, $stateParams, $filter, confirmDiscardService, program, facility, stockCardSummaries, reasons, confirmService, messageService, user, adjustmentType, srcDstAssignments, stockAdjustmentCreationService, notificationService, - orderableLotUtilService, MAX_INTEGER_VALUE) { + orderableLotUtilService, MAX_INTEGER_VALUE, VVM_STATUS) { var vm = this; + /** + * @ngdoc property + * @propertyOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name vvmStatuses + * @type {Object} + * + * @description + * Holds list of VVM statuses. + */ + vm.vvmStatuses = VVM_STATUS; + vm.key = function (secondaryKey) { return adjustmentType.prefix + 'Creation.' + secondaryKey; }; @@ -259,6 +271,21 @@ vm.selectedOrderableHasLots = vm.lots.length > 0; }; + /** + * @ngdoc method + * @methodOf stock-adjustment-creation.controller:StockAdjustmentCreationController + * @name getStatusDisplay + * + * @description + * Returns VVM status display. + * + * @param {String} status VVM status + * @return {String} VVM status display name + */ + vm.getStatusDisplay = function(status) { + return messageService.get(VVM_STATUS.$getDisplayName(status)); + }; + function isEmpty(value) { return _.isUndefined(value) || _.isNull(value); } Index: src/stock-adjustment-creation/adjustment-creation.controller.spec.js =================================================================== diff -u -N -r4b09678338e5dcfdfc3e5d09ccde3b191e0274e8 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.controller.spec.js (.../adjustment-creation.controller.spec.js) (revision 4b09678338e5dcfdfc3e5d09ccde3b191e0274e8) +++ src/stock-adjustment-creation/adjustment-creation.controller.spec.js (.../adjustment-creation.controller.spec.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -15,189 +15,203 @@ describe("StockAdjustmentCreationController", function () { - var vm, q, rootScope, state, stateParams, facility, program, confirmService, + var vm, q, rootScope, state, stateParams, facility, program, confirmService, VVM_STATUS, messageService, stockAdjustmentCreationService; - beforeEach(function () { + beforeEach(function () { - module('stock-adjustment-creation'); + module('stock-adjustment-creation'); - inject(function (_messageService_, _confirmDiscardService_, _confirmService_, - _$stateParams_, _stockAdjustmentCreationService_, $controller, $q, - $rootScope, _orderableLotUtilService_, _ADJUSTMENT_TYPE_) { - q = $q; - rootScope = $rootScope; - state = jasmine.createSpyObj('$state', ['go']); - state.current = {name: '/a/b'}; - state.params = {page: 0}; - stateParams = _$stateParams_; + inject(function (_messageService_, _confirmDiscardService_, _confirmService_, + _$stateParams_, _stockAdjustmentCreationService_, $controller, $q, + $rootScope, _orderableLotUtilService_, _ADJUSTMENT_TYPE_, $injector) { + q = $q; + rootScope = $rootScope; + state = jasmine.createSpyObj('$state', ['go']); + state.current = {name: '/a/b'}; + state.params = {page: 0}; + stateParams = _$stateParams_; + VVM_STATUS = $injector.get('VVM_STATUS'); + messageService = $injector.get('messageService'); - program = {name: 'HIV', id: '1'}; - facility = {id: "10134", name: "National Warehouse"}; - var stockCardSummaries = [{ - orderable: {fullProductName: "Implanon", id: "a"}, - stockOnHand: 2, - lot: null - }]; - var reasons = [{id: "r1", name: "clinic return"}]; + program = {name: 'HIV', id: '1'}; + facility = {id: "10134", name: "National Warehouse"}; + var stockCardSummaries = [{ + orderable: {fullProductName: "Implanon", id: "a"}, + stockOnHand: 2, + lot: null + }]; + var reasons = [{id: "r1", name: "clinic return"}]; - confirmService = _confirmService_; - stockAdjustmentCreationService = _stockAdjustmentCreationService_; + confirmService = _confirmService_; + stockAdjustmentCreationService = _stockAdjustmentCreationService_; - vm = $controller('StockAdjustmentCreationController', { - $scope: rootScope.$new(), - $state: state, - $stateParams: stateParams, - confirmDiscardService: _confirmDiscardService_, - program: program, - facility: facility, - adjustmentType: _ADJUSTMENT_TYPE_.ADJUSTMENT, - srcDstAssignments: undefined, - user: {}, - stockCardSummaries: stockCardSummaries, - reasons: reasons, - confirmService: confirmService, - messageService: _messageService_, - stockAdjustmentCreationService: stockAdjustmentCreationService, - orderableLotUtilService: _orderableLotUtilService_ - }); + vm = $controller('StockAdjustmentCreationController', { + $scope: rootScope.$new(), + $state: state, + $stateParams: stateParams, + confirmDiscardService: _confirmDiscardService_, + program: program, + facility: facility, + adjustmentType: _ADJUSTMENT_TYPE_.ADJUSTMENT, + srcDstAssignments: undefined, + user: {}, + stockCardSummaries: stockCardSummaries, + reasons: reasons, + confirmService: confirmService, + messageService: messageService, + stockAdjustmentCreationService: stockAdjustmentCreationService, + orderableLotUtilService: _orderableLotUtilService_ + }); + }); }); - }); - it('should init page properly', function () { - expect(stateParams.page).toEqual(0); - }); + it('should init page properly', function () { + expect(stateParams.page).toEqual(0); + }); - describe('validate', function () { + describe('validate', function () { - it('line item quantity is valid given positive integer', function () { - var lineItem = {id: "1", quantity: 1, $errors: {}}; - vm.validateQuantity(lineItem); + it('line item quantity is valid given positive integer', function () { + var lineItem = {id: "1", quantity: 1, $errors: {}}; + vm.validateQuantity(lineItem); - expect(lineItem.$errors.quantityInvalid).toBeFalsy(); - }); + expect(lineItem.$errors.quantityInvalid).toBeFalsy(); + }); - it('line item quantity is invalid given 0', function () { - var lineItem = {id: "1", quantity: 0, $errors: {}}; - vm.validateQuantity(lineItem); + it('line item quantity is invalid given 0', function () { + var lineItem = {id: "1", quantity: 0, $errors: {}}; + vm.validateQuantity(lineItem); - expect(lineItem.$errors.quantityInvalid).toEqual('stockAdjustmentCreation.positiveInteger') - }); + expect(lineItem.$errors.quantityInvalid).toEqual('stockAdjustmentCreation.positiveInteger') + }); - it('line item quantity is invalid given -1', function () { - var lineItem = {id: "1", quantity: -1, $errors: {}}; - vm.validateQuantity(lineItem); + it('line item quantity is invalid given -1', function () { + var lineItem = {id: "1", quantity: -1, $errors: {}}; + vm.validateQuantity(lineItem); - expect(lineItem.$errors.quantityInvalid).toEqual('stockAdjustmentCreation.positiveInteger') + expect(lineItem.$errors.quantityInvalid).toEqual('stockAdjustmentCreation.positiveInteger') + }); }); - }); - it('should reorder all added items when quantity validation failed', function () { - var date1 = new Date(2017, 3, 20); - var lineItem1 = { - reason: {id: "123", reasonType: "DEBIT"}, - orderable: {productCode: "C100"}, - occurredDate: date1, - $errors: {} - }; + it('should reorder all added items when quantity validation failed', function () { + var date1 = new Date(2017, 3, 20); + var lineItem1 = { + reason: {id: "123", reasonType: "DEBIT"}, + orderable: {productCode: "C100"}, + occurredDate: date1, + $errors: {} + }; - var lineItem2 = { - reason: {id: "123", reasonType: "DEBIT"}, - orderable: {productCode: "C150"}, - occurredDate: date1, - $errors: {} - }; + var lineItem2 = { + reason: {id: "123", reasonType: "DEBIT"}, + orderable: {productCode: "C150"}, + occurredDate: date1, + $errors: {} + }; - var date2 = new Date(2017, 3, 25); - var lineItem3 = { - reason: {id: "123", reasonType: "DEBIT"}, - orderable: {productCode: "C100"}, - occurredDate: date2, - $errors: {quantityInvalid: 'stockAdjustmentCreation.sohCanNotBeNegative'} - }; + var date2 = new Date(2017, 3, 25); + var lineItem3 = { + reason: {id: "123", reasonType: "DEBIT"}, + orderable: {productCode: "C100"}, + occurredDate: date2, + $errors: {quantityInvalid: 'stockAdjustmentCreation.sohCanNotBeNegative'} + }; - var lineItem4 = { - reason: {id: "123", reasonType: "DEBIT"}, - orderable: {productCode: "C120"}, - occurredDate: date2, - $errors: {quantityInvalid: 'stockAdjustmentCreation.sohCanNotBeNegative'} - }; + var lineItem4 = { + reason: {id: "123", reasonType: "DEBIT"}, + orderable: {productCode: "C120"}, + occurredDate: date2, + $errors: {quantityInvalid: 'stockAdjustmentCreation.sohCanNotBeNegative'} + }; - vm.addedLineItems = [lineItem1, lineItem2, lineItem3, lineItem4]; + vm.addedLineItems = [lineItem1, lineItem2, lineItem3, lineItem4]; - vm.submit(); + vm.submit(); - var expectItems = [lineItem3, lineItem1, lineItem4, lineItem2]; - expect(vm.displayItems).toEqual(expectItems); - }); + var expectItems = [lineItem3, lineItem1, lineItem4, lineItem2]; + expect(vm.displayItems).toEqual(expectItems); + }); - it('should remove all line items', function () { - var lineItem1 = {id: "1", quantity: 0}; - var lineItem2 = {id: "2", quantity: 1}; - vm.addedLineItems = [lineItem1, lineItem2]; - vm.displayItems = [lineItem1]; - spyOn(confirmService, 'confirmDestroy'); - var deferred = q.defer(); - deferred.resolve(); - confirmService.confirmDestroy.andReturn(deferred.promise); + it('should remove all line items', function () { + var lineItem1 = {id: "1", quantity: 0}; + var lineItem2 = {id: "2", quantity: 1}; + vm.addedLineItems = [lineItem1, lineItem2]; + vm.displayItems = [lineItem1]; + spyOn(confirmService, 'confirmDestroy'); + var deferred = q.defer(); + deferred.resolve(); + confirmService.confirmDestroy.andReturn(deferred.promise); - vm.removeDisplayItems(); - rootScope.$apply(); + vm.removeDisplayItems(); + rootScope.$apply(); - expect(confirmService.confirmDestroy).toHaveBeenCalledWith('stockAdjustmentCreation.clearAll', - 'stockAdjustmentCreation.clear'); - expect(vm.addedLineItems).toEqual([lineItem2]); - expect(vm.displayItems).toEqual([]); - }); + expect(confirmService.confirmDestroy).toHaveBeenCalledWith('stockAdjustmentCreation.clearAll', + 'stockAdjustmentCreation.clear'); + expect(vm.addedLineItems).toEqual([lineItem2]); + expect(vm.displayItems).toEqual([]); + }); - it('should remove one line item from added line items', function () { - var lineItem1 = {id: "1", quantity: 0}; - var lineItem2 = {id: "2", quantity: 1}; - vm.addedLineItems = [lineItem1, lineItem2]; + it('should remove one line item from added line items', function () { + var lineItem1 = {id: "1", quantity: 0}; + var lineItem2 = {id: "2", quantity: 1}; + vm.addedLineItems = [lineItem1, lineItem2]; - vm.remove(lineItem1); + vm.remove(lineItem1); - expect(vm.addedLineItems).toEqual([lineItem2]); - }); + expect(vm.addedLineItems).toEqual([lineItem2]); + }); - it('should add one line item to added line items', function () { - vm.selectedOrderableGroup = [{ - orderable: {fullProductName: 'Implanon', id: 'a', productCode: 'c1'}, - stockOnHand: 2 - }]; + it('should add one line item to added line items', function () { + vm.selectedOrderableGroup = [{ + orderable: {fullProductName: 'Implanon', id: 'a', productCode: 'c1'}, + stockOnHand: 2 + }]; - vm.addProduct(); + vm.addProduct(); - var addedLineItem = vm.addedLineItems[0]; - expect(addedLineItem.stockOnHand).toEqual(2); - expect(addedLineItem.orderable.fullProductName).toEqual('Implanon'); - }); + var addedLineItem = vm.addedLineItems[0]; + expect(addedLineItem.stockOnHand).toEqual(2); + expect(addedLineItem.orderable.fullProductName).toEqual('Implanon'); + }); - it('should search from added line items', function () { - var lineItem1 = {id: "1", quantity: 0}; - var lineItem2 = {id: "2", quantity: 1}; - vm.addedLineItems = [lineItem1, lineItem2]; + it('should search from added line items', function () { + var lineItem1 = {id: "1", quantity: 0}; + var lineItem2 = {id: "2", quantity: 1}; + vm.addedLineItems = [lineItem1, lineItem2]; - spyOn(stockAdjustmentCreationService, 'search'); - stockAdjustmentCreationService.search.andReturn([lineItem1]); - var params = { - page: 0, - program: program, - facility: facility, - reasons: [{id: 'r1', name: 'clinic return'}], - stockCardSummaries: [{ - orderable: {fullProductName: 'Implanon', id: 'a'}, - stockOnHand: 2, - lot: null - }], - addedLineItems: [lineItem1, lineItem2], - displayItems: [lineItem1], - keyword: undefined - }; + spyOn(stockAdjustmentCreationService, 'search'); + stockAdjustmentCreationService.search.andReturn([lineItem1]); + var params = { + page: 0, + program: program, + facility: facility, + reasons: [{id: 'r1', name: 'clinic return'}], + stockCardSummaries: [{ + orderable: {fullProductName: 'Implanon', id: 'a'}, + stockOnHand: 2, + lot: null + }], + addedLineItems: [lineItem1, lineItem2], + displayItems: [lineItem1], + keyword: undefined + }; - vm.search(); + vm.search(); - expect(vm.displayItems).toEqual([lineItem1]); - expect(state.go).toHaveBeenCalledWith('/a/b', params, {reload: true, notify: false}) - }); + expect(vm.displayItems).toEqual([lineItem1]); + expect(state.go).toHaveBeenCalledWith('/a/b', params, {reload: true, notify: false}) + }); + + describe('getStatusDisplay', function() { + it('should expose getStatusDisplay method', function() { + expect(angular.isFunction(vm.getStatusDisplay)).toBe(true); + }); + + it('should call messageService', function() { + spyOn(messageService, 'get').andReturn(true); + vm.getStatusDisplay(VVM_STATUS.STAGE_1); + expect(messageService.get).toHaveBeenCalled(); + }); + }); }); Index: src/stock-adjustment-creation/adjustment-creation.html =================================================================== diff -u -N -rd0d7394051ede1c8e6c7ed35b5046f295248fd66 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.html (.../adjustment-creation.html) (revision d0d7394051ede1c8e6c7ed35b5046f295248fd66) +++ src/stock-adjustment-creation/adjustment-creation.html (.../adjustment-creation.html) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -1,104 +1,108 @@

- {{vm.key('title') | - message:{'facilityCode': vm.facility.code, 'facilityName': vm.facility.name, 'program': vm.program.name} }} + {{vm.key('title') | message:{'facilityCode': vm.facility.code, 'facilityName': vm.facility.name, 'program': vm.program.name} }}

-
-
-
- - -
+
+ +
+ + +
- - + + -
-
+
+ -
- - -
+
+ + +
-
- - -
+
+ + +
- - -
+ + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{vm.key('noProducts') | message}}
{{vm.key('productCode') | message}}{{vm.key('product') | message}}{{vm.key('lotCode') | message}}{{vm.key('expiryDate') | message}}{{vm.key('soh') | message}}{{vm.key('srcDstLabel') | message}}{{vm.key('srcDstComments') | message}}{{vm.key('reason') | message}}{{vm.key('reasonComments') | message}}{{vm.key('quantity') | message}}{{vm.key('date') | message}}{{vm.key('actions') | message}}
{{lineItem.orderable.productCode}}{{lineItem.orderable | productName}}{{lineItem.displayLotMessage}}{{lineItem.lot.expirationDate | openlmisDate}}{{lineItem.$previewSOH}} - - - - - - - - - - - - - -
- -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{vm.key('noProducts') | message}}
{{vm.key('productCode') | message}}{{vm.key('product') | message}}{{vm.key('lotCode') | message}}{{vm.key('expiryDate') | message}}{{vm.key('soh') | message}}{{vm.key('srcDstLabel') | message}}{{vm.key('srcDstComments') | message}}{{vm.key('reason') | message}}{{vm.key('reasonComments') | message}}{{vm.key('quantity') | message}}{{vm.key('vvmStatus') | message}}{{vm.key('date') | message}}{{vm.key('actions') | message}}
{{lineItem.orderable.productCode}}{{lineItem.orderable | productName}}{{lineItem.displayLotMessage}}{{lineItem.lot.expirationDate | openlmisDate}}{{lineItem.$previewSOH}} + + + + + + + + + + + + + + + +
+ +
Index: src/stock-adjustment-creation/adjustment-creation.module.js =================================================================== diff -u -N -r8a0b64533648db9b07404c6259d9777ad478d1fe -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.module.js (.../adjustment-creation.module.js) (revision 8a0b64533648db9b07404c6259d9777ad478d1fe) +++ src/stock-adjustment-creation/adjustment-creation.module.js (.../adjustment-creation.module.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -21,6 +21,7 @@ 'stock-confirm-discard', 'stock-card-summaries', 'stock-orderable-lot-util', - 'stock-product-name' + 'stock-product-name', + 'stock-constants' ]); })(); Index: src/stock-adjustment-creation/adjustment-creation.routes.js =================================================================== diff -u -N -r5bdbf8c0afd69e36d0546e567745f65a838b0143 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.routes.js (.../adjustment-creation.routes.js) (revision 5bdbf8c0afd69e36d0546e567745f65a838b0143) +++ src/stock-adjustment-creation/adjustment-creation.routes.js (.../adjustment-creation.routes.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -93,4 +93,3 @@ }); } })(); - Index: src/stock-adjustment-creation/adjustment-creation.service.js =================================================================== diff -u -N -r62569f6e19868e5915e0025c6b058d34e45b414b -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.service.js (.../adjustment-creation.service.js) (revision 62569f6e19868e5915e0025c6b058d34e45b414b) +++ src/stock-adjustment-creation/adjustment-creation.service.js (.../adjustment-creation.service.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -75,6 +75,9 @@ orderableId: item.orderable.id, lotId: item.lot ? item.lot.id : null, quantity: item.quantity, + extraData: { + vvmStatus: item.vvmStatus + }, occurredDate: item.occurredDate, reasonId: item.reason ? item.reason.id : null, reasonFreeText: item.reasonFreeText Index: src/stock-adjustment-creation/adjustment-creation.service.spec.js =================================================================== diff -u -N -r8014fe25de4b55668954e1eb8e59e26c05fda307 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/adjustment-creation.service.spec.js (.../adjustment-creation.service.spec.js) (revision 8014fe25de4b55668954e1eb8e59e26c05fda307) +++ src/stock-adjustment-creation/adjustment-creation.service.spec.js (.../adjustment-creation.service.spec.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -150,6 +150,7 @@ orderable: {id: orderableId}, quantity: 100, occurredDate: date, + vvmStatus: 'STAGE_1', reason: {id: reasonId, isFreeTextAllowed: false}, assignment: {node: {id: sourceId}}, srcDstFreeText: srcDstFreeText @@ -172,6 +173,9 @@ orderableId: orderableId, lotId: null, quantity: 100, + extraData: { + vvmStatus: 'STAGE_1' + }, occurredDate: date.toISOString(), reasonId: reasonId, sourceId: sourceId, Index: src/stock-adjustment-creation/messages_en.json =================================================================== diff -u -N -rdbe9b9a2250a21ba901e549a12b1b96a73aff913 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-adjustment-creation/messages_en.json (.../messages_en.json) (revision dbe9b9a2250a21ba901e549a12b1b96a73aff913) +++ src/stock-adjustment-creation/messages_en.json (.../messages_en.json) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -24,5 +24,7 @@ "stockAdjustmentCreation.submitted": "Adjustments has successfully been submitted", "stockAdjustmentCreation.submitFailed": "Adjustments failed to submit", "stockAdjustmentCreation.confirmInfo": "Do you, ${username}, wish to confirm the ${number} adjustments?", - "stockAdjustmentCreation.confirm": "Confirm" + "stockAdjustmentCreation.confirm": "Confirm", + "stockAdjustmentCreation.selectStatus": "Select status", + "stockAdjustmentCreation.vvmStatus": "VVM Status" } Index: src/stock-card-summaries/card-summaries.routes.js =================================================================== diff -u -N -r3cece9274d3888a64d2537f929c8b777ff52d917 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-card-summaries/card-summaries.routes.js (.../card-summaries.routes.js) (revision 3cece9274d3888a64d2537f929c8b777ff52d917) +++ src/stock-card-summaries/card-summaries.routes.js (.../card-summaries.routes.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -67,4 +67,3 @@ }); } })(); - Index: src/stock-constants/stock-constatnts.module.js =================================================================== diff -u -N --- src/stock-constants/stock-constatnts.module.js (revision 0) +++ src/stock-constants/stock-constatnts.module.js (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -0,0 +1,28 @@ +/* + * 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 info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @module stock-constants + * + * @description + * Provides all constants essential for stockmanagement module. + */ + angular.module('stock-constants', []); + +})(); Index: src/stock-constants/vvm-statuses.constant.js =================================================================== diff -u -N --- src/stock-constants/vvm-statuses.constant.js (revision 0) +++ src/stock-constants/vvm-statuses.constant.js (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -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 info@OpenLMIS.org.  + */ + +(function() { + + 'use strict'; + + /** + * @ngdoc object + * @name stock-constants.VVM_STATUS + * + * @description + * This is constant for VVM statuses. + */ + angular + .module('stock-constants') + .constant('VVM_STATUS', status()); + + function status() { + return { + STAGE_1: 'STAGE_1', + STAGE_2: 'STAGE_2', + $getDisplayName: getDisplayName + }; + + /** + * @ngdoc method + * @methodOf stock-constants.VVM_STATUS + * @name getDisplayName + * + * @description + * Returns display name key for given VVM status. + * + * @param {String} status VVM status + * @return {String} VVM status display name message key + */ + function getDisplayName(status) { + var displayName; + if (status === this.STAGE_1) { + displayName = 'stockPhysicalInventoryDraft.stage1'; + } else if (status === this.STAGE_2) { + displayName = 'stockPhysicalInventoryDraft.stage2'; + } + return displayName; + } + } +})(); Index: src/stock-constants/vvm-statuses.constant.spec.js =================================================================== diff -u -N --- src/stock-constants/vvm-statuses.constant.spec.js (revision 0) +++ src/stock-constants/vvm-statuses.constant.spec.js (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -0,0 +1,37 @@ +/* + * 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 info@OpenLMIS.org.  + */ + +describe("VVM_STATUS", function() { + + var VVM_STATUS; + + beforeEach(function() { + module('stock-constants'); + + inject(function($injector) { + VVM_STATUS = $injector.get('VVM_STATUS'); + }); + }); + + describe('getDisplayName', function() { + it('should get display name for STAGE_1 status', function() { + expect(VVM_STATUS.$getDisplayName(VVM_STATUS.STAGE_1)).toBe('stockPhysicalInventoryDraft.stage1'); + }); + + it('should get display name for STAGE_1 status', function() { + expect(VVM_STATUS.$getDisplayName(VVM_STATUS.STAGE_2)).toBe('stockPhysicalInventoryDraft.stage2'); + }); + }); +}); Index: src/stock-issue-creation/messages_en.json =================================================================== diff -u -N -r35c18cd7af05942f593217b14b31f7855b237f1a -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-issue-creation/messages_en.json (.../messages_en.json) (revision 35c18cd7af05942f593217b14b31f7855b237f1a) +++ src/stock-issue-creation/messages_en.json (.../messages_en.json) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -28,5 +28,7 @@ "stockIssueCreation.confirmInfo": "Do you, ${username}, wish to confirm the ${number} stock issue events?", "stockIssueCreation.confirm": "Confirm", "stockIssueCreation.srcDstLabel": "Issue To", - "stockIssueCreation.srcDstComments": "Destination Comments" + "stockIssueCreation.srcDstComments": "Destination Comments", + "stockIssueCreation.selectStatus": "Select status", + "stockIssueCreation.vvmStatus": "VVM Status" } Index: src/stock-physical-inventory-draft/physical-inventory-draft.controller.js =================================================================== diff -u -N -rbe13fa775a33d992cd6c690e01cb4ff79cbc74f6 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-physical-inventory-draft/physical-inventory-draft.controller.js (.../physical-inventory-draft.controller.js) (revision be13fa775a33d992cd6c690e01cb4ff79cbc74f6) +++ src/stock-physical-inventory-draft/physical-inventory-draft.controller.js (.../physical-inventory-draft.controller.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -110,6 +110,9 @@ * * @description * Returns VVM status display. + * + * @param {String} status VVM status + * @return {String} VVM status display name */ vm.getStatusDisplay = function(status) { return messageService.get(VVM_STATUS.$getDisplayName(status)); Index: src/stock-physical-inventory-draft/physical-inventory-draft.module.js =================================================================== diff -u -N -r6532d2e96d81d877553c53c585ebe971e7df5285 -r9a34d72262ff47afac64a007e1d817cb82a5081b --- src/stock-physical-inventory-draft/physical-inventory-draft.module.js (.../physical-inventory-draft.module.js) (revision 6532d2e96d81d877553c53c585ebe971e7df5285) +++ src/stock-physical-inventory-draft/physical-inventory-draft.module.js (.../physical-inventory-draft.module.js) (revision 9a34d72262ff47afac64a007e1d817cb82a5081b) @@ -23,6 +23,7 @@ 'stock-choose-date-modal', 'openlmis-progressbar', 'stock-product-name', - 'stock-orderable-lot-util' + 'stock-orderable-lot-util', + 'stock-constants' ]); })(); Index: src/stock-physical-inventory-draft/vvm-statuses.constant.js =================================================================== diff -u -N --- src/stock-physical-inventory-draft/vvm-statuses.constant.js (revision 34501d69c4baf7ebc6ae9b7c9046781ef906df44) +++ src/stock-physical-inventory-draft/vvm-statuses.constant.js (revision 0) @@ -1,48 +0,0 @@ -/* - * 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 info@OpenLMIS.org.  - */ - -(function() { - - 'use strict'; - - /** - * @ngdoc object - * @name stock-physical-inventory-draft.VVM_STATUS - * - * @description - * This is constant for VVM statuses. - */ - angular - .module('stock-physical-inventory-draft') - .constant('VVM_STATUS', status()); - - function status() { - return { - STAGE_1: 'STAGE_1', - STAGE_2: 'STAGE_2', - $getDisplayName: getDisplayName - }; - - function getDisplayName(status) { - var displayName; - if (status === this.STAGE_1) { - displayName = 'stockPhysicalInventoryDraft.stage1'; - } else if (status === this.STAGE_2) { - displayName = 'stockPhysicalInventoryDraft.stage2'; - } - return displayName; - } - } -})(); Index: src/stock-physical-inventory-draft/vvm-statuses.constant.spec.js =================================================================== diff -u -N --- src/stock-physical-inventory-draft/vvm-statuses.constant.spec.js (revision 8c2ed9802335cd3ba143b789e96b98a71a0b4842) +++ src/stock-physical-inventory-draft/vvm-statuses.constant.spec.js (revision 0) @@ -1,37 +0,0 @@ -/* - * 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 info@OpenLMIS.org.  - */ - -describe("VVM_STATUS", function() { - - var VVM_STATUS; - - beforeEach(function() { - module('stock-physical-inventory-draft'); - - inject(function($injector) { - VVM_STATUS = $injector.get('VVM_STATUS'); - }); - }); - - describe('getDisplayName', function() { - it('should get display name for STAGE_1 status', function() { - expect(VVM_STATUS.$getDisplayName(VVM_STATUS.STAGE_1)).toBe('stockPhysicalInventoryDraft.stage1'); - }); - - it('should get display name for STAGE_1 status', function() { - expect(VVM_STATUS.$getDisplayName(VVM_STATUS.STAGE_2)).toBe('stockPhysicalInventoryDraft.stage2'); - }); - }); -});