@scrumble-nl/gatherer-frontend 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/README.md +159 -0
  2. package/lib/commonjs/context/picker-context.js +85 -0
  3. package/lib/commonjs/context/picker-context.js.map +1 -0
  4. package/lib/commonjs/context/scan-context.js +20 -0
  5. package/lib/commonjs/context/scan-context.js.map +1 -0
  6. package/lib/commonjs/hooks/use-instance.js +28 -0
  7. package/lib/commonjs/hooks/use-instance.js.map +1 -0
  8. package/lib/commonjs/hooks/use-pick-item-switch.js +53 -0
  9. package/lib/commonjs/hooks/use-pick-item-switch.js.map +1 -0
  10. package/lib/commonjs/hooks/use-picker.js +13 -0
  11. package/lib/commonjs/hooks/use-picker.js.map +1 -0
  12. package/lib/commonjs/hooks/use-scanner.js +35 -0
  13. package/lib/commonjs/hooks/use-scanner.js.map +1 -0
  14. package/lib/commonjs/index.js +41 -0
  15. package/lib/commonjs/index.js.map +1 -0
  16. package/lib/commonjs/lang/en/components/pick-list.js +14 -0
  17. package/lib/commonjs/lang/en/components/pick-list.js.map +1 -0
  18. package/lib/commonjs/lang/en/components/picker.js +16 -0
  19. package/lib/commonjs/lang/en/components/picker.js.map +1 -0
  20. package/lib/commonjs/lang/en/english.js +16 -0
  21. package/lib/commonjs/lang/en/english.js.map +1 -0
  22. package/lib/commonjs/lang/nl/components/pick-list.js +14 -0
  23. package/lib/commonjs/lang/nl/components/pick-list.js.map +1 -0
  24. package/lib/commonjs/lang/nl/components/picker.js +16 -0
  25. package/lib/commonjs/lang/nl/components/picker.js.map +1 -0
  26. package/lib/commonjs/lang/nl/dutch.js +16 -0
  27. package/lib/commonjs/lang/nl/dutch.js.map +1 -0
  28. package/lib/commonjs/lang/translations.js +15 -0
  29. package/lib/commonjs/lang/translations.js.map +1 -0
  30. package/lib/commonjs/pick-list/partials/empty-list.js +23 -0
  31. package/lib/commonjs/pick-list/partials/empty-list.js.map +1 -0
  32. package/lib/commonjs/pick-list/partials/pick-group-item.js +45 -0
  33. package/lib/commonjs/pick-list/partials/pick-group-item.js.map +1 -0
  34. package/lib/commonjs/pick-list/partials/search.js +64 -0
  35. package/lib/commonjs/pick-list/partials/search.js.map +1 -0
  36. package/lib/commonjs/pick-list/pick-list.js +80 -0
  37. package/lib/commonjs/pick-list/pick-list.js.map +1 -0
  38. package/lib/commonjs/pick-list/styles/empty-list-styles.js +19 -0
  39. package/lib/commonjs/pick-list/styles/empty-list-styles.js.map +1 -0
  40. package/lib/commonjs/pick-list/styles/pick-group-item-styles.js +24 -0
  41. package/lib/commonjs/pick-list/styles/pick-group-item-styles.js.map +1 -0
  42. package/lib/commonjs/pick-list/styles/search-styles.js +34 -0
  43. package/lib/commonjs/pick-list/styles/search-styles.js.map +1 -0
  44. package/lib/commonjs/picker/partials/modal/pick-modal.js +44 -0
  45. package/lib/commonjs/picker/partials/modal/pick-modal.js.map +1 -0
  46. package/lib/commonjs/picker/partials/modal/pick-quantity-select.js +132 -0
  47. package/lib/commonjs/picker/partials/modal/pick-quantity-select.js.map +1 -0
  48. package/lib/commonjs/picker/partials/pick-amount.js +33 -0
  49. package/lib/commonjs/picker/partials/pick-amount.js.map +1 -0
  50. package/lib/commonjs/picker/partials/product-info.js +38 -0
  51. package/lib/commonjs/picker/partials/product-info.js.map +1 -0
  52. package/lib/commonjs/picker/partials/progress-bar.js +37 -0
  53. package/lib/commonjs/picker/partials/progress-bar.js.map +1 -0
  54. package/lib/commonjs/picker/picker.js +67 -0
  55. package/lib/commonjs/picker/picker.js.map +1 -0
  56. package/lib/commonjs/picker/styles/pick-amount-styles.js +31 -0
  57. package/lib/commonjs/picker/styles/pick-amount-styles.js.map +1 -0
  58. package/lib/commonjs/picker/styles/pick-modal-styles.js +81 -0
  59. package/lib/commonjs/picker/styles/pick-modal-styles.js.map +1 -0
  60. package/lib/commonjs/picker/styles/picker-styles.js +14 -0
  61. package/lib/commonjs/picker/styles/picker-styles.js.map +1 -0
  62. package/lib/commonjs/picker/styles/product-info-styles.js +27 -0
  63. package/lib/commonjs/picker/styles/product-info-styles.js.map +1 -0
  64. package/lib/commonjs/picker/styles/progress-bar-styles.js +19 -0
  65. package/lib/commonjs/picker/styles/progress-bar-styles.js.map +1 -0
  66. package/lib/commonjs/shared/api/api-urls.js +22 -0
  67. package/lib/commonjs/shared/api/api-urls.js.map +1 -0
  68. package/lib/commonjs/shared/badge/badge.js +44 -0
  69. package/lib/commonjs/shared/badge/badge.js.map +1 -0
  70. package/lib/commonjs/shared/badge/styles/badge-styles.js +24 -0
  71. package/lib/commonjs/shared/badge/styles/badge-styles.js.map +1 -0
  72. package/lib/commonjs/shared/constants.js +37 -0
  73. package/lib/commonjs/shared/constants.js.map +1 -0
  74. package/lib/commonjs/shared/default-pick-group-item.js +22 -0
  75. package/lib/commonjs/shared/default-pick-group-item.js.map +1 -0
  76. package/lib/commonjs/shared/layout/data-column.js +26 -0
  77. package/lib/commonjs/shared/layout/data-column.js.map +1 -0
  78. package/lib/commonjs/shared/layout/data-format.js +22 -0
  79. package/lib/commonjs/shared/layout/data-format.js.map +1 -0
  80. package/lib/commonjs/shared/layout/data-row.js +36 -0
  81. package/lib/commonjs/shared/layout/data-row.js.map +1 -0
  82. package/lib/commonjs/shared/layout/styles/layout-styles.js +26 -0
  83. package/lib/commonjs/shared/layout/styles/layout-styles.js.map +1 -0
  84. package/lib/commonjs/shared/press-button/press-button.js +34 -0
  85. package/lib/commonjs/shared/press-button/press-button.js.map +1 -0
  86. package/lib/commonjs/types/badge/badge.d.js +2 -0
  87. package/lib/commonjs/types/badge/badge.d.js.map +1 -0
  88. package/lib/commonjs/types/config/config.d.js +2 -0
  89. package/lib/commonjs/types/config/config.d.js.map +1 -0
  90. package/lib/commonjs/types/control/control.d.js +2 -0
  91. package/lib/commonjs/types/control/control.d.js.map +1 -0
  92. package/lib/commonjs/types/pick-group/pick-group.d.js +2 -0
  93. package/lib/commonjs/types/pick-group/pick-group.d.js.map +1 -0
  94. package/lib/commonjs/types/pick-group/search-params.d.js +2 -0
  95. package/lib/commonjs/types/pick-group/search-params.d.js.map +1 -0
  96. package/lib/commonjs/types/pick-item/pick-item.d.js +2 -0
  97. package/lib/commonjs/types/pick-item/pick-item.d.js.map +1 -0
  98. package/lib/commonjs/types/scanner/scanner.d.js +2 -0
  99. package/lib/commonjs/types/scanner/scanner.d.js.map +1 -0
  100. package/lib/module/context/picker-context.js +74 -0
  101. package/lib/module/context/picker-context.js.map +1 -0
  102. package/lib/module/context/scan-context.js +10 -0
  103. package/lib/module/context/scan-context.js.map +1 -0
  104. package/lib/module/hooks/use-instance.js +20 -0
  105. package/lib/module/hooks/use-instance.js.map +1 -0
  106. package/lib/module/hooks/use-pick-item-switch.js +46 -0
  107. package/lib/module/hooks/use-pick-item-switch.js.map +1 -0
  108. package/lib/module/hooks/use-picker.js +6 -0
  109. package/lib/module/hooks/use-picker.js.map +1 -0
  110. package/lib/module/hooks/use-scanner.js +28 -0
  111. package/lib/module/hooks/use-scanner.js.map +1 -0
  112. package/lib/module/index.js +6 -0
  113. package/lib/module/index.js.map +1 -0
  114. package/lib/module/lang/en/components/pick-list.js +7 -0
  115. package/lib/module/lang/en/components/pick-list.js.map +1 -0
  116. package/lib/module/lang/en/components/picker.js +9 -0
  117. package/lib/module/lang/en/components/picker.js.map +1 -0
  118. package/lib/module/lang/en/english.js +9 -0
  119. package/lib/module/lang/en/english.js.map +1 -0
  120. package/lib/module/lang/nl/components/pick-list.js +7 -0
  121. package/lib/module/lang/nl/components/pick-list.js.map +1 -0
  122. package/lib/module/lang/nl/components/picker.js +9 -0
  123. package/lib/module/lang/nl/components/picker.js.map +1 -0
  124. package/lib/module/lang/nl/dutch.js +9 -0
  125. package/lib/module/lang/nl/dutch.js.map +1 -0
  126. package/lib/module/lang/translations.js +8 -0
  127. package/lib/module/lang/translations.js.map +1 -0
  128. package/lib/module/pick-list/partials/empty-list.js +15 -0
  129. package/lib/module/pick-list/partials/empty-list.js.map +1 -0
  130. package/lib/module/pick-list/partials/pick-group-item.js +37 -0
  131. package/lib/module/pick-list/partials/pick-group-item.js.map +1 -0
  132. package/lib/module/pick-list/partials/search.js +54 -0
  133. package/lib/module/pick-list/partials/search.js.map +1 -0
  134. package/lib/module/pick-list/pick-list.js +71 -0
  135. package/lib/module/pick-list/pick-list.js.map +1 -0
  136. package/lib/module/pick-list/styles/empty-list-styles.js +12 -0
  137. package/lib/module/pick-list/styles/empty-list-styles.js.map +1 -0
  138. package/lib/module/pick-list/styles/pick-group-item-styles.js +17 -0
  139. package/lib/module/pick-list/styles/pick-group-item-styles.js.map +1 -0
  140. package/lib/module/pick-list/styles/search-styles.js +27 -0
  141. package/lib/module/pick-list/styles/search-styles.js.map +1 -0
  142. package/lib/module/picker/partials/modal/pick-modal.js +36 -0
  143. package/lib/module/picker/partials/modal/pick-modal.js.map +1 -0
  144. package/lib/module/picker/partials/modal/pick-quantity-select.js +122 -0
  145. package/lib/module/picker/partials/modal/pick-quantity-select.js.map +1 -0
  146. package/lib/module/picker/partials/pick-amount.js +25 -0
  147. package/lib/module/picker/partials/pick-amount.js.map +1 -0
  148. package/lib/module/picker/partials/product-info.js +30 -0
  149. package/lib/module/picker/partials/product-info.js.map +1 -0
  150. package/lib/module/picker/partials/progress-bar.js +29 -0
  151. package/lib/module/picker/partials/progress-bar.js.map +1 -0
  152. package/lib/module/picker/picker.js +59 -0
  153. package/lib/module/picker/picker.js.map +1 -0
  154. package/lib/module/picker/styles/pick-amount-styles.js +24 -0
  155. package/lib/module/picker/styles/pick-amount-styles.js.map +1 -0
  156. package/lib/module/picker/styles/pick-modal-styles.js +74 -0
  157. package/lib/module/picker/styles/pick-modal-styles.js.map +1 -0
  158. package/lib/module/picker/styles/picker-styles.js +7 -0
  159. package/lib/module/picker/styles/picker-styles.js.map +1 -0
  160. package/lib/module/picker/styles/product-info-styles.js +20 -0
  161. package/lib/module/picker/styles/product-info-styles.js.map +1 -0
  162. package/lib/module/picker/styles/progress-bar-styles.js +12 -0
  163. package/lib/module/picker/styles/progress-bar-styles.js.map +1 -0
  164. package/lib/module/shared/api/api-urls.js +9 -0
  165. package/lib/module/shared/api/api-urls.js.map +1 -0
  166. package/lib/module/shared/badge/badge.js +36 -0
  167. package/lib/module/shared/badge/badge.js.map +1 -0
  168. package/lib/module/shared/badge/styles/badge-styles.js +17 -0
  169. package/lib/module/shared/badge/styles/badge-styles.js.map +1 -0
  170. package/lib/module/shared/constants.js +16 -0
  171. package/lib/module/shared/constants.js.map +1 -0
  172. package/lib/module/shared/default-pick-group-item.js +15 -0
  173. package/lib/module/shared/default-pick-group-item.js.map +1 -0
  174. package/lib/module/shared/layout/data-column.js +18 -0
  175. package/lib/module/shared/layout/data-column.js.map +1 -0
  176. package/lib/module/shared/layout/data-format.js +14 -0
  177. package/lib/module/shared/layout/data-format.js.map +1 -0
  178. package/lib/module/shared/layout/data-row.js +28 -0
  179. package/lib/module/shared/layout/data-row.js.map +1 -0
  180. package/lib/module/shared/layout/styles/layout-styles.js +19 -0
  181. package/lib/module/shared/layout/styles/layout-styles.js.map +1 -0
  182. package/lib/module/shared/press-button/press-button.js +25 -0
  183. package/lib/module/shared/press-button/press-button.js.map +1 -0
  184. package/lib/module/types/badge/badge.d.js +2 -0
  185. package/lib/module/types/badge/badge.d.js.map +1 -0
  186. package/lib/module/types/config/config.d.js +2 -0
  187. package/lib/module/types/config/config.d.js.map +1 -0
  188. package/lib/module/types/control/control.d.js +2 -0
  189. package/lib/module/types/control/control.d.js.map +1 -0
  190. package/lib/module/types/pick-group/pick-group.d.js +2 -0
  191. package/lib/module/types/pick-group/pick-group.d.js.map +1 -0
  192. package/lib/module/types/pick-group/search-params.d.js +2 -0
  193. package/lib/module/types/pick-group/search-params.d.js.map +1 -0
  194. package/lib/module/types/pick-item/pick-item.d.js +2 -0
  195. package/lib/module/types/pick-item/pick-item.d.js.map +1 -0
  196. package/lib/module/types/scanner/scanner.d.js +2 -0
  197. package/lib/module/types/scanner/scanner.d.js.map +1 -0
  198. package/lib/typescript/context/picker-context.d.ts +18 -0
  199. package/lib/typescript/context/scan-context.d.ts +11 -0
  200. package/lib/typescript/hooks/use-instance.d.ts +2 -0
  201. package/lib/typescript/hooks/use-pick-item-switch.d.ts +1 -0
  202. package/lib/typescript/hooks/use-picker.d.ts +2 -0
  203. package/lib/typescript/hooks/use-scanner.d.ts +3 -0
  204. package/lib/typescript/index.d.ts +5 -0
  205. package/lib/typescript/lang/en/components/pick-list.d.ts +6 -0
  206. package/lib/typescript/lang/en/components/picker.d.ts +8 -0
  207. package/lib/typescript/lang/en/english.d.ts +14 -0
  208. package/lib/typescript/lang/nl/components/pick-list.d.ts +6 -0
  209. package/lib/typescript/lang/nl/components/picker.d.ts +8 -0
  210. package/lib/typescript/lang/nl/dutch.d.ts +14 -0
  211. package/lib/typescript/lang/translations.d.ts +2 -0
  212. package/lib/typescript/pick-list/partials/empty-list.d.ts +5 -0
  213. package/lib/typescript/pick-list/partials/pick-group-item.d.ts +6 -0
  214. package/lib/typescript/pick-list/partials/search.d.ts +5 -0
  215. package/lib/typescript/pick-list/pick-list.d.ts +9 -0
  216. package/lib/typescript/pick-list/styles/empty-list-styles.d.ts +9 -0
  217. package/lib/typescript/pick-list/styles/pick-group-item-styles.d.ts +14 -0
  218. package/lib/typescript/pick-list/styles/search-styles.d.ts +24 -0
  219. package/lib/typescript/picker/partials/modal/pick-modal.d.ts +6 -0
  220. package/lib/typescript/picker/partials/modal/pick-quantity-select.d.ts +6 -0
  221. package/lib/typescript/picker/partials/pick-amount.d.ts +1 -0
  222. package/lib/typescript/picker/partials/product-info.d.ts +1 -0
  223. package/lib/typescript/picker/partials/progress-bar.d.ts +5 -0
  224. package/lib/typescript/picker/picker.d.ts +16 -0
  225. package/lib/typescript/picker/styles/pick-amount-styles.d.ts +21 -0
  226. package/lib/typescript/picker/styles/pick-modal-styles.d.ts +71 -0
  227. package/lib/typescript/picker/styles/picker-styles.d.ts +5 -0
  228. package/lib/typescript/picker/styles/product-info-styles.d.ts +17 -0
  229. package/lib/typescript/picker/styles/progress-bar-styles.d.ts +9 -0
  230. package/lib/typescript/shared/api/api-urls.d.ts +7 -0
  231. package/lib/typescript/shared/badge/badge.d.ts +6 -0
  232. package/lib/typescript/shared/badge/styles/badge-styles.d.ts +14 -0
  233. package/lib/typescript/shared/constants.d.ts +15 -0
  234. package/lib/typescript/shared/default-pick-group-item.d.ts +1 -0
  235. package/lib/typescript/shared/layout/data-column.d.ts +7 -0
  236. package/lib/typescript/shared/layout/data-format.d.ts +5 -0
  237. package/lib/typescript/shared/layout/data-row.d.ts +10 -0
  238. package/lib/typescript/shared/layout/styles/layout-styles.d.ts +16 -0
  239. package/lib/typescript/shared/press-button/press-button.d.ts +8 -0
  240. package/package.json +133 -0
  241. package/src/context/picker-context.tsx +117 -0
  242. package/src/context/scan-context.tsx +16 -0
  243. package/src/hooks/use-instance.tsx +23 -0
  244. package/src/hooks/use-pick-item-switch.tsx +55 -0
  245. package/src/hooks/use-picker.tsx +8 -0
  246. package/src/hooks/use-scanner.tsx +33 -0
  247. package/src/index.tsx +5 -0
  248. package/src/lang/en/components/pick-list.ts +6 -0
  249. package/src/lang/en/components/picker.ts +8 -0
  250. package/src/lang/en/english.ts +9 -0
  251. package/src/lang/nl/components/pick-list.ts +6 -0
  252. package/src/lang/nl/components/picker.ts +8 -0
  253. package/src/lang/nl/dutch.ts +9 -0
  254. package/src/lang/translations.ts +9 -0
  255. package/src/pick-list/partials/empty-list.tsx +18 -0
  256. package/src/pick-list/partials/pick-group-item.tsx +45 -0
  257. package/src/pick-list/partials/search.tsx +52 -0
  258. package/src/pick-list/pick-list.tsx +92 -0
  259. package/src/pick-list/styles/empty-list-styles.ts +13 -0
  260. package/src/pick-list/styles/pick-group-item-styles.ts +18 -0
  261. package/src/pick-list/styles/search-styles.ts +28 -0
  262. package/src/picker/partials/modal/pick-modal.tsx +31 -0
  263. package/src/picker/partials/modal/pick-quantity-select.tsx +129 -0
  264. package/src/picker/partials/pick-amount.tsx +23 -0
  265. package/src/picker/partials/product-info.tsx +29 -0
  266. package/src/picker/partials/progress-bar.tsx +39 -0
  267. package/src/picker/picker.tsx +67 -0
  268. package/src/picker/styles/pick-amount-styles.ts +25 -0
  269. package/src/picker/styles/pick-modal-styles.ts +75 -0
  270. package/src/picker/styles/picker-styles.ts +7 -0
  271. package/src/picker/styles/product-info-styles.ts +21 -0
  272. package/src/picker/styles/progress-bar-styles.ts +13 -0
  273. package/src/shared/api/api-urls.ts +9 -0
  274. package/src/shared/badge/badge.tsx +45 -0
  275. package/src/shared/badge/styles/badge-styles.ts +18 -0
  276. package/src/shared/constants.ts +16 -0
  277. package/src/shared/default-pick-group-item.ts +14 -0
  278. package/src/shared/layout/data-column.tsx +22 -0
  279. package/src/shared/layout/data-format.tsx +16 -0
  280. package/src/shared/layout/data-row.tsx +27 -0
  281. package/src/shared/layout/styles/layout-styles.ts +20 -0
  282. package/src/shared/press-button/press-button.tsx +30 -0
  283. package/src/types/badge/badge.d.ts +1 -0
  284. package/src/types/config/config.d.ts +17 -0
  285. package/src/types/control/control.d.ts +6 -0
  286. package/src/types/pick-group/pick-group.d.ts +9 -0
  287. package/src/types/pick-group/search-params.d.ts +4 -0
  288. package/src/types/pick-item/pick-item.d.ts +14 -0
  289. package/src/types/scanner/scanner.d.ts +4 -0
@@ -0,0 +1,6 @@
1
+ export const pickList = {
2
+ 'pick-list.empty-list.loading': 'Retrieving items',
3
+ 'pick-list.empty-list.not-found': 'Nothing found',
4
+ 'pick-list.item.is-picked.true': 'Picked',
5
+ 'pick-list.item.is-picked.false': 'Not Picked',
6
+ };
@@ -0,0 +1,8 @@
1
+ export const picker = {
2
+ 'picker.modal.picked': 'Gepickt',
3
+ 'picker.modal.pick-items': 'Pick items',
4
+ 'picker.modal.not-enough-pick': 'Not everything has been picked',
5
+ 'picker.modal.confirm-error': 'Confirm with the Pick items button',
6
+ 'picker.product-info.barcode': 'Barcode',
7
+ 'picker.product-info.pick-quantity': 'Pick quantity',
8
+ };
@@ -0,0 +1,9 @@
1
+ import {picker} from './components/picker';
2
+ import {pickList} from './components/pick-list';
3
+
4
+ export const englishTranslations = {
5
+ en: {
6
+ ...pickList,
7
+ ...picker,
8
+ },
9
+ };
@@ -0,0 +1,6 @@
1
+ export const pickList = {
2
+ 'pick-list.empty-list.loading': 'Items ophalen',
3
+ 'pick-list.empty-list.not-found': 'Niks gevonden',
4
+ 'pick-list.item.is-picked.true': 'Picked',
5
+ 'pick-list.item.is-picked.false': 'Niet Picked',
6
+ };
@@ -0,0 +1,8 @@
1
+ export const picker = {
2
+ 'picker.modal.picked': 'Gepickt',
3
+ 'picker.modal.pick-items': 'Pick items',
4
+ 'picker.modal.not-enough-pick': 'Niet alles is gepickt',
5
+ 'picker.modal.confirm-error': 'Bevestig met de Pick items knop',
6
+ 'picker.product-info.barcode': 'Barcode',
7
+ 'picker.product-info.pick-quantity': 'Pick aantal',
8
+ };
@@ -0,0 +1,9 @@
1
+ import {picker} from './components/picker';
2
+ import {pickList} from './components/pick-list';
3
+
4
+ export const dutchTranslations = {
5
+ nl: {
6
+ ...pickList,
7
+ ...picker,
8
+ },
9
+ };
@@ -0,0 +1,9 @@
1
+ import {dutchTranslations} from './nl/dutch';
2
+ import {englishTranslations} from './en/english';
3
+
4
+ const translations: Translations = {
5
+ ...englishTranslations,
6
+ ...dutchTranslations,
7
+ };
8
+
9
+ export default translations;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import {Text, View} from 'react-native';
3
+
4
+ import {styles} from '../styles/empty-list-styles';
5
+
6
+ interface props {
7
+ text: string;
8
+ }
9
+
10
+ const {container, text} = styles;
11
+
12
+ export const EmptyList = (props: props): JSX.Element => {
13
+ return (
14
+ <View style={container}>
15
+ <Text style={text}>{props.text}</Text>
16
+ </View>
17
+ );
18
+ };
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import {ListRenderItemInfo, View, Text} from 'react-native';
3
+
4
+ import {useTranslate} from 'react-polyglot';
5
+
6
+ import {usePicker} from 'gatherer-frontend';
7
+ import {Badge} from '../../shared/badge/badge';
8
+ import {styles} from '../styles/pick-group-item-styles';
9
+ import {PressButton} from '../../shared/press-button/press-button';
10
+
11
+ export interface props {
12
+ renderProps: ListRenderItemInfo<PickGroup>;
13
+ onPress?: (pickGroup: PickGroup) => void;
14
+ }
15
+
16
+ const {listItem, label} = styles;
17
+
18
+ export const PickGroupItem = (props: props): JSX.Element => {
19
+ const t = useTranslate();
20
+ const {startPicking} = usePicker();
21
+ const {id, is_picked} = props.renderProps.item;
22
+
23
+ const handlePress = (): void => {
24
+ if (props.onPress) {
25
+ props.onPress(props.renderProps.item);
26
+ return;
27
+ }
28
+
29
+ startPicking(props.renderProps.item.id);
30
+ };
31
+
32
+ return (
33
+ <PressButton style={listItem} onPress={handlePress}>
34
+ <View>
35
+ <Text style={label}>ID</Text>
36
+ <Text>{id}</Text>
37
+ </View>
38
+ <View>
39
+ <Badge variant={is_picked ? 'success' : 'danger'}>
40
+ {t(`pick-list.item.is-picked.${is_picked ? 'true' : 'false'}`)}
41
+ </Badge>
42
+ </View>
43
+ </PressButton>
44
+ );
45
+ };
@@ -0,0 +1,52 @@
1
+ import React, {useEffect, useRef, useState} from 'react';
2
+ import {Pressable, TextInput, View} from 'react-native';
3
+
4
+ import Icon from 'react-native-vector-icons/Ionicons';
5
+
6
+ import {GREY} from '../../shared/constants';
7
+ import {styles} from '../styles/search-styles';
8
+
9
+ interface props {
10
+ onSearch: (text: string) => void;
11
+ }
12
+
13
+ const {container, searchColumn, search, iconColumn} = styles;
14
+
15
+ export const Search = (props: props): JSX.Element => {
16
+ const textInputRef = useRef<TextInput>(null);
17
+ const [searchTerm, setSearchTerm] = useState<string>('');
18
+ const {onSearch} = props;
19
+
20
+ useEffect(() => {
21
+ const handleSearch = setTimeout(() => {
22
+ onSearch(searchTerm);
23
+ }, 500);
24
+
25
+ return () => clearTimeout(handleSearch);
26
+ }, [searchTerm, onSearch]);
27
+
28
+ const handleClear = (): void => {
29
+ textInputRef.current?.clear();
30
+ onSearch('');
31
+ };
32
+
33
+ return (
34
+ <View style={container}>
35
+ <View style={searchColumn}>
36
+ <View style={iconColumn}>
37
+ <Icon name="search-outline" size={20} color={GREY} />
38
+ </View>
39
+ <TextInput
40
+ ref={textInputRef}
41
+ value={searchTerm}
42
+ onChangeText={setSearchTerm}
43
+ style={search}
44
+ placeholder="Zoeken..."
45
+ />
46
+ <Pressable onPress={handleClear} style={iconColumn}>
47
+ <Icon name="close-outline" size={26} color={GREY} />
48
+ </Pressable>
49
+ </View>
50
+ </View>
51
+ );
52
+ };
@@ -0,0 +1,92 @@
1
+ import React, {useCallback, useEffect, useRef, useState} from 'react';
2
+ import {FlatList, ListRenderItem, ListRenderItemInfo, ToastAndroid} from 'react-native';
3
+
4
+ import {useTranslate} from 'react-polyglot';
5
+ import {useDebounce} from '@scrumble-nl/react-custom-hooks';
6
+
7
+ import {Search} from './partials/search';
8
+ import {EmptyList} from './partials/empty-list';
9
+ import {useInstance} from '../hooks/use-instance';
10
+ import {PickGroupItem} from './partials/pick-group-item';
11
+ import {GET_AFTER_PICKLIST_URL, GET_PICKLIST_URL} from '../shared/api/api-urls';
12
+
13
+ interface props {
14
+ isAfterPickList?: boolean;
15
+ renderItem?: ListRenderItem<PickGroup>;
16
+ searchParams?: SearchParams;
17
+ onItemPress?: (pickGroup: PickGroup) => void;
18
+ }
19
+
20
+ export const PickList = (props: props): JSX.Element => {
21
+ const {isAfterPickList, renderItem, searchParams, onItemPress} = props;
22
+ const [loading, setLoading] = useState<boolean>(true);
23
+ const [pickList, setPickList] = useState<PickGroup[]>([]);
24
+ const ignoreCurrentRequest = useRef<boolean>(false);
25
+ const t = useTranslate();
26
+ const instance = useInstance();
27
+ const searchField = useDebounce(searchParams?.searchField, 500);
28
+ const searchValue = useDebounce(searchParams?.searchValue, 500);
29
+
30
+ const getPickList = useCallback(
31
+ (searchFieldParam?: string, searchValueParam?: string): void => {
32
+ const url = isAfterPickList ? GET_AFTER_PICKLIST_URL : GET_PICKLIST_URL;
33
+
34
+ setLoading(true);
35
+
36
+ instance
37
+ .post(url, {
38
+ searchField: searchFieldParam ?? null,
39
+ searchValue: searchValueParam ?? null,
40
+ })
41
+ .then(response => {
42
+ if (!ignoreCurrentRequest.current) {
43
+ setPickList(response.data.pick_groups);
44
+ }
45
+ })
46
+ .catch(error => ToastAndroid.show(error.response.data.error, ToastAndroid.LONG))
47
+ .finally(() => setLoading(false));
48
+ },
49
+ [instance, isAfterPickList],
50
+ );
51
+
52
+ const handleRefresh = useCallback(() => {
53
+ ignoreCurrentRequest.current = false;
54
+
55
+ getPickList();
56
+ }, [getPickList]);
57
+
58
+ useEffect(() => {
59
+ ignoreCurrentRequest.current = false;
60
+
61
+ getPickList(searchField, searchValue);
62
+
63
+ return () => {
64
+ ignoreCurrentRequest.current = true;
65
+ };
66
+ }, [getPickList, instance, searchField, searchValue]);
67
+
68
+ const renderPickGroupItem = (renderProps: ListRenderItemInfo<PickGroup>): JSX.Element => {
69
+ return <PickGroupItem onPress={onItemPress} renderProps={renderProps} />;
70
+ };
71
+
72
+ const handlePickListFromSearch = useCallback(
73
+ (search: string): void => {
74
+ ignoreCurrentRequest.current = false;
75
+
76
+ getPickList('', search);
77
+ },
78
+ [getPickList],
79
+ );
80
+
81
+ return (
82
+ <FlatList
83
+ refreshing={loading}
84
+ onRefresh={handleRefresh}
85
+ data={pickList}
86
+ renderItem={renderItem ?? renderPickGroupItem}
87
+ keyExtractor={pickGroup => pickGroup.id.toString()}
88
+ ListEmptyComponent={<EmptyList text={t(`pick-list.empty-list.${loading ? 'loading' : 'not-found'}`)} />}
89
+ ListHeaderComponent={searchParams ? undefined : <Search onSearch={handlePickListFromSearch} />}
90
+ />
91
+ );
92
+ };
@@ -0,0 +1,13 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ import {BIG_FONT} from '../../shared/constants';
4
+
5
+ export const styles = StyleSheet.create({
6
+ container: {
7
+ marginTop: 25,
8
+ },
9
+ text: {
10
+ textAlign: 'center',
11
+ fontSize: BIG_FONT,
12
+ },
13
+ });
@@ -0,0 +1,18 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ import {SMALL_FONT, WHITE} from '../../shared/constants';
4
+
5
+ export const styles = StyleSheet.create({
6
+ listItem: {
7
+ backgroundColor: WHITE,
8
+ flexDirection: 'row',
9
+ justifyContent: 'space-between',
10
+ padding: 15,
11
+ margin: 5,
12
+ borderRadius: 5,
13
+ elevation: 1,
14
+ },
15
+ label: {
16
+ fontSize: SMALL_FONT,
17
+ },
18
+ });
@@ -0,0 +1,28 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ import {LIGHT_GREY, TEXT_COLOR} from '../../shared/constants';
4
+
5
+ export const styles = StyleSheet.create({
6
+ container: {
7
+ padding: 5,
8
+ flexDirection: 'row',
9
+ alignItems: 'center',
10
+ },
11
+ iconColumn: {
12
+ flex: 0,
13
+ minWidth: 25,
14
+ },
15
+ searchColumn: {
16
+ flex: 1,
17
+ borderRadius: 6,
18
+ backgroundColor: LIGHT_GREY,
19
+ paddingVertical: 3,
20
+ paddingHorizontal: 10,
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ },
24
+ search: {
25
+ flex: 1,
26
+ color: TEXT_COLOR,
27
+ },
28
+ });
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import {Modal, View, Text} from 'react-native';
3
+
4
+ import {useTranslate} from 'react-polyglot';
5
+
6
+ import {styles} from '../../styles/pick-modal-styles';
7
+ import {PickQuantitySelect} from './pick-quantity-select';
8
+
9
+ interface props {
10
+ visible: boolean;
11
+ closeModal: () => void;
12
+ }
13
+
14
+ const {background, container, innerContainer, title} = styles;
15
+
16
+ export const PickModal = (props: props): JSX.Element => {
17
+ const t = useTranslate();
18
+ const {visible, closeModal} = props;
19
+
20
+ return (
21
+ <Modal animationType="fade" transparent visible={visible} onRequestClose={closeModal}>
22
+ <View style={background} />
23
+ <View style={container}>
24
+ <View style={innerContainer}>
25
+ <Text style={title}>{t('picker.modal.picked')}</Text>
26
+ <PickQuantitySelect visible={visible} onPickItems={closeModal} />
27
+ </View>
28
+ </View>
29
+ </Modal>
30
+ );
31
+ };
@@ -0,0 +1,129 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import {TouchableHighlight, View, Text, Pressable} from 'react-native';
3
+
4
+ import {useTranslate} from 'react-polyglot';
5
+ import Icon from 'react-native-vector-icons/Ionicons';
6
+
7
+ import {usePicker} from 'gatherer-frontend';
8
+ import {styles} from '../../styles/pick-modal-styles';
9
+ import {GREY, WHITE} from '../../../shared/constants';
10
+ import {useScanner} from '../../../hooks/use-scanner';
11
+
12
+ interface props {
13
+ visible: boolean;
14
+ onPickItems: () => void;
15
+ }
16
+
17
+ const singlePickThreshold = 10;
18
+ const {amountSelectRow, button, subtractButton, addButton, amountText, pickButton, pickButtonContainer} = styles;
19
+
20
+ export const PickQuantitySelect = (props: props): JSX.Element => {
21
+ const {onPickItems, visible} = props;
22
+ const [selectedQuantity, setSelectedQuantity] = useState<number>(1);
23
+ const [error, setError] = useState<string>('');
24
+ const {pickItem} = usePicker();
25
+ const t = useTranslate();
26
+ const quantityToPick = pickItem.quantity;
27
+
28
+ const subtractOneFromQuantity = (): void => {
29
+ setSelectedQuantity(prevState => {
30
+ if (prevState !== 0) {
31
+ prevState--;
32
+
33
+ return prevState;
34
+ }
35
+
36
+ return prevState;
37
+ });
38
+
39
+ setError('');
40
+ };
41
+
42
+ const addOneToQuantity = (): void => {
43
+ setSelectedQuantity(prevState => {
44
+ if (prevState !== quantityToPick) {
45
+ prevState++;
46
+
47
+ return prevState;
48
+ }
49
+
50
+ return prevState;
51
+ });
52
+
53
+ setError('');
54
+ };
55
+
56
+ const handlePick = (): void => {
57
+ if (selectedQuantity === quantityToPick) {
58
+ exitModal();
59
+ setError('');
60
+ } else {
61
+ setError(t('picker.modal.not-enough-pick'));
62
+ }
63
+ };
64
+
65
+ const handleScan = (scan: string): void => {
66
+ if (quantityToPick >= singlePickThreshold) {
67
+ setError(t('picker.modal.confirm-error'));
68
+ } else if (selectedQuantity >= quantityToPick && pickItem.barcode === scan) {
69
+ exitModal();
70
+ } else if (selectedQuantity !== quantityToPick && pickItem.barcode === scan) {
71
+ handleSuccessScan(selectedQuantity);
72
+ }
73
+ };
74
+
75
+ const handleSuccessScan = (quantity: number): void => {
76
+ const value = quantity++;
77
+ setSelectedQuantity(value);
78
+
79
+ if (value + 1 === quantityToPick) {
80
+ exitModal();
81
+ } else {
82
+ addOneToQuantity();
83
+ }
84
+ };
85
+
86
+ const {startScanner, stopScanner} = useScanner(handleScan);
87
+
88
+ useEffect(() => {
89
+ if (visible) {
90
+ startScanner();
91
+ setSelectedQuantity(quantityToPick < singlePickThreshold ? 1 : quantityToPick);
92
+ }
93
+ }, [visible, quantityToPick, startScanner]);
94
+
95
+ const exitModal = (): void => {
96
+ stopScanner();
97
+ onPickItems();
98
+ };
99
+
100
+ return (
101
+ <View style={amountSelectRow}>
102
+ <TouchableHighlight
103
+ underlayColor={GREY}
104
+ activeOpacity={0.8}
105
+ style={[button, subtractButton]}
106
+ onPress={subtractOneFromQuantity}
107
+ >
108
+ <Icon name="remove-outline" size={25} color={WHITE} />
109
+ </TouchableHighlight>
110
+ <Text style={amountText}>
111
+ {selectedQuantity} / {quantityToPick}
112
+ </Text>
113
+ <TouchableHighlight
114
+ underlayColor={GREY}
115
+ activeOpacity={0.8}
116
+ style={[button, addButton]}
117
+ onPress={addOneToQuantity}
118
+ >
119
+ <Icon name="add-outline" size={25} color={WHITE} />
120
+ </TouchableHighlight>
121
+ <View style={pickButtonContainer}>
122
+ {error !== '' && <Text style={styles.error}>{error}</Text>}
123
+ <Pressable style={pickButton} onPress={handlePick}>
124
+ {t('picker.modal.pick-items')}
125
+ </Pressable>
126
+ </View>
127
+ </View>
128
+ );
129
+ };
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import {View, Text} from 'react-native';
3
+
4
+ import {usePicker} from 'gatherer-frontend';
5
+ import {styles} from '../styles/pick-amount-styles';
6
+
7
+ const {container, pickBoxContainer, pickText} = styles;
8
+
9
+ export const PickAmount = (): JSX.Element => {
10
+ const {pickItem} = usePicker();
11
+
12
+ if (!pickItem.quantity) {
13
+ return <></>;
14
+ }
15
+
16
+ return (
17
+ <View style={container}>
18
+ <View style={pickBoxContainer}>
19
+ <Text style={pickText}>{pickItem.quantity ?? 1}</Text>
20
+ </View>
21
+ </View>
22
+ );
23
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import {View, Text} from 'react-native';
3
+
4
+ import {useTranslate} from 'react-polyglot';
5
+
6
+ import {usePicker} from 'gatherer-frontend';
7
+ import {styles} from '../styles/product-info-styles';
8
+ import {DataRow} from '../../shared/layout/data-row';
9
+
10
+ const {container, productName, productInfo} = styles;
11
+
12
+ export const ProductInfo = (): JSX.Element => {
13
+ const {pickItem} = usePicker();
14
+ const t = useTranslate();
15
+
16
+ return (
17
+ <View style={container}>
18
+ <Text style={productName}>{pickItem?.pickItem.name}</Text>
19
+ <View style={productInfo}>
20
+ <DataRow
21
+ leftTitle={t('picker.product-info.barcode')}
22
+ leftContent={pickItem.barcode}
23
+ rightTitle={t('picker.product-info.pick-quantity')}
24
+ rightContent={pickItem.quantity}
25
+ />
26
+ </View>
27
+ </View>
28
+ );
29
+ };
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import {View, Text} from 'react-native';
3
+
4
+ import {Bar} from 'react-native-progress';
5
+
6
+ import {usePicker} from 'gatherer-frontend';
7
+ import {styles} from '../styles/progress-bar-styles';
8
+ import {LIGHT_GREY, TEXT_COLOR} from '../../shared/constants';
9
+
10
+ export interface progressProps {
11
+ total?: number;
12
+ current?: number;
13
+ }
14
+
15
+ const {progressText} = styles;
16
+
17
+ export const ProgressBar = (props: progressProps): JSX.Element => {
18
+ const {pickItem} = usePicker();
19
+ const totalProducts = (props.total || pickItem.totalPickItems) ?? 1;
20
+ const current = ((props.current || pickItem.pickItemIndex) ?? 0) + 1;
21
+ const progress = current / totalProducts;
22
+
23
+ return (
24
+ <View>
25
+ <Bar
26
+ progress={progress}
27
+ animated
28
+ width={null}
29
+ height={20}
30
+ color={TEXT_COLOR}
31
+ unfilledColor={LIGHT_GREY}
32
+ borderWidth={0}
33
+ />
34
+ <Text style={progressText}>
35
+ {current} / {totalProducts}
36
+ </Text>
37
+ </View>
38
+ );
39
+ };
@@ -0,0 +1,67 @@
1
+ import React, {ReactNode, useCallback, useState} from 'react';
2
+ import {View, ViewStyle} from 'react-native';
3
+
4
+ import {styles} from './styles/picker-styles';
5
+ import {usePicker} from '../hooks/use-picker';
6
+ import {useScanner} from '../hooks/use-scanner';
7
+ import {PickAmount} from './partials/pick-amount';
8
+ import {ProductInfo} from './partials/product-info';
9
+ import {ProgressBar} from './partials/progress-bar';
10
+ import {PickModal} from './partials/modal/pick-modal';
11
+ import {DataRow as Row} from '../shared/layout/data-row';
12
+ import {usePickItemSwitch} from '../hooks/use-pick-item-switch';
13
+ import {DataColumn as Column} from '../shared/layout/data-column';
14
+
15
+ interface props {
16
+ children: ReactNode;
17
+ style?: ViewStyle;
18
+ pickModal?: JSX.Element;
19
+ }
20
+
21
+ const {container} = styles;
22
+
23
+ const Picker = (props: props): JSX.Element => {
24
+ const {pickItem} = usePicker();
25
+ const [pickModalVisible, setPickModalVisible] = useState<boolean>(false);
26
+ const {nextPickItem} = usePickItemSwitch();
27
+
28
+ const closeModal = (): void => {
29
+ startScanner();
30
+ setPickModalVisible(false);
31
+ };
32
+
33
+ const pickModal = props.pickModal ?? <PickModal visible={pickModalVisible} closeModal={closeModal} />;
34
+
35
+ const handleScan = useCallback(
36
+ (scan: string): void => {
37
+ if (scan !== '' && scan === pickItem.barcode) {
38
+ if (pickItem.quantity === 1) {
39
+ nextPickItem(false, 1);
40
+ } else {
41
+ stopScanner();
42
+ setPickModalVisible(true);
43
+ }
44
+ }
45
+ },
46
+ // Adding stopScanner here is not possible because of the useScanner hook implementation
47
+ // eslint-disable-next-line react-hooks/exhaustive-deps
48
+ [pickItem.barcode, pickItem.quantity, nextPickItem],
49
+ );
50
+
51
+ const {startScanner, stopScanner} = useScanner(handleScan);
52
+
53
+ return (
54
+ <View style={[container, props.style]}>
55
+ {pickModal}
56
+ {props.children}
57
+ </View>
58
+ );
59
+ };
60
+
61
+ Picker.Row = Row;
62
+ Picker.Column = Column;
63
+ Picker.Progress = ProgressBar;
64
+ Picker.PickAmount = PickAmount;
65
+ Picker.ProductInfo = ProductInfo;
66
+
67
+ export {Picker};