Index: src/stock-adjustment-mobile/adjustment-app.jsx =================================================================== diff -u -N -rc1d2668dd21bf733d1acf2f95a690a61473e36f0 -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/adjustment-app.jsx (.../adjustment-app.jsx) (revision c1d2668dd21bf733d1acf2f95a690a61473e36f0) +++ src/stock-adjustment-mobile/adjustment-app.jsx (.../adjustment-app.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -22,27 +22,23 @@ import AdjustmentForm from './adjustment-form.component'; import ProgramSelect from './program-select'; -const AdjustmentApp = props => { - const { +const AdjustmentApp = ({ adjustmentType, facilityFactory, stockAdjustmentCreationService, orderableGroupService, existingStockOrderableGroupsFactory, stockReasonsFactory, offlineService, - } = props; + }) => { const dispatch = useDispatch(); const userHomeFacility = useSelector(state => state.facilities.userHomeFacility); useEffect( () => { facilityFactory.getUserHomeFacility() - .then(facility => { - dispatch(setUserHomeFacility(facility)); - }, - ) + .then(facility => dispatch(setUserHomeFacility(facility))) }, [facilityFactory] ); Index: src/stock-adjustment-mobile/adjustment-form.component.jsx =================================================================== diff -u -N -rc1d2668dd21bf733d1acf2f95a690a61473e36f0 -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/adjustment-form.component.jsx (.../adjustment-form.component.jsx) (revision c1d2668dd21bf733d1acf2f95a690a61473e36f0) +++ src/stock-adjustment-mobile/adjustment-form.component.jsx (.../adjustment-form.component.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -41,7 +41,7 @@ title: `Are you sure you want to submit ${adjustment.length} product${adjustment.length === 1 ? '' : 's'} for Adjustments?`, confirmLabel: 'Confirm', confirmButtonClass: 'primary', - onConfirm: () => submitAdjustment() + onConfirm: submitAdjustment }); }; @@ -65,7 +65,7 @@ } const onDelete = () => { - // TODO - delete products from adjustment + dispatch(resetAdjustment(adjustment)); showToast('success'); history.push("/makeAdjustmentAddProducts/submitAdjustment/programChoice"); }; @@ -107,7 +107,7 @@ title: "Are you sure you want to delete this Adjustment?", confirmLabel: 'Delete', confirmButtonClass: 'danger', - onConfirm: () => onDelete() + onConfirm: onDelete })} className="danger" style={{marginLeft: "5%"}} Index: src/stock-adjustment-mobile/components/read-only-table.component.jsx =================================================================== diff -u -N -r112d9b69164f6cbb93c29dbe9b3bfff80fb35a9d -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/components/read-only-table.component.jsx (.../read-only-table.component.jsx) (revision 112d9b69164f6cbb93c29dbe9b3bfff80fb35a9d) +++ src/stock-adjustment-mobile/components/read-only-table.component.jsx (.../read-only-table.component.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -43,16 +43,14 @@ {headerGroups.map(headerGroup => ( - {headerGroup.headers.map(column => { - return column.hideHeader === true ? null : ( - {column.render("Header")} - ); - })} + {headerGroup.headers.map(column => !column.hideHeader && ( + {column.render("Header")} + ))} - ))} - + ))} + - {rows.map((row, i) => { + {rows.map(row => { prepareRow(row); return ( Index: src/stock-adjustment-mobile/components/toast.component.jsx =================================================================== diff -u -N -rc1d2668dd21bf733d1acf2f95a690a61473e36f0 -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/components/toast.component.jsx (.../toast.component.jsx) (revision c1d2668dd21bf733d1acf2f95a690a61473e36f0) +++ src/stock-adjustment-mobile/components/toast.component.jsx (.../toast.component.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -19,16 +19,15 @@ import { setToastList } from '../reducers/toasts'; -const Toast = props => { - const { position, autoDelete, autoDeleteTime } = props; +const Toast = ({ position, autoDelete, autoDeleteTime }) => { const dispatch = useDispatch(); - var toastList = useSelector(state => state.toasts.toasts); + let toastList = useSelector(state => state.toasts.toasts); useEffect(() => { let listToRemove = toastList; const interval = setInterval(() => { if (autoDelete && listToRemove.length) { - if(listToRemove.length !== 0) { + if(listToRemove.length) { listToRemove = deleteToast(listToRemove[0].id, listToRemove); toastList = listToRemove; dispatch(setToastList(toastList)); @@ -42,10 +41,7 @@ }, [toastList, autoDelete, autoDeleteTime]); - const deleteToast = (id, listToRemove) => { - const listItemIndexToRemove = listToRemove.findIndex(element => element.id === id); - return listToRemove.filter((element, index) => index !== listItemIndexToRemove); - } + const deleteToast = (id, listToRemove) => listToRemove.filter(element => element.id !== id); return (
@@ -59,11 +55,9 @@ width: "328px" }} > -
-

- {toast.description} -

-
+

+ {toast.description} +

) } Index: src/stock-adjustment-mobile/components/toast.css =================================================================== diff -u -N -rd995ecc1b4bcb36aeca37185706b3be57e8dfeca -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/components/toast.css (.../toast.css) (revision d995ecc1b4bcb36aeca37185706b3be57e8dfeca) +++ src/stock-adjustment-mobile/components/toast.css (.../toast.css) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -3,7 +3,7 @@ box-sizing: border-box; position: fixed; z-index: 999999; - bottom: "0" + bottom: "0"; } .notification { @@ -18,11 +18,11 @@ max-height: 100px; opacity: .9; background-position: 15px; - background-repeat: no-repeat; + background-repeat: no-repeat; } .notification-title { - font-weight: 700; + font-weight: 700; font-size: 16px; text-align: center; margin-top: 0; Index: src/stock-adjustment-mobile/format-utils.jsx =================================================================== diff -u -N -rc327b4d0ac48a917a7a8ac247226aa46c9dda437 -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/format-utils.jsx (.../format-utils.jsx) (revision c327b4d0ac48a917a7a8ac247226aa46c9dda437) +++ src/stock-adjustment-mobile/format-utils.jsx (.../format-utils.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -23,9 +23,9 @@ }; export const formatDateISO = (date) => { - var dd = String(date.getDate()).padStart(2, '0'); - var mm = String(date.getMonth() + 1).padStart(2, '0'); - var yyyy = date.getFullYear(); + const dd = String(date.getDate()).padStart(2, '0'); + const mm = String(date.getMonth() + 1).padStart(2, '0'); + const yyyy = date.getFullYear(); const formattedDate = yyyy + '-' + mm + '-' + dd; return formattedDate @@ -59,7 +59,7 @@ { id: Math.floor((Math.random() * 101) + 1), title: 'success', - description: 'Your changes has been succeffully updated.', + description: 'Your changes have been successfully updated.', backgroundColor: '#696969' }, { Index: src/stock-adjustment-mobile/messages_en.json =================================================================== diff -u -N -r112d9b69164f6cbb93c29dbe9b3bfff80fb35a9d -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/messages_en.json (.../messages_en.json) (revision 112d9b69164f6cbb93c29dbe9b3bfff80fb35a9d) +++ src/stock-adjustment-mobile/messages_en.json (.../messages_en.json) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -1,4 +1,3 @@ { "stockAdjustment.adjustment.mobile": "Adjustment" } - \ No newline at end of file Index: src/stock-adjustment-mobile/program-select.jsx =================================================================== diff -u -N -rc1d2668dd21bf733d1acf2f95a690a61473e36f0 -rc337cc219b24bface3d7690246b3d774541a8d85 --- src/stock-adjustment-mobile/program-select.jsx (.../program-select.jsx) (revision c1d2668dd21bf733d1acf2f95a690a61473e36f0) +++ src/stock-adjustment-mobile/program-select.jsx (.../program-select.jsx) (revision c337cc219b24bface3d7690246b3d774541a8d85) @@ -31,13 +31,7 @@ const programSelected = useSelector(state => state.program.program); const adjustment = useSelector(state => state.adjustment.adjustment); - const programs = facility.supportedPrograms - .map(p => { - return { - value: p.id, - name: p.name - }; - }); + const programs = facility.supportedPrograms.map(({ id, name }) => ({ value: id, name })); const afterSelectProgram = (programId, programName) => { const programObject = { programName: programName, programId: programId };