Index: src/stock-adjustment-mobile/_adjustment-mobile.scss =================================================================== diff -u -N -r14d88fc7e9bf0d7ea8a0020a2777c017abb3b427 -r9b23add288958da43e8a4f8be30e48edda073463 --- src/stock-adjustment-mobile/_adjustment-mobile.scss (.../_adjustment-mobile.scss) (revision 14d88fc7e9bf0d7ea8a0020a2777c017abb3b427) +++ src/stock-adjustment-mobile/_adjustment-mobile.scss (.../_adjustment-mobile.scss) (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -1,4 +1,4 @@ -.adjustment-mobile, .issue-mobile { +.adjustment-mobile, .issue-mobile, .receive-mobile { flex: 1 0 auto; display: flex; flex-direction: column; Index: src/stock-adjustment-mobile/store.jsx =================================================================== diff -u -N -r67ce4ab9a7cc026538468a91edbcccde91a35c71 -r9b23add288958da43e8a4f8be30e48edda073463 --- src/stock-adjustment-mobile/store.jsx (.../store.jsx) (revision 67ce4ab9a7cc026538468a91edbcccde91a35c71) +++ src/stock-adjustment-mobile/store.jsx (.../store.jsx) (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -22,6 +22,7 @@ import toastsReducer from "./reducers/toasts" import sourceDestinationsReducer from "./reducers/source-destination" import reducerIssue from '../stock-issue-mobile/store'; +import reducerReceive from '../stock-receive-mobile/store'; const saveToLocalStorage = (state) => { @@ -55,7 +56,7 @@ }; const store = configureStore({ - reducer: Object.assign(reducerAdjustment, reducerIssue), + reducer: Object.assign(reducerAdjustment, Object.assign(reducerIssue, reducerReceive)), middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: false }), Index: src/stock-receive-mobile/messages_en.json =================================================================== diff -u -N --- src/stock-receive-mobile/messages_en.json (revision 0) +++ src/stock-receive-mobile/messages_en.json (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,3 @@ +{ + "stockReceive.receive.mobile": "Receive" +} Index: src/stock-receive-mobile/receive-app.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/receive-app.jsx (revision 0) +++ src/stock-receive-mobile/receive-app.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,77 @@ +/* + * 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.  + */ + +import React, { useEffect } from 'react'; +import { HashRouter as Router, Route, Switch } from 'react-router-dom'; +import { useDispatch, useSelector } from 'react-redux'; +import { setUserHomeFacility } from './reducers/facilities'; +import { resetAdjustment } from './reducers/adjustment'; +import { setProductOptions } from './reducers/product-options'; +import { setReasons } from './reducers/reasons'; +import { setProgram } from './reducers/program'; +import { setSourceDestinations } from './reducers/source-destination'; +import { setToastList } from './reducers/toasts'; +import ProgramSelect from '../stock-adjustment-mobile/program-select'; +import { RECEIVE } from '../stock-adjustment-mobile/consts'; + +const ReceiveApp = ({ + facilityFactory, + existingStockOrderableGroupsFactory, + stockReasonsFactory, + sourceDestinationService, + offlineService, +}) => { + + const dispatch = useDispatch(); + const userHomeFacility = useSelector(state => state[`facilitiesReceive`][`userHomeFacilityReceive`]); + + useEffect(() => facilityFactory.getUserHomeFacility().then(facility => dispatch(setUserHomeFacility(facility))), [facilityFactory]); + + const menu = document.getElementsByClassName("header ng-scope")[0]; + + useEffect(() => menu.style.display = "", [menu]); + + return ( +
+ + + + { + userHomeFacility + && + } + + + +
+ ); +}; + +export default ReceiveApp; Index: src/stock-receive-mobile/receive-mobile.html =================================================================== diff -u -N --- src/stock-receive-mobile/receive-mobile.html (revision 0) +++ src/stock-receive-mobile/receive-mobile.html (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1 @@ + Index: src/stock-receive-mobile/receive-mobile.module.js =================================================================== diff -u -N --- src/stock-receive-mobile/receive-mobile.module.js (revision 0) +++ src/stock-receive-mobile/receive-mobile.module.js (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,21 @@ +/* + * 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'; + + angular.module('stock-receive-mobile', []); + +})(); Index: src/stock-receive-mobile/receive-mobile.routes.js =================================================================== diff -u -N --- src/stock-receive-mobile/receive-mobile.routes.js (revision 0) +++ src/stock-receive-mobile/receive-mobile.routes.js (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,46 @@ +/* + * 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'; + + angular + .module('stock-receive-mobile') + .config(routes); + + routes.$inject = ['$stateProvider', 'STOCKMANAGEMENT_RIGHTS', 'ADJUSTMENT_TYPE']; + + function routes($stateProvider, STOCKMANAGEMENT_RIGHTS, ADJUSTMENT_TYPE) { + $stateProvider.state('openlmis.stockmanagement.receiveMobile', { + url: '/receiveMobile', + label: 'stockReceive.receive.mobile', + isOffline: true, + priority: 0, + showInNavigation: false, + showInNavigationOnLowResolutions: true, + views: { + '@': { + templateUrl: 'stock-receive-mobile/receive-mobile.html' + } + }, + resolve: { + adjustmentType: function() { + return ADJUSTMENT_TYPE.ADJUSTMENT; + } + }, + accessRights: [STOCKMANAGEMENT_RIGHTS.STOCK_ADJUST] + }); + } +})(); Index: src/stock-receive-mobile/receive-mobile.wrapper.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/receive-mobile.wrapper.jsx (revision 0) +++ src/stock-receive-mobile/receive-mobile.wrapper.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -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.  + */ + +import React from 'react'; +import ReactDOM from 'react-dom'; +import ReceiveApp from './receive-app'; +import { Provider } from "react-redux"; +import store from '../stock-adjustment-mobile/store'; +import MetaTags from 'react-meta-tags'; + +(function () { + 'use strict'; + + angular + .module('stock-receive-mobile') + .directive('stockReceiveMobile', stockReceiveMobile); + + stockReceiveMobile.$inject = ['facilityFactory', 'stockAdjustmentCreationService', + 'orderableGroupService', 'offlineService', 'existingStockOrderableGroupsFactory', 'stockReasonsFactory', 'sourceDestinationService']; + + function stockReceiveMobile(facilityFactory, stockAdjustmentCreationService, + orderableGroupService, offlineService, existingStockOrderableGroupsFactory, stockReasonsFactory, sourceDestinationService) { + return { + template: '
', + replace: true, + link: function ($scope) { + const app = document.getElementById('mobileApp'); + + ReactDOM.render( + + + + + + , + app + ); + } + }; + } +})(); Index: src/stock-receive-mobile/reducers/adjustment.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/adjustment.jsx (revision 0) +++ src/stock-receive-mobile/reducers/adjustment.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,38 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const adjustmentReceiveSlice = createSlice({ + name: 'adjustmentReceive', + initialState: { + adjustmentReceive: [] + }, + reducers: { + setAdjustment: (state, action) => { + state.adjustmentReceive = action.payload; + }, + appendToAdjustment: (state, action) => { + state.adjustmentReceive.push(action.payload); + }, + resetAdjustment: (state) => { + state.adjustmentReceive = [] + } + } +}); + +export const {setAdjustment, appendToAdjustment, resetAdjustment} = adjustmentReceiveSlice.actions; + +export default adjustmentReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/facilities.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/facilities.jsx (revision 0) +++ src/stock-receive-mobile/reducers/facilities.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,32 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const facilitiesReceiveSlice = createSlice({ + name: 'facilitiesReceive', + initialState: { + userHomeFacilityReceive: null + }, + reducers: { + setUserHomeFacility: (state, action) => { + state.userHomeFacilityReceive = action.payload; + } + } +}); + +export const {setUserHomeFacility} = facilitiesReceiveSlice.actions; + +export default facilitiesReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/product-options.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/product-options.jsx (revision 0) +++ src/stock-receive-mobile/reducers/product-options.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,32 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const productOptionsReceiveSlice = createSlice({ + name: 'productOptionsReceive', + initialState: { + productOptionsReceive: [] + }, + reducers: { + setProductOptions: (state, action) => { + state.productOptionsReceive = action.payload; + } + } +}); + +export const {setProductOptions} = productOptionsReceiveSlice.actions; + +export default productOptionsReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/program.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/program.jsx (revision 0) +++ src/stock-receive-mobile/reducers/program.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,35 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const programReceiveSlice = createSlice({ + name: 'programReceive', + initialState: { + programReceive: [] + }, + reducers: { + setProgram: (state, action) => { + state.programReceive = action.payload; + }, + resetProgram: (state) => { + state.programReceive = null; + } + } +}); + +export const {setProgram, resetProgram} = programReceiveSlice.actions; + +export default programReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/reasons.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/reasons.jsx (revision 0) +++ src/stock-receive-mobile/reducers/reasons.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,32 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const reasonsReceiveSlice = createSlice({ + name: 'reasonsReceive', + initialState: { + reasonsReceive: [] + }, + reducers: { + setReasons: (state, action) => { + state.reasonsReceive = action.payload; + } + } +}); + +export const {setReasons} = reasonsReceiveSlice.actions; + +export default reasonsReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/source-destination.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/source-destination.jsx (revision 0) +++ src/stock-receive-mobile/reducers/source-destination.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,32 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const sourceDestinationsReceiveSlice = createSlice({ + name: 'sourceDestinationsReceive', + initialState: { + sourceDestinationsReceive: [] + }, + reducers: { + setSourceDestinations: (state, action) => { + state.sourceDestinationsReceive = action.payload; + } + } +}); + +export const {setSourceDestinations} = sourceDestinationsReceiveSlice.actions; + +export default sourceDestinationsReceiveSlice.reducer; Index: src/stock-receive-mobile/reducers/toasts.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/reducers/toasts.jsx (revision 0) +++ src/stock-receive-mobile/reducers/toasts.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,32 @@ +/* + * 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.  + */ + +import { createSlice } from '@reduxjs/toolkit'; + +export const toastsReceiveSlice = createSlice({ + name: 'toastsReceive', + initialState: { + toastsReceive: [] + }, + reducers: { + setToastList: (state, action) => { + state.toastsReceive = action.payload; + } + } +}); + +export const {setToastList} = toastsReceiveSlice.actions; + +export default toastsReceiveSlice.reducer; Index: src/stock-receive-mobile/store.jsx =================================================================== diff -u -N --- src/stock-receive-mobile/store.jsx (revision 0) +++ src/stock-receive-mobile/store.jsx (revision 9b23add288958da43e8a4f8be30e48edda073463) @@ -0,0 +1,34 @@ +/* + * 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.  + */ + +import facilitiesReducer from "./reducers/facilities"; +import productOptionsReducer from "./reducers/product-options" +import reasonsReducer from "./reducers/reasons" +import adjustmentReducer from "./reducers/adjustment" +import programReducer from "./reducers/program" +import toastsReducer from "./reducers/toasts" +import sourceDestinationsReducer from "./reducers/source-destination" + +const reducerReceive = { + facilitiesReceive: facilitiesReducer, + productOptionsReceive: productOptionsReducer, + reasonsReceive: reasonsReducer, + adjustmentReceive: adjustmentReducer, + programReceive: programReducer, + toastsReceive: toastsReducer, + sourceDestinationsReceive: sourceDestinationsReducer +}; + +export default reducerReceive;