umwd-components 0.1.714 → 0.1.716

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 (378) hide show
  1. package/README.md +273 -0
  2. package/dist/_virtual/_commonjsHelpers.js +1 -1
  3. package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -1
  4. package/dist/node_modules/@mollie/api-client/dist/mollie.esm.js +1 -1
  5. package/dist/node_modules/axios/index.js +6 -0
  6. package/dist/node_modules/axios/lib/adapters/adapters.js +1 -1
  7. package/dist/node_modules/axios/lib/adapters/fetch.js +1 -1
  8. package/dist/node_modules/axios/lib/adapters/xhr.js +1 -1
  9. package/dist/node_modules/axios/lib/cancel/CancelToken.js +1 -1
  10. package/dist/node_modules/axios/lib/core/Axios.js +1 -1
  11. package/dist/node_modules/axios/lib/core/AxiosError.js +1 -1
  12. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +1 -1
  13. package/dist/node_modules/axios/lib/core/InterceptorManager.js +1 -1
  14. package/dist/node_modules/axios/lib/core/dispatchRequest.js +1 -1
  15. package/dist/node_modules/axios/lib/core/mergeConfig.js +1 -1
  16. package/dist/node_modules/axios/lib/core/transformData.js +1 -1
  17. package/dist/node_modules/axios/lib/defaults/index.js +1 -1
  18. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -1
  19. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +1 -1
  20. package/dist/node_modules/axios/lib/helpers/composeSignals.js +1 -1
  21. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
  22. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +1 -1
  23. package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +1 -1
  24. package/dist/node_modules/axios/lib/helpers/resolveConfig.js +1 -1
  25. package/dist/node_modules/axios/lib/helpers/throttle.js +1 -1
  26. package/dist/node_modules/axios/lib/helpers/toFormData.js +1 -1
  27. package/dist/node_modules/axios/lib/helpers/trackStream.js +1 -1
  28. package/dist/node_modules/axios/lib/helpers/validator.js +1 -1
  29. package/dist/node_modules/axios/lib/platform/index.js +1 -1
  30. package/dist/node_modules/axios/lib/utils.js +1 -1
  31. package/dist/node_modules/call-bind-apply-helpers/actualApply.js +6 -0
  32. package/dist/node_modules/call-bind-apply-helpers/functionApply.js +6 -0
  33. package/dist/node_modules/call-bind-apply-helpers/functionCall.js +6 -0
  34. package/dist/node_modules/call-bind-apply-helpers/index.js +6 -0
  35. package/dist/node_modules/call-bind-apply-helpers/reflectApply.js +6 -0
  36. package/dist/node_modules/call-bound/index.js +6 -0
  37. package/dist/node_modules/dayjs/dayjs.min.js +1 -1
  38. package/dist/node_modules/dunder-proto/get.js +6 -0
  39. package/dist/node_modules/es-define-property/index.js +1 -1
  40. package/dist/{_virtual/index7.js → node_modules/es-object-atoms/index.js} +1 -1
  41. package/dist/node_modules/function-bind/implementation.js +1 -1
  42. package/dist/node_modules/function-bind/index.js +1 -1
  43. package/dist/node_modules/get-intrinsic/index.js +1 -1
  44. package/dist/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  45. package/dist/node_modules/get-proto/Reflect.getPrototypeOf.js +6 -0
  46. package/dist/node_modules/get-proto/index.js +6 -0
  47. package/dist/{_virtual/index5.js → node_modules/gopd/gOPD.js} +1 -1
  48. package/dist/node_modules/gopd/index.js +1 -1
  49. package/dist/node_modules/has-symbols/index.js +1 -1
  50. package/dist/node_modules/has-symbols/shams.js +1 -1
  51. package/dist/node_modules/hasown/index.js +1 -1
  52. package/dist/{_virtual/index8.js → node_modules/math-intrinsics/abs.js} +1 -1
  53. package/dist/{_virtual/types.js → node_modules/math-intrinsics/floor.js} +1 -1
  54. package/dist/node_modules/math-intrinsics/isNaN.js +6 -0
  55. package/dist/{_virtual/index6.js → node_modules/math-intrinsics/max.js} +1 -1
  56. package/dist/node_modules/math-intrinsics/min.js +6 -0
  57. package/dist/node_modules/math-intrinsics/pow.js +6 -0
  58. package/dist/node_modules/math-intrinsics/round.js +6 -0
  59. package/dist/node_modules/math-intrinsics/sign.js +6 -0
  60. package/dist/node_modules/object-assign/index.js +1 -1
  61. package/dist/node_modules/object-inspect/index.js +1 -1
  62. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  63. package/dist/node_modules/prop-types/index.js +1 -1
  64. package/dist/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  65. package/dist/node_modules/qs/lib/index.js +1 -1
  66. package/dist/node_modules/qs/lib/parse.js +1 -1
  67. package/dist/node_modules/qs/lib/stringify.js +1 -1
  68. package/dist/node_modules/qs/lib/utils.js +1 -1
  69. package/dist/node_modules/react-csv/lib/components/Download.js +1 -1
  70. package/dist/node_modules/react-csv/lib/components/Link.js +1 -1
  71. package/dist/node_modules/react-csv/lib/core.js +1 -1
  72. package/dist/node_modules/safe-buffer/index.js +2 -2
  73. package/dist/node_modules/sax/lib/sax.js +1 -1
  74. package/dist/node_modules/side-channel/index.js +1 -1
  75. package/dist/node_modules/side-channel-list/index.js +6 -0
  76. package/dist/node_modules/side-channel-map/index.js +6 -0
  77. package/dist/node_modules/side-channel-weakmap/index.js +6 -0
  78. package/dist/node_modules/string_decoder/lib/string_decoder.js +1 -1
  79. package/dist/node_modules/tslib/tslib.es6.js +1 -1
  80. package/dist/node_modules/uuid/dist/esm-browser/rng.js +1 -1
  81. package/dist/node_modules/uuid/dist/esm-browser/stringify.js +1 -1
  82. package/dist/node_modules/uuid/dist/esm-browser/v4.js +1 -1
  83. package/dist/node_modules/xml-js/lib/js2xml.js +1 -1
  84. package/dist/node_modules/xml-js/lib/xml2json.js +1 -1
  85. package/dist/src/components/ContactForm.js +1 -1
  86. package/dist/src/components/FluidBackground.js +1 -1
  87. package/dist/src/components/LogoutButton.js +1 -1
  88. package/dist/src/components/WebsitePlaceholder.js +1 -1
  89. package/dist/src/components/ZodErrors.js +1 -1
  90. package/dist/src/components/auth/AuthWidget.js +1 -1
  91. package/dist/src/components/common/Address.js +1 -1
  92. package/dist/src/components/common/AmountUpdater.js +1 -1
  93. package/dist/src/components/common/EnhancedTable/EnhancedTable.js +1 -1
  94. package/dist/src/components/common/EnhancedTable/EnhancedTableFilterRow.js +1 -1
  95. package/dist/src/components/common/EnhancedTable/EnhancedTableHead.js +1 -1
  96. package/dist/src/components/common/EnhancedTable/EnhancedTableRow.js +1 -1
  97. package/dist/src/components/common/EnhancedTable/EnhancedTableToolbar.js +1 -1
  98. package/dist/src/components/common/NumberInput.js +1 -1
  99. package/dist/src/components/common/WeekPicker.js +1 -1
  100. package/dist/src/components/common/cookie-consent/CookieConsentContext.js +1 -1
  101. package/dist/src/components/common/csv/CsvDownloader.js +1 -1
  102. package/dist/src/components/common/media/MediaGrid.js +1 -1
  103. package/dist/src/components/common/media/MediaLibraryDialog.js +1 -1
  104. package/dist/src/components/common/media/UploadBase64MediaForm.js +1 -1
  105. package/dist/src/components/common/media/UploadMediaForm.js +1 -1
  106. package/dist/src/components/common/snackbar/GlobalSnackbar.js +1 -1
  107. package/dist/src/components/e-commerce/cart/CartSummary.js +1 -1
  108. package/dist/src/components/e-commerce/cart/hooks.js +1 -1
  109. package/dist/src/components/e-commerce/categories/AddCategoryForm.js +1 -1
  110. package/dist/src/components/e-commerce/categories/CategorySelectorV2.js +1 -1
  111. package/dist/src/components/e-commerce/categories/EditCategoryForm.js +1 -1
  112. package/dist/src/components/e-commerce/checkout/CheckoutForm.js +1 -1
  113. package/dist/src/components/e-commerce/checkout/Step2.js +1 -1
  114. package/dist/src/components/e-commerce/checkout/Step4.js +1 -1
  115. package/dist/src/components/e-commerce/checkout/Step5.js +1 -1
  116. package/dist/src/components/e-commerce/customer/BusinessCredentials.js +1 -1
  117. package/dist/src/components/e-commerce/customer/CustomerCompletenessWarning.js +1 -1
  118. package/dist/src/components/e-commerce/customer/CustomerProfileDisplay.js +1 -1
  119. package/dist/src/components/e-commerce/customer/CustomerProfileEditForm.js +1 -1
  120. package/dist/src/components/e-commerce/customer/CustomerSelector.js +1 -1
  121. package/dist/src/components/e-commerce/enduser/EnduserProfileEditForm.js +1 -1
  122. package/dist/src/components/e-commerce/invoice/CreateInvoiceForm.js +1 -1
  123. package/dist/src/components/e-commerce/invoice/InvoiceItemFields.js +1 -1
  124. package/dist/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
  125. package/dist/src/components/e-commerce/iro/CreateIROForm.js +1 -1
  126. package/dist/src/components/e-commerce/iro/IROItemFields.js +1 -1
  127. package/dist/src/components/e-commerce/iro/IroItemDisplay.js +1 -1
  128. package/dist/src/components/e-commerce/iro/IroItemUpdater.js +1 -1
  129. package/dist/src/components/e-commerce/iro/IroStatusIndicator.js +1 -1
  130. package/dist/src/components/e-commerce/iro/ManageIROForm.js +1 -1
  131. package/dist/src/components/e-commerce/iro/RmaForm.js +1 -1
  132. package/dist/src/components/e-commerce/iro/TextualIROItemUpdater.js +1 -1
  133. package/dist/src/components/e-commerce/iro/TextualManageIROForm.js +1 -1
  134. package/dist/src/components/e-commerce/opo/CreateOpoForm.js +1 -1
  135. package/dist/src/components/e-commerce/opo/ManageOpoForm.js +1 -1
  136. package/dist/src/components/e-commerce/opo/OPOItemFields.js +1 -1
  137. package/dist/src/components/e-commerce/opo/OpoItemDisplay.js +1 -1
  138. package/dist/src/components/e-commerce/opo/OpoItemUpdater.js +1 -1
  139. package/dist/src/components/e-commerce/opo/OpoStatusIndicator.js +1 -1
  140. package/dist/src/components/e-commerce/opo/OpoSummary.js +1 -1
  141. package/dist/src/components/e-commerce/opo/PaymentStatusIndicator.js +1 -1
  142. package/dist/src/components/e-commerce/opo/TextualManageOpoForm.js +1 -1
  143. package/dist/src/components/e-commerce/opo/TextualOpoItemUpdater.js +1 -1
  144. package/dist/src/components/e-commerce/products/AddProductForm.js +1 -1
  145. package/dist/src/components/e-commerce/products/EditProductForm.js +1 -1
  146. package/dist/src/components/e-commerce/products/EditStockForm.js +1 -1
  147. package/dist/src/components/e-commerce/products/PriceFields.js +1 -1
  148. package/dist/src/components/e-commerce/products/ProductCategoryCard.js +1 -1
  149. package/dist/src/components/e-commerce/products/ProductSelector.js +1 -1
  150. package/dist/src/components/e-commerce/products/SingleProduct.js +1 -1
  151. package/dist/src/components/layout/Footer.js +1 -1
  152. package/dist/src/components/layout/Navbar.js +1 -1
  153. package/dist/src/components/layout/NavbarV2.js +1 -1
  154. package/dist/src/components/layout/SideNav.js +1 -1
  155. package/dist/src/components/logistics/dispatcher/DispatcherProfileEditForm.js +1 -1
  156. package/dist/src/components/logistics/ipo/AddIPOForm.js +1 -1
  157. package/dist/src/components/logistics/ipo/IPOItemFields.js +1 -1
  158. package/dist/src/components/logistics/ipo/IPOItemUpdater.js +1 -1
  159. package/dist/src/components/logistics/ipo/IpoStatusIndicator.js +1 -1
  160. package/dist/src/components/logistics/ipo/ManageIPOForm.js +1 -1
  161. package/dist/src/components/logistics/ipo/TextualIPOItemUpdater.js +1 -1
  162. package/dist/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
  163. package/dist/src/components/logistics/note/NoteTakingComponent.js +1 -1
  164. package/dist/src/components/logistics/note/NotesDisplay.js +1 -1
  165. package/dist/src/components/logistics/report/PreReportsDisplay.js +1 -1
  166. package/dist/src/components/logistics/report/ReportMakingComponent.js +1 -1
  167. package/dist/src/components/logistics/report/ReportsDisplay.js +1 -1
  168. package/dist/src/components/logistics/vendor/AddVendorForm.js +1 -1
  169. package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
  170. package/dist/src/components/logistics/vendor/VendorDisplay.js +1 -1
  171. package/dist/src/components/logistics/vendor/VendorSelector.js +1 -1
  172. package/dist/src/components/page-builder/ColumnsSection.js +1 -1
  173. package/dist/src/components/page-builder/FleetSection.js +1 -1
  174. package/dist/src/components/page-builder/IconSection.js +1 -1
  175. package/dist/src/components/page-builder/LogoBarSection.js +1 -1
  176. package/dist/src/components/page-builder/PBFeaturesSection.js +1 -1
  177. package/dist/src/components/page-builder/PBPersonaliaSection.js +1 -1
  178. package/dist/src/components/page-builder/PBTextImageSection.js +1 -1
  179. package/dist/src/components/page-builder/PictureBarSection.js +1 -1
  180. package/dist/src/components/page-elements/CategoryBlock.js +1 -1
  181. package/dist/src/components/page-elements/ColumnsSection.js +1 -1
  182. package/dist/src/components/page-elements/FeaturesSection.js +1 -1
  183. package/dist/src/components/page-elements/FleetSection.js +1 -1
  184. package/dist/src/components/page-elements/IconSection.js +1 -1
  185. package/dist/src/components/page-elements/LogoBarSection.js +1 -1
  186. package/dist/src/components/page-elements/PersonaliaSection.js +1 -1
  187. package/dist/src/components/page-elements/PictureBarSection.js +1 -1
  188. package/dist/src/components/page-elements/TextImageSection.js +1 -1
  189. package/dist/src/components/public-information/PublicInformationForm.js +1 -1
  190. package/dist/src/context/auth/SessionContext.js +1 -1
  191. package/dist/src/context/common/SnackbarContext.js +1 -1
  192. package/dist/src/context/e-commerce/cart/CartContext.js +1 -1
  193. package/dist/src/context/e-commerce/checkout/CheckoutContext.js +1 -1
  194. package/dist/src/data/actions/auth-actions.js +1 -1
  195. package/dist/src/data/actions/e-commerce/categories/createCategoryAction.js +1 -1
  196. package/dist/src/data/actions/e-commerce/categories/updateCategoryAction.js +1 -1
  197. package/dist/src/data/actions/e-commerce/checkout-action.js +1 -1
  198. package/dist/src/data/actions/e-commerce/enduser/profile-actions.js +1 -1
  199. package/dist/src/data/actions/e-commerce/invoices/createInvoiceAction.js +1 -1
  200. package/dist/src/data/actions/e-commerce/iro/createIroAction.js +1 -1
  201. package/dist/src/data/actions/e-commerce/iro/requestRmaAction.js +1 -1
  202. package/dist/src/data/actions/e-commerce/iro/updateIroAction.js +1 -1
  203. package/dist/src/data/actions/e-commerce/opo/createOpoAction.js +1 -1
  204. package/dist/src/data/actions/e-commerce/opo/updateOpoAction.js +1 -1
  205. package/dist/src/data/actions/e-commerce/product/createProductAction.js +1 -1
  206. package/dist/src/data/actions/e-commerce/product/updateProductAction.js +1 -1
  207. package/dist/src/data/actions/logistics/dispatcher/profile-actions.js +1 -1
  208. package/dist/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
  209. package/dist/src/data/actions/logistics/ipo/updateIpoAction.js +1 -1
  210. package/dist/src/data/actions/logistics/note/createNoteAction.js +1 -1
  211. package/dist/src/data/actions/logistics/report/createReportAction.js +1 -1
  212. package/dist/src/data/actions/logistics/vendor/createVendorAction.js +1 -1
  213. package/dist/src/data/actions/logistics/vendor/updateVendorAction.js +1 -1
  214. package/dist/src/data/actions/media/updateMediaAction.js +1 -1
  215. package/dist/src/data/actions/media/uploadBase64MediaAction.js +1 -1
  216. package/dist/src/data/actions/media/uploadMediaAction.js +1 -1
  217. package/dist/src/data/actions/pagebuilder-actions.js +1 -1
  218. package/dist/src/data/actions/profile-actions.js +1 -1
  219. package/dist/src/data/actions/public-information/updatePublicInformationAction.js +1 -1
  220. package/dist/src/data/loaders/common/media/downloadBase64File.js +1 -1
  221. package/dist/src/data/loaders/common/media/getAllMedia.js +1 -1
  222. package/dist/src/data/loaders/e-commerce/getAllCategoryNames.js +1 -1
  223. package/dist/src/data/loaders/e-commerce/getAllCustomers.js +1 -1
  224. package/dist/src/data/loaders/e-commerce/getAllInvoices.js +1 -1
  225. package/dist/src/data/loaders/e-commerce/getAllOpos.js +1 -1
  226. package/dist/src/data/loaders/e-commerce/getCustomerLabels.js +1 -1
  227. package/dist/src/data/loaders/e-commerce/getCustomerModel.js +1 -1
  228. package/dist/src/data/loaders/e-commerce/getOpoModel.js +1 -1
  229. package/dist/src/data/loaders/e-commerce/getPaginatedCategories.js +1 -1
  230. package/dist/src/data/loaders/e-commerce/getProductModel.js +1 -1
  231. package/dist/src/data/loaders/e-commerce/getProductNames.js +1 -1
  232. package/dist/src/data/loaders/e-commerce/getShop.js +1 -1
  233. package/dist/src/data/loaders/e-commerce/getSingleCategory.js +1 -1
  234. package/dist/src/data/loaders/e-commerce/getSingleCustomer.js +1 -1
  235. package/dist/src/data/loaders/e-commerce/getSingleOpo.js +1 -1
  236. package/dist/src/data/loaders/e-commerce/getSingleProduct.js +1 -1
  237. package/dist/src/data/loaders/e-commerce/getSingleStock.js +1 -1
  238. package/dist/src/data/loaders/e-commerce/getTableProducts.js +1 -1
  239. package/dist/src/data/loaders/e-commerce/iros/getAllIros.js +1 -1
  240. package/dist/src/data/loaders/e-commerce/iros/getIroModel.js +1 -1
  241. package/dist/src/data/loaders/e-commerce/iros/getSingleIro.js +1 -1
  242. package/dist/src/data/loaders/e-commerce/iros/queryAllIros.js +1 -1
  243. package/dist/src/data/loaders/e-commerce/queryAllCustomers.js +1 -1
  244. package/dist/src/data/loaders/e-commerce/queryAllOpos.js +1 -1
  245. package/dist/src/data/loaders/e-commerce/queryAllProducts.js +1 -1
  246. package/dist/src/data/loaders/e-commerce-loaders.js +1 -1
  247. package/dist/src/data/loaders/loaders.js +1 -1
  248. package/dist/src/data/loaders/logistics/getIpoModel.js +1 -1
  249. package/dist/src/data/loaders/logistics/getIpoNames.js +1 -1
  250. package/dist/src/data/loaders/logistics/getSingleIpo.js +1 -1
  251. package/dist/src/data/loaders/logistics/getSingleVendor.js +1 -1
  252. package/dist/src/data/loaders/logistics/getTableIpos.js +1 -1
  253. package/dist/src/data/loaders/logistics/getTableVendors.js +1 -1
  254. package/dist/src/data/loaders/logistics/getVendorModel.js +1 -1
  255. package/dist/src/data/loaders/logistics/getVendorNames.js +1 -1
  256. package/dist/src/data/loaders/logistics/queryAllIpos.js +1 -1
  257. package/dist/src/data/loaders/logistics/queryAllVendors.js +1 -1
  258. package/dist/src/data/loaders/page-builder/getTablePages.js +1 -1
  259. package/dist/src/data/loaders/page-elements/getSinglePage.js +1 -1
  260. package/dist/src/data/loaders/public-information/getPublicInformation.js +1 -1
  261. package/dist/src/data/loaders/user/getUserMeLoader.js +1 -1
  262. package/dist/src/data/services/archive-service.js +1 -1
  263. package/dist/src/data/services/auth-service.js +1 -1
  264. package/dist/src/data/services/common/cancellation-service.js +1 -1
  265. package/dist/src/data/services/common/confirmation-service.js +1 -1
  266. package/dist/src/data/services/e-commerce/enduser/get-enduser-me-loader.js +1 -1
  267. package/dist/src/data/services/file-service.js +1 -1
  268. package/dist/src/data/services/get-token.js +1 -1
  269. package/dist/src/data/services/get-user-me-loader.js +1 -1
  270. package/dist/src/data/services/logistics/dispatcher/get-dispatcher-me-loader.js +1 -1
  271. package/dist/src/data/services/mutate-data.js +1 -1
  272. package/dist/src/lib/eoriValidate.js +1 -1
  273. package/dist/src/lib/molliePaymentProvider.js +1 -1
  274. package/dist/src/lib/parseNavigation.js +1 -1
  275. package/dist/src/lib/processFilters.js +1 -1
  276. package/dist/src/lib/utils.js +1 -1
  277. package/dist/src/lib/vatValidate.js +1 -1
  278. package/dist/tsconfig.build.tsbuildinfo +1 -1
  279. package/dist/types/components/StrapiErrors.d.ts +2 -2
  280. package/dist/types/components/e-commerce/cart/hooks.d.ts +2 -3
  281. package/dist/types/components/e-commerce/products/AddProductForm.d.ts +3 -3
  282. package/dist/types/lib/getIcon.d.ts +0 -1
  283. package/dist/types/types/StrapiImageProps.d.ts +0 -1
  284. package/dist/types/types/common/Contact.d.ts +0 -1
  285. package/dist/types/types/common/Socials.d.ts +0 -1
  286. package/dist/types/types/common/enhancedTable/types.d.ts +0 -1
  287. package/package.json +15 -25
  288. package/postcss.config.js +5 -6
  289. package/rollup.config.mjs +9 -0
  290. package/src/components/Logo.tsx +20 -9
  291. package/src/components/LogoutButton.tsx +1 -29
  292. package/src/components/StrapiErrors.tsx +5 -1
  293. package/src/components/e-commerce/invoice/InvoicePDF.tsx +54 -48
  294. package/src/components/e-commerce/iro/ManageIROForm.tsx +3 -3
  295. package/src/components/e-commerce/opo/ManageOpoForm.tsx +7 -2
  296. package/src/components/e-commerce/opo/OpoItemUpdater.tsx +16 -6
  297. package/src/index.ts +327 -327
  298. package/src/lib/APIcon.svg +6 -6
  299. package/src/lib/utils.ts +0 -7
  300. package/src/styles/globals.css +2 -3
  301. package/tsconfig.json +24 -34
  302. package/.storybook/main.js +0 -26
  303. package/.storybook/preview.js +0 -50
  304. package/dist/_virtual/inherits_browser.js +0 -6
  305. package/dist/_virtual/punycode.js +0 -6
  306. package/dist/_virtual/url.js +0 -6
  307. package/dist/_virtual/util.js +0 -6
  308. package/dist/node_modules/available-typed-arrays/index.js +0 -6
  309. package/dist/node_modules/base64-js/index.js +0 -6
  310. package/dist/node_modules/buffer/index.js +0 -12
  311. package/dist/node_modules/call-bind/callBound.js +0 -6
  312. package/dist/node_modules/call-bind/index.js +0 -6
  313. package/dist/node_modules/define-data-property/index.js +0 -6
  314. package/dist/node_modules/for-each/index.js +0 -6
  315. package/dist/node_modules/has-property-descriptors/index.js +0 -6
  316. package/dist/node_modules/has-proto/index.js +0 -6
  317. package/dist/node_modules/has-tostringtag/shams.js +0 -6
  318. package/dist/node_modules/ieee754/index.js +0 -7
  319. package/dist/node_modules/inherits/inherits_browser.js +0 -6
  320. package/dist/node_modules/is-arguments/index.js +0 -6
  321. package/dist/node_modules/is-callable/index.js +0 -6
  322. package/dist/node_modules/is-generator-function/index.js +0 -6
  323. package/dist/node_modules/is-typed-array/index.js +0 -6
  324. package/dist/node_modules/set-function-length/index.js +0 -6
  325. package/dist/node_modules/url/node_modules/punycode/punycode.js +0 -7
  326. package/dist/node_modules/url/url.js +0 -6
  327. package/dist/node_modules/util/support/isBufferBrowser.js +0 -6
  328. package/dist/node_modules/util/support/types.js +0 -6
  329. package/dist/node_modules/util/util.js +0 -6
  330. package/dist/node_modules/which-typed-array/index.js +0 -6
  331. package/dist/types/app/checkout/layout.d.ts +0 -4
  332. package/dist/types/app/checkout/page.d.ts +0 -3
  333. package/dist/types/app/layout.d.ts +0 -8
  334. package/dist/types/app/page.d.ts +0 -2
  335. package/dist/types/components/e-commerce/cart/CartWidgetOld.d.ts +0 -9
  336. package/next-env.d.ts +0 -5
  337. package/next.config.js +0 -18
  338. package/public/AMH/BulletSVG.svg +0 -9
  339. package/public/AMH/desktop_wallpaper@0.25x.png +0 -0
  340. package/public/Logo.svg +0 -6
  341. package/public/favicon.ico +0 -0
  342. package/public/index.html +0 -43
  343. package/public/logo.png +0 -0
  344. package/public/logo_decorated.png +0 -0
  345. package/public/logo_text.png +0 -0
  346. package/public/logo_thick.png +0 -0
  347. package/public/manifest.json +0 -25
  348. package/public/placeholders/fullscreen_1920X1080.png +0 -0
  349. package/public/placeholders/highres_2400X1600.png +0 -0
  350. package/public/placeholders/large_1200X800.png +0 -0
  351. package/public/placeholders/medium_600X400.png +0 -0
  352. package/public/placeholders/small_300X200.png +0 -0
  353. package/public/placeholders/thumbnail_100X100.png +0 -0
  354. package/public/robots.txt +0 -3
  355. package/readme.MD +0 -0
  356. package/rollup.config copy.mjs +0 -80
  357. package/src/app/checkout/layout.tsx +0 -28
  358. package/src/app/checkout/page.tsx +0 -9
  359. package/src/app/layout.tsx +0 -16
  360. package/src/app/page.tsx +0 -38
  361. package/src/stories/ContactForm.stories.js +0 -13
  362. package/src/stories/FeatureSection.stories.js +0 -86
  363. package/src/stories/FluidBackground.stories.js +0 -29
  364. package/src/stories/Footer.stories.js +0 -130
  365. package/src/stories/HeroSection.stories.js +0 -101
  366. package/src/stories/LogoutButton.stories.js +0 -15
  367. package/src/stories/Page.stories.js +0 -536
  368. package/src/stories/PageBuilder.stories.js +0 -396
  369. package/src/stories/RegisterForm.stories.js +0 -13
  370. package/src/stories/ScrollNavbar.stories.js +0 -121
  371. package/src/stories/SideNav.stories.js +0 -47
  372. package/src/stories/SigninForm.stories.js +0 -13
  373. package/src/stories/StrapiImage.stories.js +0 -23
  374. package/src/stories/TextImageSection.stories.js +0 -73
  375. package/src/stories/WebsitePlaceholder.stories.js +0 -178
  376. package/src/stories/WhatsAppClickToChatButton.stories.js +0 -69
  377. package/src/stories/styles.css +0 -39
  378. package/tailwind.config.ts +0 -80
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as c,Page as r,View as i,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import y from"@mui/material/Dialog";import E from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var _=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function f(e){var l,n,o,d,s,y,E,v,p,S,f,w,x,b,R,z,T,A,h,F,g,I=e.props.invoice;console.log("invoice from invoicePDF",I);var V=I.seller_business_credentials,N=I.seller_company_address,L=I.buyer_company_address,C=I.buyer_business_credentials,D=I.type;return I.invoice_number,console.log("type",D),"credit"===D?m.createElement(c,{title:"credit_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"CREDIT NOTE")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(l=null==I?void 0:I.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==I?void 0:I.items)||void 0===n?void 0:n.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(o=null==I?void 0:I.admin_items)||void 0===o?void 0:o.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(d=null==I?void 0:I.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(s=null==I?void 0:I.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(y=null==I?void 0:I.total_incl_vat)||void 0===y?void 0:y.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total: € ",null===(E=null==I?void 0:I.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))):"proforma"===D?m.createElement(c,{title:"proforma_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"PROFORMA INVOICE"),m.createElement(a,{style:{fontSize:10,marginTop:5}},"This is not a final invoice and cannot be used for tax purposes")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(v=null==I?void 0:I.admin_items)||void 0===v?void 0:v.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(p=null==I?void 0:I.items)||void 0===p?void 0:p.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(S=null==I?void 0:I.admin_items)||void 0===S?void 0:S.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(f=null==I?void 0:I.VAT_total)||void 0===f?void 0:f.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(w=null==I?void 0:I.total_excl_vat)||void 0===w?void 0:w.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(x=null==I?void 0:I.total_incl_vat)||void 0===x?void 0:x.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(b=null==I?void 0:I.total_incl_vat)||void 0===b?void 0:b.toFixed(2))))):m.createElement(c,{title:"invoice_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"INVOICE")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(R=null==I?void 0:I.admin_items)||void 0===R?void 0:R.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(z=null==I?void 0:I.items)||void 0===z?void 0:z.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(T=null==I?void 0:I.admin_items)||void 0===T?void 0:T.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(A=null==I?void 0:I.VAT_total)||void 0===A?void 0:A.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(h=null==I?void 0:I.total_excl_vat)||void 0===h?void 0:h.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(F=null==I?void 0:I.total_incl_vat)||void 0===F?void 0:F.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(g=null==I?void 0:I.total_incl_vat)||void 0===g?void 0:g.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),c=n[0],r=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return r(!0)}},m.createElement(S,null)),m.createElement(y,{open:c,fullWidth:!0,maxWidth:"lg"},m.createElement(E,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(f,{props:{invoice:l}}))),m.createElement(v,null,m.createElement(p,{variant:"contained",onClick:function(){return r(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
7
+ import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as c,Page as i,View as r,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var _=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontWeight:"bold"},h3:{fontSize:16,fontWeight:"bold"}});function f(e){var l,n,o,d,s,E,y,v,p,S,f,w,x,b,R,h,g,z,T,W,A,F=e.props.invoice;console.log("invoice from invoicePDF",F);var I=F.seller_business_credentials,V=F.seller_company_address,N=F.buyer_company_address,L=F.buyer_business_credentials,C=F.type;return F.invoice_number,console.log("type",C),"credit"===C?m.createElement(c,{title:"credit_".concat(null==F?void 0:F.invoice_number)},m.createElement(i,{size:"A4",style:_.page},m.createElement(r,{style:_.header},m.createElement(a,{style:_.h1},null==I?void 0:I.company_name)),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h2},"CREDIT NOTE")),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==L?void 0:L.company_name),m.createElement(a,null,null==F?void 0:F.buyer_first_name," ",null==F?void 0:F.buyer_last_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==I?void 0:I.company_name),m.createElement(a,null,null==V?void 0:V.street," ",null==V?void 0:V.street_number," ",null==V?void 0:V.street_number_addition),m.createElement(a,null,null==V?void 0:V.postal_code," ",null==V?void 0:V.city),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==I?void 0:I.coc_number),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==I?void 0:I.vat_number)))),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice number: "),m.createElement(a,null,null==F?void 0:F.invoice_number)),(null==F?void 0:F.customer_reference)&&m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Your reference: "),m.createElement(a,null,null==F?void 0:F.customer_reference)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice date"),m.createElement(a,null,null==F?void 0:F.invoice_date)))),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(r,{style:_.row},(null===(l=null==F?void 0:F.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Line Item Number")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Title")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Amount")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT rate")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Incl. VAT"))),null===(n=null==F?void 0:F.items)||void 0===n?void 0:n.map(function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(r,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))}),null===(o=null==F?void 0:F.admin_items)||void 0===o?void 0:o.map(function(e,t){var l,n,o,c,i,d,s;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))})),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Incl. VAT"))),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(d=null==F?void 0:F.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(s=null==F?void 0:F.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(E=null==F?void 0:F.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))),m.createElement(r,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total: € ",null===(y=null==F?void 0:F.total_incl_vat)||void 0===y?void 0:y.toFixed(2))))):"proforma"===C?m.createElement(c,{title:"proforma_".concat(null==F?void 0:F.invoice_number)},m.createElement(i,{size:"A4",style:_.page},m.createElement(r,{style:_.header},m.createElement(a,{style:_.h1},null==I?void 0:I.company_name)),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h2},"PROFORMA INVOICE"),m.createElement(a,{style:{fontSize:10,marginTop:5}},"This is not a final invoice and cannot be used for tax purposes")),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==L?void 0:L.company_name),m.createElement(a,null,null==F?void 0:F.buyer_first_name," ",null==F?void 0:F.buyer_last_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==I?void 0:I.company_name),m.createElement(a,null,null==V?void 0:V.street," ",null==V?void 0:V.street_number," ",null==V?void 0:V.street_number_addition),m.createElement(a,null,null==V?void 0:V.postal_code," ",null==V?void 0:V.city),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==I?void 0:I.coc_number),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==I?void 0:I.vat_number)))),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice number: "),m.createElement(a,null,null==F?void 0:F.invoice_number)),(null==F?void 0:F.customer_reference)&&m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Your reference: "),m.createElement(a,null,null==F?void 0:F.customer_reference)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice date"),m.createElement(a,null,null==F?void 0:F.invoice_date)))),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(r,{style:_.row},(null===(v=null==F?void 0:F.admin_items)||void 0===v?void 0:v.length)>0&&m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Line Item Number")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Title")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Amount")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT rate")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Incl. VAT"))),null===(p=null==F?void 0:F.items)||void 0===p?void 0:p.map(function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(r,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))}),null===(S=null==F?void 0:F.admin_items)||void 0===S?void 0:S.map(function(e,t){var l,n,o,c,i,d,s;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))})),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Incl. VAT"))),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(f=null==F?void 0:F.VAT_total)||void 0===f?void 0:f.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(w=null==F?void 0:F.total_excl_vat)||void 0===w?void 0:w.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(x=null==F?void 0:F.total_incl_vat)||void 0===x?void 0:x.toFixed(2))))),m.createElement(r,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(b=null==F?void 0:F.total_incl_vat)||void 0===b?void 0:b.toFixed(2))))):m.createElement(c,{title:"invoice_".concat(null==F?void 0:F.invoice_number)},m.createElement(i,{size:"A4",style:_.page},m.createElement(r,{style:_.header},m.createElement(a,{style:_.h1},null==I?void 0:I.company_name)),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h2},"INVOICE")),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==L?void 0:L.company_name),m.createElement(a,null,null==F?void 0:F.buyer_first_name," ",null==F?void 0:F.buyer_last_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==I?void 0:I.company_name),m.createElement(a,null,null==V?void 0:V.street," ",null==V?void 0:V.street_number," ",null==V?void 0:V.street_number_addition),m.createElement(a,null,null==V?void 0:V.postal_code," ",null==V?void 0:V.city),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==I?void 0:I.coc_number),m.createElement(a,{style:{fontWeight:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==I?void 0:I.vat_number)))),m.createElement(r,{style:_.section},m.createElement(r,{style:_.row},m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice number: "),m.createElement(a,null,null==F?void 0:F.invoice_number)),(null==F?void 0:F.customer_reference)&&m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Your reference: "),m.createElement(a,null,null==F?void 0:F.customer_reference)),m.createElement(r,{style:_.rowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Invoice date"),m.createElement(a,null,null==F?void 0:F.invoice_date)))),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(r,{style:_.row},(null===(R=null==F?void 0:F.admin_items)||void 0===R?void 0:R.length)>0&&m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Line Item Number")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Title")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Amount")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT rate")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontWeight:"bold"}},"Incl. VAT"))),null===(h=null==F?void 0:F.items)||void 0===h?void 0:h.map(function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(r,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))}),null===(g=null==F?void 0:F.admin_items)||void 0===g?void 0:g.map(function(e,t){var l,n,o,c,i,d,s;return m.createElement(u,{key:t},m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))})),m.createElement(r,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Excl. VAT")),m.createElement(r,{style:_.productRowSection},m.createElement(a,{style:{fontWeight:"bold"}},"Incl. VAT"))),m.createElement(r,{style:_.row},m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection}),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(z=null==F?void 0:F.VAT_total)||void 0===z?void 0:z.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(T=null==F?void 0:F.total_excl_vat)||void 0===T?void 0:T.toFixed(2))),m.createElement(r,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(W=null==F?void 0:F.total_incl_vat)||void 0===W?void 0:W.toFixed(2))))),m.createElement(r,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(A=null==F?void 0:F.total_incl_vat)||void 0===A?void 0:A.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),c=n[0],i=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return i(!0)}},m.createElement(S,null)),m.createElement(E,{open:c,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(f,{props:{invoice:l}}))),m.createElement(v,null,m.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as n}from"react";import{useFormState as o}from"react-dom";import{useSnackbar as m}from"../../../context/common/SnackbarContext.js";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{SubmitButton as s}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{IROItemFields as l}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import E from"@mui/material/TextField";import f from"@mui/material/Checkbox";import h from"@mui/material/Stack";import g from"@mui/material/Button";var v={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function y(y){var x=y.sx,C=y.revalidateCallback,b=y.handleClose,w=y.customerLabels,I=y.productLabels,j=e(a(!1),2),k=j[0],A=j[1],S=e(o(i,v),2),L=S[0],B=S[1],T=m().handleAddMessage;return n((function(){(null==L?void 0:L.message)&&(T({message:L.message,severity:L.severity||"error"}),"success"===L.severity&&(C&&C(),b&&b()))}),[null==L?void 0:L.message]),n((function(){(null==L?void 0:L.strapiErrors)&&T({message:L.strapiErrors.message||"Error creating return order",severity:L.severity||"error"})}),[null==L?void 0:L.strapiErrors]),t.createElement(p,{sx:r([],e(Array.isArray(x)?x:[x]),!1)},t.createElement("form",{action:B},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h3",component:"h1"},"Create new return order"))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(u,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(c,{customerLabels:w}))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(E,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(l,{productsArr:I})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),t.createElement(h,{direction:"row",spacing:1,alignItems:"center"},t.createElement(f,{value:k,checked:k,onChange:function(){return A(!k)}}),k&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this return order")),t.createElement("input",{name:"status",type:"hidden",value:k?"returning":"requested"}))," ",t.createElement(d,{item:!0,xs:12},t.createElement(h,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2}},b&&t.createElement(g,{onClick:b,variant:"outlined"},"Cancel"),t.createElement(s,{text:"Confirm",loadingText:"Loading...",variant:"contained"}))))))}export{y as default};
7
+ import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as n}from"react";import{useFormState as o}from"react-dom";import{useSnackbar as m}from"../../../context/common/SnackbarContext.js";import{createIroAction as i}from"../../../data/actions/e-commerce/iro/createIroAction.js";import{SubmitButton as s}from"../../SubmitButton.js";import{CustomerSelector as c}from"../customer/CustomerSelector.js";import{IROItemFields as l}from"./IROItemFields.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import E from"@mui/material/TextField";import f from"@mui/material/Checkbox";import h from"@mui/material/Stack";import g from"@mui/material/Button";var v={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function y(y){var x=y.sx,C=y.revalidateCallback,b=y.handleClose,w=y.customerLabels,I=y.productLabels,j=e(a(!1),2),k=j[0],A=j[1],S=e(o(i,v),2),L=S[0],B=S[1],T=m().handleAddMessage;return n(function(){(null==L?void 0:L.message)&&(T({message:L.message,severity:L.severity||"error"}),"success"===L.severity&&(C&&C(),b&&b()))},[null==L?void 0:L.message]),n(function(){(null==L?void 0:L.strapiErrors)&&T({message:L.strapiErrors.message||"Error creating return order",severity:L.severity||"error"})},[null==L?void 0:L.strapiErrors]),t.createElement(p,{sx:r([],e(Array.isArray(x)?x:[x]),!1)},t.createElement("form",{action:B},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h3",component:"h1"},"Create new return order"))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(u,{variant:"body2"},"Select the customer for which you want to create a return order"),t.createElement(c,{customerLabels:w}))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(E,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products that should be in this return order"),t.createElement(l,{productsArr:I})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this return? Confirming this order means you are sure the customer wants to return the products and you are ready to process the return."),t.createElement(h,{direction:"row",spacing:1,alignItems:"center"},t.createElement(f,{value:k,checked:k,onChange:function(){return A(!k)}}),k&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this return order")),t.createElement("input",{name:"status",type:"hidden",value:k?"returning":"requested"}))," ",t.createElement(d,{item:!0,xs:12},t.createElement(h,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2}},b&&t.createElement(g,{onClick:b,variant:"outlined"},"Cancel"),t.createElement(s,{text:"Confirm",loadingText:"Loading...",variant:"contained"}))))))}export{y as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as a}from"react";import o from"@mui/material/Table";import i from"@mui/material/TableHead";import l from"@mui/material/TableBody";import m from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import s from"@mui/material/Typography";import p from"@mui/material/Stack";import f from"@mui/material/TextField";import v from"../products/ProductSelector.js";import"../../../../node_modules/dayjs/dayjs.min.js";import h from"@mui/icons-material/Delete";import{useTheme as E}from"@mui/material/styles";function g(g){var b=g.productsArr,x=e(n([]),2),_=x[0],y=x[1],w=e(n(null),2),C=w[0],j=w[1],T=e(n(0),2),N=T[0],k=T[1],A=e(n("damaged"),2),I=A[0],q=A[1],P=e(n(""),2),S=P[0],W=P[1],B=e(n([]),2),D=B[0],O=B[1],R=e(n(!1),2),F=R[0],H=R[1];E();var J=e(n([]),2),L=J[0],V=J[1];return a((function(){V(function(e){return e.map((function(e,t){var r;return{line_item_number:"".concat(t+1,".0.0"),product:(null===(r=e.product)||void 0===r?void 0:r.id)||0,returned_quantity:e.returned_quantity,reason:I,other_reason:S}}))}(_))}),[_]),r.createElement(p,{spacing:2},r.createElement(o,null,r.createElement(i,null,r.createElement(u,null,r.createElement(m,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(m,{sx:[{width:"35%"}]},"Product Number"),r.createElement(m,{sx:[{width:"15%"}]},"Amount"),r.createElement(m,{sx:[{width:"35%"}]},"Reason"),r.createElement(m,{sx:[]}))),r.createElement(l,null,_.map((function(e,t){var n,a;return r.createElement(u,{key:t},r.createElement(m,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(m,{sx:[{width:"35%"}]},"object"==typeof e.product?null===(n=e.product)||void 0===n?void 0:n.product_number:e.product," ","|"," ","object"==typeof e.product?null===(a=e.product)||void 0===a?void 0:a.title:""),r.createElement(m,{sx:{width:"15%"}},e.returned_quantity),r.createElement(m,{sx:{width:"35%"}},"other"===e.reason?e.other_reason:e.reason),r.createElement(m,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=_.filter((function(t,r){return r!==e}));y(t)}(t)}},r.createElement(h,null))))})))),r.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(L)}),r.createElement(p,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(s,{variant:"body1",sx:{width:"15%"}},_.length+1,".0.0"),b&&r.createElement(v,{productNames:b,currentValue:D,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=b.find((function(t){return t.id===e[0]}));j(t||null),O(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:N,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?k(0):k(parseInt(e.target.value)):k(0)},sx:{width:"15%"}}),r.createElement(f,{value:I,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!("other"===I),sx:{minWidth:"25%"},onChange:function(e){var t=e.target.value;H("other"===t),q(e.target.value)}},r.createElement("option",{value:"damaged"},"Damaged"),r.createElement("option",{value:"not_as_described"},"Not as described"),r.createElement("option",{value:"wrong_item"},"Wrong item"),r.createElement("option",{value:"other"},"Other")),F&&r.createElement(f,{value:S,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;W(t)}}),r.createElement(c,{onClick:function(){if(null!==N){var r={product:C,returned_quantity:N,reason:I,other_reason:S};y(t(t([],e(_),!1),[r],!1)),j(null),k(0),q("damaged"),W(""),O([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{g as IROItemFields};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as a}from"react";import o from"@mui/material/Table";import i from"@mui/material/TableHead";import l from"@mui/material/TableBody";import m from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import s from"@mui/material/Typography";import p from"@mui/material/Stack";import f from"@mui/material/TextField";import v from"../products/ProductSelector.js";import"../../../../node_modules/dayjs/dayjs.min.js";import h from"@mui/icons-material/Delete";import{useTheme as E}from"@mui/material/styles";function g(g){var b=g.productsArr,x=e(n([]),2),_=x[0],y=x[1],w=e(n(null),2),C=w[0],j=w[1],T=e(n(0),2),N=T[0],k=T[1],A=e(n("damaged"),2),I=A[0],q=A[1],P=e(n(""),2),S=P[0],W=P[1],B=e(n([]),2),D=B[0],O=B[1],R=e(n(!1),2),F=R[0],H=R[1];E();var J=e(n([]),2),L=J[0],V=J[1];return a(function(){V(function(e){return e.map(function(e,t){var r;return{line_item_number:"".concat(t+1,".0.0"),product:(null===(r=e.product)||void 0===r?void 0:r.id)||0,returned_quantity:e.returned_quantity,reason:I,other_reason:S}})}(_))},[_]),r.createElement(p,{spacing:2},r.createElement(o,null,r.createElement(i,null,r.createElement(u,null,r.createElement(m,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(m,{sx:[{width:"35%"}]},"Product Number"),r.createElement(m,{sx:[{width:"15%"}]},"Amount"),r.createElement(m,{sx:[{width:"35%"}]},"Reason"),r.createElement(m,{sx:[]}))),r.createElement(l,null,_.map(function(e,t){var n,a;return r.createElement(u,{key:t},r.createElement(m,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(m,{sx:[{width:"35%"}]},"object"==typeof e.product?null===(n=e.product)||void 0===n?void 0:n.product_number:e.product," ","|"," ","object"==typeof e.product?null===(a=e.product)||void 0===a?void 0:a.title:""),r.createElement(m,{sx:{width:"15%"}},e.returned_quantity),r.createElement(m,{sx:{width:"35%"}},"other"===e.reason?e.other_reason:e.reason),r.createElement(m,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=_.filter(function(t,r){return r!==e});y(t)}(t)}},r.createElement(h,null))))}))),r.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(L)}),r.createElement(p,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(s,{variant:"body1",sx:{width:"15%"}},_.length+1,".0.0"),b&&r.createElement(v,{productNames:b,currentValue:D,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=b.find(function(t){return t.id===e[0]});j(t||null),O(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:N,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?k(0):k(parseInt(e.target.value)):k(0)},sx:{width:"15%"}}),r.createElement(f,{value:I,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!("other"===I),sx:{minWidth:"25%"},onChange:function(e){var t=e.target.value;H("other"===t),q(e.target.value)}},r.createElement("option",{value:"damaged"},"Damaged"),r.createElement("option",{value:"not_as_described"},"Not as described"),r.createElement("option",{value:"wrong_item"},"Wrong item"),r.createElement("option",{value:"other"},"Other")),F&&r.createElement(f,{value:S,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;W(t)}}),r.createElement(c,{onClick:function(){if(null!==N){var r={product:C,returned_quantity:N,reason:I,other_reason:S};y(t(t([],e(_),!1),[r],!1)),j(null),k(0),q("damaged"),W(""),O([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{g as IROItemFields};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import n from"../../common/ImagePreviewTooltip.js";import a from"../../logistics/report/ReportsDisplay.js";function i(i){var c,o,m=i.item,l=i.index,s=i.image,d=m.line_item_number,p=m.product,u=m.returned_quantity,E=m.received_quantity,g=m.registered_quantity,v=m.released_quantity,y=m.reports,b=m.reason,f=m.other_reason;return e.createElement(t,{spacing:1,key:l},m&&e.createElement(t,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(t,{spacing:1,sx:{width:"100%"}},e.createElement(r,{variant:"body1"},"Line Item Number: ",d),e.createElement(r,{variant:"body1"},"Part Number: ",null==p?void 0:p.product_number)),e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reason: ",b),void 0!==f&&e.createElement(r,{variant:"body1"},f)),s&&e.createElement(e.Fragment,null,e.createElement(n,{image:s,label:null===(c=m.product)||void 0===c?void 0:c.title}))),e.createElement(t,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center"},e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Ordered"),e.createElement(r,{variant:"h6"},u)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Received"),e.createElement(r,{variant:"h6"},E)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Registered"),e.createElement(r,{variant:"h6"},g)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Released"),e.createElement(r,{variant:"h6"},v))),(null===(o=null==y?void 0:y.data)||void 0===o?void 0:o.length)>0&&e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reports:"),e.createElement(a,{reports:y.data.filter((function(e){return"id"in e&&!("pre_report"in e)}))})))}export{i as default};
6
+ import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import n from"../../common/ImagePreviewTooltip.js";import a from"../../logistics/report/ReportsDisplay.js";function i(i){var c,o,m=i.item,l=i.index,s=i.image,d=m.line_item_number,p=m.product,u=m.returned_quantity,E=m.received_quantity,g=m.registered_quantity,v=m.released_quantity,y=m.reports,b=m.reason,f=m.other_reason;return e.createElement(t,{spacing:1,key:l},m&&e.createElement(t,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(t,{spacing:1,sx:{width:"100%"}},e.createElement(r,{variant:"body1"},"Line Item Number: ",d),e.createElement(r,{variant:"body1"},"Part Number: ",null==p?void 0:p.product_number)),e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reason: ",b),void 0!==f&&e.createElement(r,{variant:"body1"},f)),s&&e.createElement(e.Fragment,null,e.createElement(n,{image:s,label:null===(c=m.product)||void 0===c?void 0:c.title}))),e.createElement(t,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center"},e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Ordered"),e.createElement(r,{variant:"h6"},u)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Received"),e.createElement(r,{variant:"h6"},E)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Registered"),e.createElement(r,{variant:"h6"},g)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Released"),e.createElement(r,{variant:"h6"},v))),(null===(o=null==y?void 0:y.data)||void 0===o?void 0:o.length)>0&&e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reports:"),e.createElement(a,{reports:y.data.filter(function(e){return"id"in e&&!("pre_report"in e)})})))}export{i as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import a from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/report/ReportMakingComponent.js";import s from"../../logistics/report/ReportsDisplay.js";function p(p){var f=p.item,y=p.index,g=p.handleUpdateQuantity,E=p.image,v=p.revalidateCallback,b=f.line_item_number,V=f.product,_=f.received_quantity,w=f.registered_quantity,h=f.released_quantity,q=f.returned_quantity,C=f.reports;f.reason,f.other_reason;var N=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"received"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,k=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0,x=e(r(!1),2),j=x[0],R=x[1];return t.createElement(a,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between"},t.createElement(a,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",V&&V.product_number)),E&&t.createElement(t.Fragment,null,t.createElement(u,{image:E,label:V&&V.title}))),t.createElement(n,{variant:"body1"},"Reason"),t.createElement(n,{variant:"body2"},"Received"),t.createElement(m,{currentValue:_,totalValue:q+N,minNewValue:0+w+-k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"received_quantity")}}),t.createElement(n,{variant:"body2"},"Registered"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+h,maxNewValue:_+k,color:"info",handleChange:function(e){g(e,f.id,"registered_quantity")},offsetEnd:k}),t.createElement(o,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return R(!j)}},t.createElement(c,null)))),t.createElement(l,{in:j},t.createElement(a,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(s,{reports:C.data}),t.createElement(d,{content:"content",quantity:0,type:"registered",minValue:-(_+k),maxValue:_,related:[{id:f.id,__type:"api::e-commerce.iro-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Released"),t.createElement(m,{currentValue:h||0,totalValue:q+N+k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){g(e,f.id,"released_quantity")}})))}export{p as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import a from"@mui/material/Stack";import n from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/report/ReportMakingComponent.js";import s from"../../logistics/report/ReportsDisplay.js";function p(p){var f=p.item,y=p.index,g=p.handleUpdateQuantity,E=p.image,v=p.revalidateCallback,b=f.line_item_number,V=f.product,_=f.received_quantity,w=f.registered_quantity,h=f.released_quantity,q=f.returned_quantity,C=f.reports;f.reason,f.other_reason;var N=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter(function(e){return"received"===e.type}).reduce(function(e,t){return e+t.quantity},0):0,k=void 0!==(null==C?void 0:C.data)&&C.data.length>0?C.data.filter(function(e){return"registered"===e.type}).reduce(function(e,t){return e+t.quantity},0):0,x=e(r(!1),2),j=x[0],R=x[1];return t.createElement(a,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(a,{direction:"row",justifyContent:"space-between"},t.createElement(a,{spacing:1},t.createElement(n,{variant:"body1"},"Line Item Number: ",b),t.createElement(n,{variant:"body1"},"Part Number: ",V&&V.product_number)),E&&t.createElement(t.Fragment,null,t.createElement(u,{image:E,label:V&&V.title}))),t.createElement(n,{variant:"body1"},"Reason"),t.createElement(n,{variant:"body2"},"Received"),t.createElement(m,{currentValue:_,totalValue:q+N,minNewValue:0+w+-k,maxNewValue:q+N,color:"info",handleChange:function(e){g(e,f.id,"received_quantity")}}),t.createElement(n,{variant:"body2"},"Registered"),t.createElement(m,{currentValue:w,totalValue:q+N,minNewValue:0+h,maxNewValue:_+k,color:"info",handleChange:function(e){g(e,f.id,"registered_quantity")},offsetEnd:k}),t.createElement(o,{sx:{p:0}},t.createElement(a,{direction:"row",spacing:1,alignItems:"center"},t.createElement(n,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return R(!j)}},t.createElement(c,null)))),t.createElement(l,{in:j},t.createElement(a,{spacing:2},t.createElement(n,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(s,{reports:C.data}),t.createElement(d,{content:"content",quantity:0,type:"registered",minValue:-(_+k),maxValue:_,related:[{id:f.id,__type:"api::e-commerce.iro-item"}],revalidateCallback:v}))),t.createElement(n,{variant:"body2"},"Released"),t.createElement(m,{currentValue:h||0,totalValue:q+N+k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){g(e,f.id,"released_quantity")}})))}export{p as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import o from"react";import t from"@mui/material/Chip";var s=[{status:"requested",color:"info"},{status:"returning",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],r=[{status:"requested",color:"warning"},{status:"returning",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"warning"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],n=[{status:"requested",color:"info"},{status:"returning",color:"warning"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],e=function(e){var l,u,c,a=e.status,i=e.role,f=a?a.split("_").map((function(o){return o.charAt(0).toUpperCase()+o.slice(1)})).join(" "):"Unknown";return o.createElement(t,{label:f,color:"enduser"===i?(null===(l=r.find((function(o){return o.status===a})))||void 0===l?void 0:l.color)||"default":"dispatcher"===i?(null===(u=n.find((function(o){return o.status===a})))||void 0===u?void 0:u.color)||"default":(null===(c=s.find((function(o){return o.status===a})))||void 0===c?void 0:c.color)||"default"})};export{e as IroStatusIndicator};
7
+ import o from"react";import t from"@mui/material/Chip";var s=[{status:"requested",color:"info"},{status:"returning",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],r=[{status:"requested",color:"warning"},{status:"returning",color:"info"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"warning"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],n=[{status:"requested",color:"info"},{status:"returning",color:"warning"},{status:"logistics_operator_process",color:"info"},{status:"finalising_process",color:"info"},{status:"done",color:"success"},{status:"cancelled",color:"error"},{status:null,color:"default"}],e=function(e){var l,u,c,a=e.status,i=e.role,f=a?a.split("_").map(function(o){return o.charAt(0).toUpperCase()+o.slice(1)}).join(" "):"Unknown";return o.createElement(t,{label:f,color:"enduser"===i?(null===(l=r.find(function(o){return o.status===a}))||void 0===l?void 0:l.color)||"default":"dispatcher"===i?(null===(u=n.find(function(o){return o.status===a}))||void 0===u?void 0:u.color)||"default":(null===(c=s.find(function(o){return o.status===a}))||void 0===c?void 0:c.color)||"default"})};export{e as IroStatusIndicator};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import{useFormState as i}from"react-dom";import{updateIpoAction as n}from"../../../data/actions/logistics/ipo/updateIpoAction.js";import m from"../../logistics/note/NotesDisplay.js";import o from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import s from"@mui/material/Alert";import"@mui/material/Dialog";import"@mui/material/DialogActions";import"@mui/material/DialogContent";import"@mui/material/DialogTitle";import d from"@mui/material/Typography";import"@mui/material/Button";import p from"@mui/material/Grid";import u from"@mui/material/Box";import E from"@mui/material/Paper";import g from"@mui/material/Stack";import v from"@mui/material/Divider";import"next/headers";var y={zodErrors:null,strapiErrors:null,data:null,message:null};function f(f){var h,x,b,_=f.data,w=f.sx,D=f.revalidateCallback;f.handleClose;var j=f.role,C=e(i(n,y),2),q=C[0],S=C[1],k=e(a(_.iro_items.data?_.iro_items.data:[]),2),A=k[0];k[1];var N=e(a(!1),2);N[0],N[1];return r.createElement(u,{sx:t([],e(Array.isArray(w)?w:[w]),!1)},r.createElement(p,{container:!0,spacing:2},r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(g,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),r.createElement(d,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(o,{content:"",related:[{id:_.id,__type:"api::logistics.ipo"}],revalidateCallback:D})),r.createElement(v,null))),r.createElement(p,{item:!0,xs:6},r.createElement(g,{spacing:1},r.createElement(d,{variant:"h5"},"Details"),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(d,{variant:"body2"},_.return_number)),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Custom reference")),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Date"),r.createElement(d,{variant:"body2"},_.return_date)),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Supplier")),r.createElement(g,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Status"),r.createElement(d,{variant:"body2",width:"250px"},_.status)))),r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h5"},"Documents"),r.createElement(E,{sx:{p:2}},r.createElement(g,{spacing:1},"enduser"===j&&r.createElement(r.Fragment,null))))),(null===(x=null===(h=null==_?void 0:_.notes)||void 0===h?void 0:h.data)||void 0===x?void 0:x.length)>0&&r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:2},r.createElement(d,{variant:"h5"},"Notes"),r.createElement(m,{notes:_.notes.data}),r.createElement(v,null))),r.createElement(p,{item:!0,xs:12},r.createElement(g,{spacing:1},r.createElement(d,{variant:"h5"},"Items"),r.createElement(v,null),r.createElement("form",{action:S},r.createElement("input",{name:"id",type:"hidden",value:_.id}),(null===(b=null==_?void 0:_.iro_items)||void 0===b?void 0:b.data)&&_.iro_items.data.map((function(e,t){return console.log("item",e),r.createElement(E,{sx:{p:2,mb:2},key:t})})),r.createElement(E,{sx:{p:2}},r.createElement(g,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(c,{text:"Update items",loadingText:"Loading..."}),r.createElement(l,{error:null==q?void 0:q.strapiErrors}),(null==q?void 0:q.message)&&r.createElement(s,{severity:"error"},null==q?void 0:q.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}}))}(A))}))))))}export{f as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as a}from"react";import{useFormState as i}from"react-dom";import{updateIroAction as n}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import m from"../../logistics/note/NotesDisplay.js";import o from"../../logistics/note/NoteTakingComponent.js";import{StrapiErrors as l}from"../../StrapiErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import s from"@mui/material/Alert";import"@mui/material/Dialog";import"@mui/material/DialogActions";import"@mui/material/DialogContent";import"@mui/material/DialogTitle";import d from"@mui/material/Typography";import"@mui/material/Button";import p from"@mui/material/Grid";import u from"@mui/material/Box";import E from"@mui/material/Paper";import v from"@mui/material/Stack";import g from"@mui/material/Divider";import"next/headers";var y={zodErrors:null,strapiErrors:null,data:null,message:null};function f(f){var h,x,b,_=f.data,w=f.sx,D=f.revalidateCallback;f.handleClose;var j=f.role,C=e(i(n,y),2),q=C[0],S=C[1],k=e(a(_.iro_items.data?_.iro_items.data:[]),2),A=k[0];k[1];var N=e(a(!1),2);N[0],N[1];return r.createElement(u,{sx:t([],e(Array.isArray(w)?w:[w]),!1)},r.createElement(p,{container:!0,spacing:2},r.createElement(p,{item:!0,xs:12},r.createElement(v,{spacing:2},r.createElement(v,{direction:"row",spacing:2,justifyContent:"space-between"},r.createElement(v,{spacing:2},r.createElement(d,{variant:"h3",component:"h1"},"Management Inbound Purchase Order"),r.createElement(d,{variant:"body1"},"Manage arrival, registration and recieval of purchase order")),r.createElement(o,{content:"",related:[{id:_.id,__type:"api::logistics.ipo"}],revalidateCallback:D})),r.createElement(g,null))),r.createElement(p,{item:!0,xs:6},r.createElement(v,{spacing:1},r.createElement(d,{variant:"h5"},"Details"),r.createElement(v,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Purchase Order Number"),r.createElement(d,{variant:"body2"},_.return_number)),r.createElement(v,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Custom reference")),r.createElement(v,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Date"),r.createElement(d,{variant:"body2"},_.return_date)),r.createElement(v,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Supplier")),r.createElement(v,{direction:"row",spacing:2},r.createElement(d,{variant:"body1",width:"250px"},"Order Status"),r.createElement(d,{variant:"body2",width:"250px"},_.status)))),r.createElement(p,{item:!0,xs:12},r.createElement(v,{spacing:2},r.createElement(d,{variant:"h5"},"Documents"),r.createElement(E,{sx:{p:2}},r.createElement(v,{spacing:1},"enduser"===j&&r.createElement(r.Fragment,null))))),(null===(x=null===(h=null==_?void 0:_.notes)||void 0===h?void 0:h.data)||void 0===x?void 0:x.length)>0&&r.createElement(p,{item:!0,xs:12},r.createElement(v,{spacing:2},r.createElement(d,{variant:"h5"},"Notes"),r.createElement(m,{notes:_.notes.data}),r.createElement(g,null))),r.createElement(p,{item:!0,xs:12},r.createElement(v,{spacing:1},r.createElement(d,{variant:"h5"},"Items"),r.createElement(g,null),r.createElement("form",{action:S},r.createElement("input",{name:"id",type:"hidden",value:_.id}),(null===(b=null==_?void 0:_.iro_items)||void 0===b?void 0:b.data)&&_.iro_items.data.map(function(e,t){return console.log("item",e),r.createElement(E,{sx:{p:2,mb:2},key:t})}),r.createElement(E,{sx:{p:2}},r.createElement(v,{direction:"row",spacing:2,justifyContent:"end"},r.createElement(c,{text:"Update items",loadingText:"Loading..."}),r.createElement(l,{error:null==q?void 0:q.strapiErrors}),(null==q?void 0:q.message)&&r.createElement(s,{severity:"error"},null==q?void 0:q.message))),r.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map(function(e){return{id:e.id,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity}})}(A))}))))))}export{f as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as o,Suspense as i}from"react";import{useFormState as l}from"react-dom";import{useSnackbar as m}from"../../../context/common/SnackbarContext.js";import{requestRmaAction as u}from"../../../data/actions/e-commerce/iro/requestRmaAction.js";import{StrapiErrors as c}from"../../StrapiErrors.js";import{SubmitButton as s}from"../../SubmitButton.js";import d from"@mui/material/Typography";import p from"@mui/material/Grid";import f from"@mui/material/Box";import v from"@mui/material/TextField";import E from"@mui/material/Checkbox";import g from"@mui/material/Button";import y from"@mui/material/Alert";import h from"@mui/material/Stack";import{Divider as b,List as _,ListItem as x}from"@mui/material";import C from"@mui/material/Dialog";import k from"@mui/material/DialogActions";import q from"@mui/material/DialogContent";import I from"@mui/material/DialogContentText";import w from"@mui/material/DialogTitle";import S from"../../common/NumberInput.js";var A={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},R=function(l){var m=l.items,u=l.itemsToReturn,c=l.setItemsToReturn,s=l.selectedItems,p=l.setSelectedItems,f=e(a(!1),2),g=f[0],y=f[1],_=function(e,t,n){c(u.map((function(a,o){var i;return o===e?r(r({},a),((i={})[t]=n,i)):a})))};o((function(){m&&c(m.map((function(e){return{line_item_number:e.line_item_number,product:e.product,ordered_quantity:e.ordered_quantity,returned_quantity:0,reason:"damaged",other_reason:""}})))}),[m]);var x=e(a([]),2),C=x[0],k=x[1];return o((function(){u&&k(u.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:"object"==typeof e.product&&"id"in e.product?e.product.id:0,returned_quantity:e.returned_quantity,reason:e.reason,other_reason:e.other_reason||""}})))}),[u]),n.createElement(i,{fallback:n.createElement("div",null,"Loading...")},n.createElement(h,{spacing:2},n.createElement(d,{variant:"h6"},"Items"),n.createElement(d,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),n.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(C)}),n.createElement(h,{spacing:1},m.map((function(r,a){var o,i;return n.createElement(n.Fragment,null,n.createElement(h,{spacing:1,direction:"row",alignItems:"center"},n.createElement(E,{checked:s.includes(a),onChange:function(r){r.target.checked?p(t(t([],e(s),!1),[a],!1)):p(s.filter((function(e){return e!==a})))}}),n.createElement(d,{variant:"body1"},"Line Item Number: ",r.line_item_number),n.createElement(d,{variant:"body1"},"Part Number: ",null===(o=r.product)||void 0===o?void 0:o.product_number),n.createElement(d,{variant:"body1"},"Quantity Ordered: ",r.ordered_quantity)),s.includes(a)&&n.createElement(n.Fragment,null,n.createElement(h,{direction:"row",spacing:1,alignItems:"center"},n.createElement(S,{label:"Quantity to return",minNewValue:0,maxNewValue:r.ordered_quantity,setValueCallback:function(e){_(a,"returned_quantity",e)},sx:{width:"12rem"}}),n.createElement(b,{orientation:"vertical",flexItem:!0}),n.createElement(d,{variant:"body1",sx:{width:"12rem"}},"Reason for return:"),n.createElement(v,{value:null===(i=u[a])||void 0===i?void 0:i.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;y("other"===t),_(a,"reason",t)}},n.createElement("option",{value:"damaged"},"Damaged on arrival"),n.createElement("option",{value:"not_as_described"},"Not as described"),n.createElement("option",{value:"wrong_item"},"Wrong item"),n.createElement("option",{value:"other"},"Other"))),g&&n.createElement(v,{value:u[a].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;_(a,"other_reason",t)}})),n.createElement(b,null))})))))},T=function(t){var r=t.open,o=t.onClose,i=t.items,l=t.formState,m=t.submitCallback,u=e(a(!0),2),p=u[0],f=u[1];return n.createElement(C,{open:r,onClose:o},n.createElement(w,null,"Confirm RMA"),n.createElement(q,null,n.createElement(I,null,"Summary of items to be returned:"),n.createElement(_,null,i.map((function(e,t){var r,a;return n.createElement(x,{key:t},"object"==typeof e.product?"".concat(null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.product_number," ").concat(null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.title):"Product with ID ".concat(e.product)," ","- Quantity: ",e.returned_quantity)}))),n.createElement(I,null,"Are you sure you want to request a return merchandise authorization for these items?"),n.createElement(E,{onChange:function(e){return f(!e.target.checked)}}),n.createElement(d,{variant:"body1"},"I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration.")),n.createElement(k,null,m?n.createElement(s,{text:"Yes",loadingText:"Loading...",disabled:p,onClick:m}):n.createElement(s,{text:"Yes",loadingText:"Loading...",disabled:p}),n.createElement(g,{onClick:o},"No"),null!==(null==l?void 0:l.strapiErrors)&&n.createElement(c,{error:null==l?void 0:l.strapiErrors}),(null==l?void 0:l.message)&&n.createElement(y,{severity:"error"},null==l?void 0:l.message)))};function D(r){var i,s,v,E=r.opo,b=r.sx,_=r.revalidateCallback,x=r.handleClose,C=e(l(u,A),2),k=C[0],q=C[1],I=m().handleAddMessage,w=e(a(!1),2),S=w[0],D=w[1],N=e(a([]),2),j=N[0],F=N[1],M=e(a([]),2),B=M[0],L=M[1];return o((function(){(null==k?void 0:k.message)&&(I({message:k.message,severity:k.severity||"error"}),"success"===k.severity&&(_&&_(),x&&x()))}),[null==k?void 0:k.message]),o((function(){(null==k?void 0:k.strapiErrors)&&I({message:k.strapiErrors.message||"Error requesting RMA",severity:k.severity||"error"})}),[null==k?void 0:k.strapiErrors]),n.createElement(f,{sx:t([],e(Array.isArray(b)?b:[b]),!1)},n.createElement("form",{action:q},n.createElement(p,{container:!0,spacing:2},n.createElement(p,{item:!0,xs:12},n.createElement(d,{variant:"h6"},"RMA Form")),n.createElement("input",{type:"hidden",name:"opos",value:JSON.stringify([E.id])}),n.createElement(p,{item:!0,xs:12},n.createElement(h,{spacing:2},n.createElement(d,{variant:"body1"},"Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned."),n.createElement(y,{severity:"warning"},"We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items."))),n.createElement(p,{item:!0,xs:12},(null===(i=E.opo_items)||void 0===i?void 0:i.data)?n.createElement(h,{spacing:1},(null===(s=E.opo_items)||void 0===s?void 0:s.data)&&n.createElement(R,{items:null===(v=E.opo_items)||void 0===v?void 0:v.data,itemsToReturn:j,setItemsToReturn:F,selectedItems:B,setSelectedItems:L})):n.createElement(d,{variant:"body1"},"No items")),n.createElement(T,{formState:k,open:S,items:j.filter((function(e){return e.returned_quantity>0})),onClose:function(){return D(!S)},submitCallback:function(){console.log("submit callback");var e=document.querySelector("form");q(e?new FormData(e):new FormData),D(!S)}}),n.createElement(p,{item:!0,xs:12},n.createElement(g,{onClick:function(){console.log(k),D(!S)},disabled:0===B.length||0===B.reduce((function(e,t){return e+j[t].returned_quantity}),0)},"Request RMA"),null!==(null==k?void 0:k.strapiErrors)&&n.createElement(c,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&n.createElement(y,{severity:"error"},null==k?void 0:k.message)))))}export{D as default};
7
+ import{__read as e,__spreadArray as t,__assign as r}from"../../../../node_modules/tslib/tslib.es6.js";import n,{useState as a,useEffect as o,Suspense as i}from"react";import{useFormState as l}from"react-dom";import{useSnackbar as m}from"../../../context/common/SnackbarContext.js";import{requestRmaAction as u}from"../../../data/actions/e-commerce/iro/requestRmaAction.js";import{StrapiErrors as c}from"../../StrapiErrors.js";import{SubmitButton as s}from"../../SubmitButton.js";import d from"@mui/material/Typography";import p from"@mui/material/Grid";import f from"@mui/material/Box";import v from"@mui/material/TextField";import E from"@mui/material/Checkbox";import g from"@mui/material/Button";import y from"@mui/material/Alert";import h from"@mui/material/Stack";import{Divider as b,List as _,ListItem as x}from"@mui/material";import C from"@mui/material/Dialog";import k from"@mui/material/DialogActions";import q from"@mui/material/DialogContent";import I from"@mui/material/DialogContentText";import w from"@mui/material/DialogTitle";import S from"../../common/NumberInput.js";var A={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null},R=function(l){var m=l.items,u=l.itemsToReturn,c=l.setItemsToReturn,s=l.selectedItems,p=l.setSelectedItems,f=e(a(!1),2),g=f[0],y=f[1],_=function(e,t,n){c(u.map(function(a,o){var i;return o===e?r(r({},a),((i={})[t]=n,i)):a}))};o(function(){m&&c(m.map(function(e){return{line_item_number:e.line_item_number,product:e.product,ordered_quantity:e.ordered_quantity,returned_quantity:0,reason:"damaged",other_reason:""}}))},[m]);var x=e(a([]),2),C=x[0],k=x[1];return o(function(){u&&k(u.map(function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:"object"==typeof e.product&&"id"in e.product?e.product.id:0,returned_quantity:e.returned_quantity,reason:e.reason,other_reason:e.other_reason||""}}))},[u]),n.createElement(i,{fallback:n.createElement("div",null,"Loading...")},n.createElement(h,{spacing:2},n.createElement(d,{variant:"h6"},"Items"),n.createElement(d,{variant:"body1"},"from the items in the original order please select the items you'd like to return"),n.createElement("input",{type:"hidden",name:"iro_items",value:JSON.stringify(C)}),n.createElement(h,{spacing:1},m.map(function(r,a){var o,i;return n.createElement(n.Fragment,null,n.createElement(h,{spacing:1,direction:"row",alignItems:"center"},n.createElement(E,{checked:s.includes(a),onChange:function(r){r.target.checked?p(t(t([],e(s),!1),[a],!1)):p(s.filter(function(e){return e!==a}))}}),n.createElement(d,{variant:"body1"},"Line Item Number: ",r.line_item_number),n.createElement(d,{variant:"body1"},"Part Number: ",null===(o=r.product)||void 0===o?void 0:o.product_number),n.createElement(d,{variant:"body1"},"Quantity Ordered: ",r.ordered_quantity)),s.includes(a)&&n.createElement(n.Fragment,null,n.createElement(h,{direction:"row",spacing:1,alignItems:"center"},n.createElement(S,{label:"Quantity to return",minNewValue:0,maxNewValue:r.ordered_quantity,setValueCallback:function(e){_(a,"returned_quantity",e)},sx:{width:"12rem"}}),n.createElement(b,{orientation:"vertical",flexItem:!0}),n.createElement(d,{variant:"body1",sx:{width:"12rem"}},"Reason for return:"),n.createElement(v,{value:null===(i=u[a])||void 0===i?void 0:i.reason,select:!0,SelectProps:{native:!0},variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;y("other"===t),_(a,"reason",t)}},n.createElement("option",{value:"damaged"},"Damaged on arrival"),n.createElement("option",{value:"not_as_described"},"Not as described"),n.createElement("option",{value:"wrong_item"},"Wrong item"),n.createElement("option",{value:"other"},"Other"))),g&&n.createElement(v,{value:u[a].other_reason,label:"Custom reason",variant:"outlined",fullWidth:!0,onChange:function(e){var t=e.target.value;_(a,"other_reason",t)}})),n.createElement(b,null))}))))},T=function(t){var r=t.open,o=t.onClose,i=t.items,l=t.formState,m=t.submitCallback,u=e(a(!0),2),p=u[0],f=u[1];return n.createElement(C,{open:r,onClose:o},n.createElement(w,null,"Confirm RMA"),n.createElement(q,null,n.createElement(I,null,"Summary of items to be returned:"),n.createElement(_,null,i.map(function(e,t){var r,a;return n.createElement(x,{key:t},"object"==typeof e.product?"".concat(null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.product_number," ").concat(null===(a=null==e?void 0:e.product)||void 0===a?void 0:a.title):"Product with ID ".concat(e.product)," ","- Quantity: ",e.returned_quantity)})),n.createElement(I,null,"Are you sure you want to request a return merchandise authorization for these items?"),n.createElement(E,{onChange:function(e){return f(!e.target.checked)}}),n.createElement(d,{variant:"body1"},"I confirm that the information I have provided is accurate and truthful. I understand that providing false or misleading information about the reason for returning goods may result in additional costs being charged to me. By checking this box, I acknowledge my legal responsibility for the accuracy of my declaration.")),n.createElement(k,null,m?n.createElement(s,{text:"Yes",loadingText:"Loading...",disabled:p,onClick:m}):n.createElement(s,{text:"Yes",loadingText:"Loading...",disabled:p}),n.createElement(g,{onClick:o},"No"),null!==(null==l?void 0:l.strapiErrors)&&n.createElement(c,{error:null==l?void 0:l.strapiErrors}),(null==l?void 0:l.message)&&n.createElement(y,{severity:"error"},null==l?void 0:l.message)))};function D(r){var i,s,v,E=r.opo,b=r.sx,_=r.revalidateCallback,x=r.handleClose,C=e(l(u,A),2),k=C[0],q=C[1],I=m().handleAddMessage,w=e(a(!1),2),S=w[0],D=w[1],N=e(a([]),2),j=N[0],F=N[1],M=e(a([]),2),B=M[0],L=M[1];return o(function(){(null==k?void 0:k.message)&&(I({message:k.message,severity:k.severity||"error"}),"success"===k.severity&&(_&&_(),x&&x()))},[null==k?void 0:k.message]),o(function(){(null==k?void 0:k.strapiErrors)&&I({message:k.strapiErrors.message||"Error requesting RMA",severity:k.severity||"error"})},[null==k?void 0:k.strapiErrors]),n.createElement(f,{sx:t([],e(Array.isArray(b)?b:[b]),!1)},n.createElement("form",{action:q},n.createElement(p,{container:!0,spacing:2},n.createElement(p,{item:!0,xs:12},n.createElement(d,{variant:"h6"},"RMA Form")),n.createElement("input",{type:"hidden",name:"opos",value:JSON.stringify([E.id])}),n.createElement(p,{item:!0,xs:12},n.createElement(h,{spacing:2},n.createElement(d,{variant:"body1"},"Please fill out the form below to request a return merchandise authorization. Due to the sensitive nature of the products, only unopened packages can be returned."),n.createElement(y,{severity:"warning"},"We urge you to carefully photograph the items you are returning. These pictures can be requested at a later time by our team to verify the condition of the items."))),n.createElement(p,{item:!0,xs:12},(null===(i=E.opo_items)||void 0===i?void 0:i.data)?n.createElement(h,{spacing:1},(null===(s=E.opo_items)||void 0===s?void 0:s.data)&&n.createElement(R,{items:null===(v=E.opo_items)||void 0===v?void 0:v.data,itemsToReturn:j,setItemsToReturn:F,selectedItems:B,setSelectedItems:L})):n.createElement(d,{variant:"body1"},"No items")),n.createElement(T,{formState:k,open:S,items:j.filter(function(e){return e.returned_quantity>0}),onClose:function(){return D(!S)},submitCallback:function(){console.log("submit callback");var e=document.querySelector("form");q(e?new FormData(e):new FormData),D(!S)}}),n.createElement(p,{item:!0,xs:12},n.createElement(g,{onClick:function(){console.log(k),D(!S)},disabled:0===B.length||0===B.reduce(function(e,t){return e+j[t].returned_quantity},0)},"Request RMA"),null!==(null==k?void 0:k.strapiErrors)&&n.createElement(c,{error:null==k?void 0:k.strapiErrors}),(null==k?void 0:k.message)&&n.createElement(y,{severity:"error"},null==k?void 0:k.message)))))}export{D as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{TextualAmountUpdater as m}from"../../common/TextualAmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import d from"../../common/ImagePreviewTooltip.js";import u from"../../logistics/report/ReportsDisplay.js";import s from"../../logistics/report/PreReportsDisplay.js";import p from"../../logistics/report/SimpleReportFields.js";import f from"@mui/material/Box";function v(v){var g,E,y,b,w,h=v.item,x=v.index,R=v.handleAddReport,I=v.handleUpdateQuantity,V=v.image,_=v.handleRemoveReportAtIndex,j=v.showing,q=h.line_item_number,C=h.product,D=h.returned_quantity,N=h.received_quantity,A=h.registered_quantity,F=h.released_quantity,k=h.reports,B=h.reason,P=h.other_reason,T=e(r(!1),2),S=T[0],U=T[1];void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter((function(e){return"received"===e.type})).reduce((function(e,t){return e+t.quantity}),0);var H=void 0!==(null==k?void 0:k.data)&&k.data.length>0?k.data.filter((function(e){return"registered"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0;void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter((function(e){return"released"===e.type})).reduce((function(e,t){return e+t.quantity}),0);var L=(null===(E=null===(g=h.reports)||void 0===g?void 0:g.data)||void 0===E?void 0:E.filter((function(e){return"id"in e})))||[],Q=(null===(b=null===(y=h.reports)||void 0===y?void 0:y.data)||void 0===b?void 0:b.filter((function(e){return!1===Boolean("id"in e)})))||[];return t.createElement(n,{spacing:1,key:x},h&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body1"},"Line Item Number: ",q),t.createElement(a,{variant:"body1"},"Part Number: ",null==C?void 0:C.product_number),V&&t.createElement(t.Fragment,null,t.createElement(d,{image:V,label:null===(w=h.product)||void 0===w?void 0:w.title}))),t.createElement(a,{variant:"body1"},"Reason: ",B,"other"===B&&void 0!==P&&", ".concat(P)),t.createElement(o,{sx:{mb:1}}),j&&j.includes("received")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Received"),t.createElement(m,{label:"Received",currentValue:N,totalValue:D,minNewValue:0+A,maxNewValue:D,color:"info",handleChange:function(e){I(e,h.id,"received_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("registered")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center"},t.createElement(a,{variant:"body2"},"Registered"),t.createElement(m,{label:"Registered",currentValue:A,totalValue:D+H,minNewValue:0+F,maxNewValue:N+H,color:"info",handleChange:function(e){I(e,h.id,"registered_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("reports")&&t.createElement(f,{sx:{mb:2}},t.createElement(o,{sx:{p:0}},t.createElement(n,{direction:"row",spacing:1,alignItems:"center"},t.createElement(a,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return U(!S)}},t.createElement(c,null)))),t.createElement(l,{in:S},t.createElement(n,{spacing:2},t.createElement(a,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(u,{reports:L}),t.createElement(s,{itemID:h.id,reports:Q,handleRemoveReportAtIndex:_}),t.createElement(p,{itemID:h.id,content:"",type:"registered",minValue:-(N-A+H),handleAddReport:R})))),j&&j.includes("released")&&t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Released"),t.createElement(m,{label:"Released",currentValue:F,totalValue:D+H,minNewValue:0,maxNewValue:A,color:"info",handleChange:function(e){I(e,h.id,"released_quantity")}}))))}export{v as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r}from"react";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{TextualAmountUpdater as m}from"../../common/TextualAmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import d from"../../common/ImagePreviewTooltip.js";import u from"../../logistics/report/ReportsDisplay.js";import s from"../../logistics/report/PreReportsDisplay.js";import p from"../../logistics/report/SimpleReportFields.js";import f from"@mui/material/Box";function v(v){var g,E,y,b,w,h=v.item,x=v.index,R=v.handleAddReport,I=v.handleUpdateQuantity,V=v.image,_=v.handleRemoveReportAtIndex,j=v.showing,q=h.line_item_number,C=h.product,D=h.returned_quantity,N=h.received_quantity,A=h.registered_quantity,F=h.released_quantity,k=h.reports,B=h.reason,P=h.other_reason,T=e(r(!1),2),S=T[0],U=T[1];void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter(function(e){return"received"===e.type}).reduce(function(e,t){return e+t.quantity},0);var H=void 0!==(null==k?void 0:k.data)&&k.data.length>0?k.data.filter(function(e){return"registered"===e.type}).reduce(function(e,t){return e+t.quantity},0):0;void 0!==(null==k?void 0:k.data)&&k.data.length>0&&k.data.filter(function(e){return"released"===e.type}).reduce(function(e,t){return e+t.quantity},0);var L=(null===(E=null===(g=h.reports)||void 0===g?void 0:g.data)||void 0===E?void 0:E.filter(function(e){return"id"in e}))||[],Q=(null===(b=null===(y=h.reports)||void 0===y?void 0:y.data)||void 0===b?void 0:b.filter(function(e){return!1===Boolean("id"in e)}))||[];return t.createElement(n,{spacing:1,key:x},h&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body1"},"Line Item Number: ",q),t.createElement(a,{variant:"body1"},"Part Number: ",null==C?void 0:C.product_number),V&&t.createElement(t.Fragment,null,t.createElement(d,{image:V,label:null===(w=h.product)||void 0===w?void 0:w.title}))),t.createElement(a,{variant:"body1"},"Reason: ",B,"other"===B&&void 0!==P&&", ".concat(P)),t.createElement(o,{sx:{mb:1}}),j&&j.includes("received")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Received"),t.createElement(m,{label:"Received",currentValue:N,totalValue:D,minNewValue:0+A,maxNewValue:D,color:"info",handleChange:function(e){I(e,h.id,"received_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("registered")&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center"},t.createElement(a,{variant:"body2"},"Registered"),t.createElement(m,{label:"Registered",currentValue:A,totalValue:D+H,minNewValue:0+F,maxNewValue:N+H,color:"info",handleChange:function(e){I(e,h.id,"registered_quantity")}})),t.createElement(o,{sx:{mb:2}})),j&&j.includes("reports")&&t.createElement(f,{sx:{mb:2}},t.createElement(o,{sx:{p:0}},t.createElement(n,{direction:"row",spacing:1,alignItems:"center"},t.createElement(a,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return U(!S)}},t.createElement(c,null)))),t.createElement(l,{in:S},t.createElement(n,{spacing:2},t.createElement(a,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(u,{reports:L}),t.createElement(s,{itemID:h.id,reports:Q,handleRemoveReportAtIndex:_}),t.createElement(p,{itemID:h.id,content:"",type:"registered",minValue:-(N-A+H),handleAddReport:R})))),j&&j.includes("released")&&t.createElement(n,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{mb:1}},t.createElement(a,{variant:"body2"},"Released"),t.createElement(m,{label:"Released",currentValue:F,totalValue:D+H,minNewValue:0,maxNewValue:A,color:"info",handleChange:function(e){I(e,h.id,"released_quantity")}}))))}export{v as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t,__assign as r,__awaiter as n,__generator as a}from"../../../../node_modules/tslib/tslib.es6.js";import i,{useState as l,useEffect as o}from"react";import{useFormState as c}from"react-dom";import{updateIroAction as s}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import u from"./TextualIROItemUpdater.js";import m from"./IroItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import v from"../../logistics/note/NoteTakingComponent.js";import{SubmitButton as p}from"../../SubmitButton.js";import f from"@mui/material/Alert";import E from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import _ from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import q from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";import{cancellationService as A}from"../../../data/services/common/cancellation-service.js";import{FormControlLabel as R,Checkbox as D,DialogContentText as j,CircularProgress as S,TextField as T,List as W,ListItem as F}from"@mui/material";import P from"@mui/icons-material/Numbers";import O from"@mui/icons-material/AssignmentReturn";import M from"@mui/icons-material/CalendarToday";import N from"@mui/icons-material/Business";import B from"@mui/icons-material/Description";import z from"@mui/icons-material/Update";import{IroStatusIndicator as U}from"./IroStatusIndicator.js";import{queryAllProducts as V}from"../../../data/loaders/e-commerce/queryAllProducts.js";import Q from"../../../../node_modules/qs/lib/index.js";import{useSnackbar as Y}from"../../../context/common/SnackbarContext.js";var G={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function J(c){var s,u,m=this,d=c.open,v=c.handleClose,p=c.overwrites,f=c.setOverwrites,x=c.iro,C=e(l(!1),2),w=C[0],I=C[1];return o((function(){var e,t;d&&(null===(t=null===(e=null==x?void 0:x.iro_items)||void 0===e?void 0:e.data)||void 0===t?void 0:t.length)>0&&n(m,void 0,void 0,(function(){var e,t,r,n,i,l;return a(this,(function(a){switch(a.label){case 0:return I(!0),e=Q.stringify({filters:{product_number:{$in:x.iro_items.data.map((function(e){var t,r;return(null===(r=null===(t=e.product)||void 0===t?void 0:t.product_number)||void 0===r?void 0:r.replace(/^r-/,""))||""}))}},populate:{price:!0}},{encodeValuesOnly:!0}),[4,V(e)];case 1:return t=a.sent(),r=t.data.map((function(e){return{id:e.id,product_number:e.product_number,price:e.price}})),console.log("correspondingProducts",r),I(!1),n=0,i=0,l=x.iro_items.data.map((function(e,t){var a=e.product,l=r.find((function(e){var t;return e.product_number===(null===(t=null==a?void 0:a.product_number)||void 0===t?void 0:t.replace(/^r-/,""))||""})),o=0,c=0,s=0;if(l&&l.price){o=l.price.price||0,c=l.price.price_incl_vat||0,s=l.price.vat_rate||0;var u=o*e.returned_quantity,m=c*e.returned_quantity;n+=u,i+=m}return{vat_rate:s,price_excl_vat:o,price_incl_vat:c,quantity:e.returned_quantity}})),f({customer_internal_reference:x.customer_reference||"",total_excl_vat:parseFloat(n.toFixed(2)),total_incl_vat:parseFloat(i.toFixed(2)),lines:l}),[2]}}))}))}),[d,x]),i.createElement(E,{open:d,onClose:v,fullWidth:!0,maxWidth:"lg"},i.createElement(y,null,"Check or overwrite value for the return payment"),i.createElement(h,null,i.createElement(q,{spacing:2,alignItems:"left",sx:{px:0}},i.createElement(j,null,"This is very important because these values will be used for automated invoice generation"),i.createElement(j,{variant:"h5"},"Overwrites"),w?i.createElement(S,null):i.createElement(q,{spacing:2},i.createElement(T,{label:"Customer internal reference",name:"customer_internal_reference",fullWidth:!0,variant:"outlined",value:p.customer_internal_reference,onChange:function(e){return f(r(r({},p),{customer_internal_reference:e.target.value}))}}),i.createElement(T,{label:"Total excl. VAT",name:"total_excl_vat",type:"number",fullWidth:!0,variant:"outlined",value:p.total_excl_vat,onChange:function(e){return f(r(r({},p),{total_excl_vat:parseFloat(e.target.value)}))}}),i.createElement(T,{label:"Total incl. VAT",name:"total_incl_vat",type:"number",fullWidth:!0,variant:"outlined",value:p.total_incl_vat,onChange:function(e){return f(r(r({},p),{total_incl_vat:parseFloat(e.target.value)}))}})),(null===(u=null===(s=null==x?void 0:x.iro_items)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)>0&&i.createElement(i.Fragment,null,i.createElement(j,{variant:"h5"},"Items"),x.iro_items.data.map((function(n,a){var l,o,c,s,u,m,d,v,E,g,h,y,b,x;return i.createElement(q,{spacing:2,direction:"row",alignItems:"center",sx:{px:2},key:n.id},i.createElement(_,{sx:{minWidth:100}},n.line_item_number),i.createElement(_,{sx:{minWidth:150}},null===(l=n.product)||void 0===l?void 0:l.product_number),i.createElement(_,{sx:{minWidth:200}},null===(o=n.product)||void 0===o?void 0:o.title),i.createElement(T,{size:"small",label:"VAT %",name:"vat_rate",type:"number",sx:{width:100},value:null!==(u=null===(s=null===(c=null==p?void 0:p.lines)||void 0===c?void 0:c[a])||void 0===s?void 0:s.vat_rate)&&void 0!==u?u:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{vat_rate:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(T,{size:"small",label:"Price excl.",name:"price_excl_vat",type:"number",sx:{width:120},value:null!==(v=null===(d=null===(m=null==p?void 0:p.lines)||void 0===m?void 0:m[a])||void 0===d?void 0:d.price_excl_vat)&&void 0!==v?v:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{price_excl_vat:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(T,{size:"small",label:"Price incl.",name:"price_incl_vat",type:"number",sx:{width:120},value:null!==(h=null===(g=null===(E=null==p?void 0:p.lines)||void 0===E?void 0:E[a])||void 0===g?void 0:g.price_incl_vat)&&void 0!==h?h:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{price_incl_vat:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(T,{size:"small",label:"Qty",name:"quantity",type:"number",sx:{width:80},value:null!==(x=null===(b=null===(y=null==p?void 0:p.lines)||void 0===y?void 0:y[a])||void 0===b?void 0:b.quantity)&&void 0!==x?x:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{quantity:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}))}))))),i.createElement(g,null,i.createElement(b,{variant:"contained",onClick:function(e){k("iros",[x.id],p),v()}},"Confirm"),i.createElement(b,{variant:"contained",onClick:v},"Cancel")))}function $(e){var t=this,r=e.open,l=e.handleClose,o=e.orderID,c=e.currentStatus,s=e.revalidateCallback,u=e.openOverwritesDialog,m=Y().handleAddMessage;return i.createElement(E,{open:r,onClose:l},i.createElement(y,null,"Confirm Return"),i.createElement(h,null,i.createElement(q,{spacing:2},i.createElement(_,null,"Are you sure you want to confirm this return?"),i.createElement(W,null,"requested"===c&&i.createElement(F,null,"When confirming this return order a rma number will be generated"),i.createElement(F,null,"requested"===c?"By confirming the return you will update it's status from requested to returning":"By confirming the return you will update it's status from finalising_process to done"),"finalising_process"===c&&i.createElement(F,null,"Confirming this order will automatically create an invoice")),i.createElement(_,null,"Current status: ",c))),i.createElement(g,null,i.createElement(b,{variant:"contained",onClick:function(){return n(t,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:if("requested"!==c&&"finalising_process"!==c)return m({message:"Cannot confirm return order in current status",severity:"error"}),[2];if("finalising_process"===c)return u?(u(),l(),[2]):(m({message:"Please provide overwrites for the invoice",severity:"error"}),[2]);e.label=1;case 1:return e.trys.push([1,3,,4]),[4,k("iros",[o])];case 2:return e.sent(),m({message:"Return order confirmed successfully",severity:"success"}),s&&s(),l(),[3,4];case 3:return e.sent(),m({message:"Failed to confirm return order",severity:"error"}),[3,4];case 4:return[2]}}))}))}},"Yes"),i.createElement(b,{variant:"contained",onClick:l},"No")))}function H(t){var r=this,o=t.open,c=t.handleClose,s=t.orderID,u=t.revalidateCallback,m=e(l(""),2),d=m[0],v=m[1],p=e(l(""),2),f=p[0],x=p[1],C=Y().handleAddMessage;return i.createElement("form",null,i.createElement(E,{open:o,onClose:c},i.createElement(y,null,"Cancel Return"),i.createElement(h,null,i.createElement(q,{spacing:2},i.createElement(_,null,"Are you sure you want to cancel this return?"),i.createElement(W,null,i.createElement(F,null,"By cancelling this return order you will update it's status from requested to cancelled"),i.createElement(F,null,"Please provide a reason for the cancellation"),i.createElement(F,null,"The customer will be notified about the cancellation and of the reason for the cancellation")),i.createElement(T,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:d,onChange:function(e){return v(e.target.value)},placeholder:"Please provide a reason for the cancellation",error:!!f,helperText:f}))),i.createElement(g,null,i.createElement(b,{variant:"outlined",onClick:c},"Close"),i.createElement(b,{variant:"contained",color:"error",onClick:function(){return n(r,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:if(d.length<5)return x("Please provide a reason for the cancellation (min 5 characters)"),[2];x(""),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,A("iros",s,d)];case 2:return e.sent(),C({message:"Return order cancelled successfully",severity:"success"}),u&&u(),c(),[3,4];case 3:return e.sent(),C({message:"Failed to cancel return order",severity:"error"}),[3,4];case 4:return[2]}}))}))}},"Confirm Cancellation"))))}function K(n){var a,E,g,h,y=n.data,k=n.sx,A=n.revalidateCallback,j=n.handleClose,S=n.role,T=e(c(s,G),2),W=T[0],F=T[1],V=e(l(y.iro_items.data?y.iro_items.data:[]),2),Q=V[0],K=V[1],L=e(l(!1),2),X=L[0],Z=L[1],ee=e(l(!1),2),te=ee[0],re=ee[1],ne=e(l(!1),2),ae=ne[0],ie=ne[1],le=e(l({customer_internal_reference:"",total_excl_vat:0,total_incl_vat:0,lines:[]}),2),oe=le[0],ce=le[1],se=e(l(["received","registered","released","reports"]),2),ue=se[0],me=se[1],de=function(r,n,a){var i=t([],e(Q),!1),l=i.findIndex((function(e){return e.id===n}));i[l][a]=r,K(i)},ve=function(n,a){var i,l,o,c=t([],e(Q),!1),s=c.findIndex((function(e){return e.id===a})),u=(null===(l=null===(i=c[s])||void 0===i?void 0:i.reports)||void 0===l?void 0:l.data)||[],m=t(t([],e(u),!1),[n],!1);null==(null===(o=c[s])||void 0===o?void 0:o.reports)&&(c[s]=r(r({},c[s]),{reports:{data:[]}})),c[s].reports.data=m,K(c)},pe=function(r,n){var a,i,l=t([],e(Q),!1),o=l.findIndex((function(e){return e.id===r})),c=(null===(i=null===(a=l[o])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],s=c.filter((function(e){return"id"in e})),u=c.filter((function(e){return!("id"in e)}));u.splice(n,1);var m=t(t([],e(s),!1),e(u),!1);l[o].reports.data=m,K(l)},fe=Y().handleAddMessage;return o((function(){(null==W?void 0:W.message)&&(fe({message:W.message,severity:W.severity||"error"}),"success"===W.severity&&(A&&A(),j&&j()))}),[null==W?void 0:W.message]),o((function(){(null==W?void 0:W.strapiErrors)&&fe({message:W.strapiErrors.message||"Error updating IRO",severity:W.severity||"error"})}),[null==W?void 0:W.strapiErrors]),o((function(){var e;console.log("data",y),(null===(e=y.iro_items)||void 0===e?void 0:e.data)&&K(y.iro_items.data?y.iro_items.data:[])}),[y]),i.createElement(C,{sx:t([],e(Array.isArray(k)?k:[k]),!1)},i.createElement(x,{container:!0,spacing:2},i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(q,{direction:"row",spacing:2,justifyContent:"space-between"},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h3",component:"h1"},"Management Inbound Return"),i.createElement(_,{variant:"body1"},"Manage arrival, registration and release of returns")),i.createElement(v,{content:"",related:[{id:y.id,__type:"api::e-commerce.iro"}],revalidateCallback:A})),i.createElement(I,null))),i.createElement(x,{item:!0,xs:12},i.createElement(_,{variant:"h5",sx:{py:1}},"Details")),i.createElement(x,{item:!0,xs:6},i.createElement(w,{elevation:2,sx:{p:2,height:"100%"}},i.createElement(q,{spacing:2},i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(P,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Number"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.return_number)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(O,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"RMA Number"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.rma_number)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(B,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Customer Reference"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.customer_reference)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(M,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Date"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.return_date)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(N,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Customer"),i.createElement(_,{variant:"body1",fontWeight:"medium"},null===(E=null===(a=y.customer)||void 0===a?void 0:a.business_credentials)||void 0===E?void 0:E.company_name)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(z,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Status"),i.createElement(U,{status:y.status}))))),("requested"===y.status||"finalising_process"===y.status)&&"enduser"===S&&i.createElement(x,{item:!0,xs:6},i.createElement(w,{elevation:2,sx:{p:2,height:"100%"}},i.createElement(q,{spacing:2},i.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Z(!0)}},"Confirm order"),"requested"===y.status&&i.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning"),"finalising_process"===y.status&&i.createElement(f,{severity:"warning"},"Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done"),"finalising_process"===y.status&&i.createElement(b,{variant:"contained",sx:{color:"yellow"}},"// TODO RE-PAYMENT PROCESS"),i.createElement(b,{variant:"contained",color:"error",onClick:function(){return re(!0)}},"Cancel order"),i.createElement($,{open:X,handleClose:function(){return Z(!1)},orderID:y.id,currentStatus:y.status,revalidateCallback:A,openOverwritesDialog:function(){return ie(!0)}}),i.createElement(J,{open:ae,handleClose:function(){return ie(!1)},overwrites:oe,setOverwrites:ce,iro:y}),i.createElement(H,{open:te,handleClose:function(){return re(!1)},orderID:y.id,revalidateCallback:A})))),i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h5"},"Documents"),i.createElement(w,{sx:{p:2}},i.createElement(q,{spacing:1})))),(null===(h=null===(g=null==y?void 0:y.notes)||void 0===g?void 0:g.data)||void 0===h?void 0:h.length)>0&&i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h5"},"Notes"),i.createElement(d,{notes:y.notes.data}),i.createElement(I,null))),i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:1},i.createElement(_,{variant:"h5"},"Items"),i.createElement(q,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"}},i.createElement(_,{variant:"body2",color:"text.secondary"},"Show:"),["received","registered","released","reports"].map((function(r){return i.createElement(R,{key:r,control:i.createElement(D,{size:"small",checked:ue.includes(r),onChange:function(n){n.target.checked?me(t(t([],e(ue),!1),[r],!1)):me(ue.filter((function(e){return e!==r})))}}),label:i.createElement(_,{variant:"body2",color:"text.secondary"},r.charAt(0).toUpperCase()+r.slice(1)),sx:{mr:0}})}))),"requested"===y.status&&i.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),i.createElement(I,null),i.createElement("form",{action:F},i.createElement("input",{name:"id",type:"hidden",value:y.id}),i.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){var t,r;return{id:e.id,returned_quantity:e.returned_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map((function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}})))||[]}}))}(Q))}),Q&&Q.map((function(e,t){var r,n;return i.createElement(w,{sx:{p:2,mb:2},key:t},"requested"===y.status||"cancelled"===y.status||"done"===y.status?i.createElement(m,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):i.createElement(u,{item:e,index:t,handleUpdateQuantity:de,handleAddReport:ve,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:pe,revalidateCallback:A,showing:ue}))})),i.createElement(q,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2}},j&&i.createElement(b,{onClick:j,variant:"outlined"},"Cancel"),i.createElement(p,{text:"Save changes",loadingText:"Saving...",variant:"contained"})))))))}export{K as default};
6
+ import{__read as e,__spreadArray as t,__assign as r,__awaiter as n,__generator as a}from"../../../../node_modules/tslib/tslib.es6.js";import i,{useState as l,useEffect as o}from"react";import{useFormState as c}from"react-dom";import{updateIroAction as s}from"../../../data/actions/e-commerce/iro/updateIroAction.js";import u from"./TextualIROItemUpdater.js";import m from"./IroItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import v from"../../logistics/note/NoteTakingComponent.js";import{SubmitButton as p}from"../../SubmitButton.js";import f from"@mui/material/Alert";import E from"@mui/material/Dialog";import g from"@mui/material/DialogActions";import h from"@mui/material/DialogContent";import y from"@mui/material/DialogTitle";import _ from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import w from"@mui/material/Paper";import q from"@mui/material/Stack";import I from"@mui/material/Divider";import{confirmationService as k}from"../../../data/services/common/confirmation-service.js";import{cancellationService as A}from"../../../data/services/common/cancellation-service.js";import{FormControlLabel as R,Checkbox as D,List as j,ListItem as S,DialogContentText as T,CircularProgress as W,TextField as F}from"@mui/material";import P from"@mui/icons-material/Numbers";import O from"@mui/icons-material/AssignmentReturn";import M from"@mui/icons-material/CalendarToday";import N from"@mui/icons-material/Business";import B from"@mui/icons-material/Description";import z from"@mui/icons-material/Update";import{IroStatusIndicator as U}from"./IroStatusIndicator.js";import{queryAllProducts as V}from"../../../data/loaders/e-commerce/queryAllProducts.js";import Q from"../../../../node_modules/qs/lib/index.js";import{useSnackbar as Y}from"../../../context/common/SnackbarContext.js";var G={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function J(c){var s,u,m=this,d=c.open,v=c.handleClose,p=c.overwrites,f=c.setOverwrites,x=c.iro,C=e(l(!1),2),w=C[0],I=C[1];return o(function(){var e,t;d&&(null===(t=null===(e=null==x?void 0:x.iro_items)||void 0===e?void 0:e.data)||void 0===t?void 0:t.length)>0&&n(m,void 0,void 0,function(){var e,t,r,n,i,l;return a(this,function(a){switch(a.label){case 0:return I(!0),e=Q.stringify({filters:{product_number:{$in:x.iro_items.data.map(function(e){var t,r;return(null===(r=null===(t=e.product)||void 0===t?void 0:t.product_number)||void 0===r?void 0:r.replace(/^r-/,""))||""})}},populate:{price:!0}},{encodeValuesOnly:!0}),[4,V(e)];case 1:return t=a.sent(),r=t.data.map(function(e){return{id:e.id,product_number:e.product_number,price:e.price}}),console.log("correspondingProducts",r),I(!1),n=0,i=0,l=x.iro_items.data.map(function(e,t){var a=e.product,l=r.find(function(e){var t;return e.product_number===(null===(t=null==a?void 0:a.product_number)||void 0===t?void 0:t.replace(/^r-/,""))||""}),o=0,c=0,s=0;if(l&&l.price){o=l.price.price||0,c=l.price.price_incl_vat||0,s=l.price.vat_rate||0;var u=o*e.returned_quantity,m=c*e.returned_quantity;n+=u,i+=m}return{vat_rate:s,price_excl_vat:o,price_incl_vat:c,quantity:e.returned_quantity}}),f({customer_internal_reference:x.customer_reference||"",total_excl_vat:parseFloat(n.toFixed(2)),total_incl_vat:parseFloat(i.toFixed(2)),lines:l}),[2]}})})},[d,x]),i.createElement(E,{open:d,onClose:v,fullWidth:!0,maxWidth:"lg"},i.createElement(y,null,"Check or overwrite value for the return payment"),i.createElement(h,null,i.createElement(q,{spacing:2,alignItems:"left",sx:{px:0}},i.createElement(T,null,"This is very important because these values will be used for automated invoice generation"),i.createElement(T,{variant:"h5"},"Overwrites"),w?i.createElement(W,null):i.createElement(q,{spacing:2},i.createElement(F,{label:"Customer internal reference",name:"customer_internal_reference",fullWidth:!0,variant:"outlined",value:p.customer_internal_reference,onChange:function(e){return f(r(r({},p),{customer_internal_reference:e.target.value}))}}),i.createElement(F,{label:"Total excl. VAT",name:"total_excl_vat",type:"number",fullWidth:!0,variant:"outlined",value:p.total_excl_vat,onChange:function(e){return f(r(r({},p),{total_excl_vat:parseFloat(e.target.value)}))}}),i.createElement(F,{label:"Total incl. VAT",name:"total_incl_vat",type:"number",fullWidth:!0,variant:"outlined",value:p.total_incl_vat,onChange:function(e){return f(r(r({},p),{total_incl_vat:parseFloat(e.target.value)}))}})),(null===(u=null===(s=null==x?void 0:x.iro_items)||void 0===s?void 0:s.data)||void 0===u?void 0:u.length)>0&&i.createElement(i.Fragment,null,i.createElement(T,{variant:"h5"},"Items"),x.iro_items.data.map(function(n,a){var l,o,c,s,u,m,d,v,E,g,h,y,b,x;return i.createElement(q,{spacing:2,direction:"row",alignItems:"center",sx:{px:2},key:n.id},i.createElement(_,{sx:{minWidth:100}},n.line_item_number),i.createElement(_,{sx:{minWidth:150}},null===(l=n.product)||void 0===l?void 0:l.product_number),i.createElement(_,{sx:{minWidth:200}},null===(o=n.product)||void 0===o?void 0:o.title),i.createElement(F,{size:"small",label:"VAT %",name:"vat_rate",type:"number",sx:{width:100},value:null!==(u=null===(s=null===(c=null==p?void 0:p.lines)||void 0===c?void 0:c[a])||void 0===s?void 0:s.vat_rate)&&void 0!==u?u:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{vat_rate:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(F,{size:"small",label:"Price excl.",name:"price_excl_vat",type:"number",sx:{width:120},value:null!==(v=null===(d=null===(m=null==p?void 0:p.lines)||void 0===m?void 0:m[a])||void 0===d?void 0:d.price_excl_vat)&&void 0!==v?v:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{price_excl_vat:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(F,{size:"small",label:"Price incl.",name:"price_incl_vat",type:"number",sx:{width:120},value:null!==(h=null===(g=null===(E=null==p?void 0:p.lines)||void 0===E?void 0:E[a])||void 0===g?void 0:g.price_incl_vat)&&void 0!==h?h:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{price_incl_vat:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}),i.createElement(F,{size:"small",label:"Qty",name:"quantity",type:"number",sx:{width:80},value:null!==(x=null===(b=null===(y=null==p?void 0:p.lines)||void 0===y?void 0:y[a])||void 0===b?void 0:b.quantity)&&void 0!==x?x:"",onChange:function(n){var i=t([],e(p.lines||[]),!1);i[a]=r(r({},i[a]),{quantity:parseFloat(n.target.value)}),f(r(r({},p),{lines:i}))}}))})))),i.createElement(g,null,i.createElement(b,{variant:"contained",onClick:function(e){k("iros",[x.id],p),v()}},"Confirm"),i.createElement(b,{variant:"contained",onClick:v},"Cancel")))}function $(e){var t=this,r=e.open,l=e.handleClose,o=e.orderID,c=e.currentStatus,s=e.revalidateCallback,u=e.openOverwritesDialog,m=Y().handleAddMessage;return i.createElement(E,{open:r,onClose:l},i.createElement(y,null,"Confirm Return"),i.createElement(h,null,i.createElement(q,{spacing:2},i.createElement(_,null,"Are you sure you want to confirm this return?"),i.createElement(j,null,"requested"===c&&i.createElement(S,null,"When confirming this return order a rma number will be generated"),i.createElement(S,null,"requested"===c?"By confirming the return you will update it's status from requested to returning":"By confirming the return you will update it's status from finalising_process to done"),"finalising_process"===c&&i.createElement(S,null,"Confirming this order will automatically create an invoice")),i.createElement(_,null,"Current status: ",c))),i.createElement(g,null,i.createElement(b,{variant:"contained",onClick:function(){return n(t,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:if("requested"!==c&&"finalising_process"!==c)return m({message:"Cannot confirm return order in current status",severity:"error"}),[2];if("finalising_process"===c)return u?(u(),l(),[2]):(m({message:"Please provide overwrites for the invoice",severity:"error"}),[2]);e.label=1;case 1:return e.trys.push([1,3,,4]),[4,k("iros",[o])];case 2:return e.sent(),m({message:"Return order confirmed successfully",severity:"success"}),s&&s(),l(),[3,4];case 3:return e.sent(),m({message:"Failed to confirm return order",severity:"error"}),[3,4];case 4:return[2]}})})}},"Yes"),i.createElement(b,{variant:"contained",onClick:l},"No")))}function H(t){var r=this,o=t.open,c=t.handleClose,s=t.orderID,u=t.revalidateCallback,m=e(l(""),2),d=m[0],v=m[1],p=e(l(""),2),f=p[0],x=p[1],C=Y().handleAddMessage;return i.createElement("form",null,i.createElement(E,{open:o,onClose:c},i.createElement(y,null,"Cancel Return"),i.createElement(h,null,i.createElement(q,{spacing:2},i.createElement(_,null,"Are you sure you want to cancel this return?"),i.createElement(j,null,i.createElement(S,null,"By cancelling this return order you will update it's status from requested to cancelled"),i.createElement(S,null,"Please provide a reason for the cancellation"),i.createElement(S,null,"The customer will be notified about the cancellation and of the reason for the cancellation")),i.createElement(F,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:d,onChange:function(e){return v(e.target.value)},placeholder:"Please provide a reason for the cancellation",error:!!f,helperText:f}))),i.createElement(g,null,i.createElement(b,{variant:"outlined",onClick:c},"Close"),i.createElement(b,{variant:"contained",color:"error",onClick:function(){return n(r,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:if(d.length<5)return x("Please provide a reason for the cancellation (min 5 characters)"),[2];x(""),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,A("iros",s,d)];case 2:return e.sent(),C({message:"Return order cancelled successfully",severity:"success"}),u&&u(),c(),[3,4];case 3:return e.sent(),C({message:"Failed to cancel return order",severity:"error"}),[3,4];case 4:return[2]}})})}},"Confirm Cancellation"))))}function K(n){var a,E,g,h,y=n.data,k=n.sx,A=n.revalidateCallback,j=n.handleClose,S=n.role,T=e(c(s,G),2),W=T[0],F=T[1],V=e(l(y.iro_items.data?y.iro_items.data:[]),2),Q=V[0],K=V[1],L=e(l(!1),2),X=L[0],Z=L[1],ee=e(l(!1),2),te=ee[0],re=ee[1],ne=e(l(!1),2),ae=ne[0],ie=ne[1],le=e(l({customer_internal_reference:"",total_excl_vat:0,total_incl_vat:0,lines:[]}),2),oe=le[0],ce=le[1],se=e(l(["received","registered","released","reports"]),2),ue=se[0],me=se[1],de=function(r,n,a){var i=t([],e(Q),!1),l=i.findIndex(function(e){return e.id===n});i[l][a]=r,K(i)},ve=function(n,a){var i,l,o,c=t([],e(Q),!1),s=c.findIndex(function(e){return e.id===a}),u=(null===(l=null===(i=c[s])||void 0===i?void 0:i.reports)||void 0===l?void 0:l.data)||[],m=t(t([],e(u),!1),[n],!1);null==(null===(o=c[s])||void 0===o?void 0:o.reports)&&(c[s]=r(r({},c[s]),{reports:{data:[]}})),c[s].reports.data=m,K(c)},pe=function(r,n){var a,i,l=t([],e(Q),!1),o=l.findIndex(function(e){return e.id===r}),c=(null===(i=null===(a=l[o])||void 0===a?void 0:a.reports)||void 0===i?void 0:i.data)||[],s=c.filter(function(e){return"id"in e}),u=c.filter(function(e){return!("id"in e)});u.splice(n,1);var m=t(t([],e(s),!1),e(u),!1);l[o].reports.data=m,K(l)},fe=Y().handleAddMessage;return o(function(){(null==W?void 0:W.message)&&(fe({message:W.message,severity:W.severity||"error"}),"success"===W.severity&&(A&&A(),j&&j()))},[null==W?void 0:W.message]),o(function(){(null==W?void 0:W.strapiErrors)&&fe({message:W.strapiErrors.message||"Error updating IRO",severity:W.severity||"error"})},[null==W?void 0:W.strapiErrors]),o(function(){var e;console.log("data",y),(null===(e=y.iro_items)||void 0===e?void 0:e.data)&&K(y.iro_items.data?y.iro_items.data:[])},[y]),i.createElement(C,{sx:t([],e(Array.isArray(k)?k:[k]),!1)},i.createElement(x,{container:!0,spacing:2},i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(q,{direction:"row",spacing:2,justifyContent:"space-between"},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h3",component:"h1"},"Management Inbound Return"),i.createElement(_,{variant:"body1"},"Manage arrival, registration and release of returns")),i.createElement(v,{content:"",related:[{id:y.id,__type:"api::e-commerce.iro"}],revalidateCallback:A})),i.createElement(I,null))),i.createElement(x,{item:!0,xs:12},i.createElement(_,{variant:"h5",sx:{py:1}},"Details")),i.createElement(x,{item:!0,xs:6},i.createElement(w,{elevation:2,sx:{p:2,height:"100%"}},i.createElement(q,{spacing:2},i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(P,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Number"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.return_number)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(O,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"RMA Number"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.rma_number)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(B,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Customer Reference"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.customer_reference)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(M,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Date"),i.createElement(_,{variant:"body1",fontWeight:"medium"},y.return_date)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(N,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Customer"),i.createElement(_,{variant:"body1",fontWeight:"medium"},null===(E=null===(a=y.customer)||void 0===a?void 0:a.business_credentials)||void 0===E?void 0:E.company_name)),i.createElement(q,{direction:"row",spacing:2,alignItems:"center"},i.createElement(z,{color:"primary"}),i.createElement(_,{variant:"subtitle1",color:"text.secondary",width:"200px"},"Return Status"),i.createElement(U,{status:y.status}))))),("requested"===y.status||"finalising_process"===y.status)&&"enduser"===S&&i.createElement(x,{item:!0,xs:6},i.createElement(w,{elevation:2,sx:{p:2,height:"100%"}},i.createElement(q,{spacing:2},i.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Z(!0)}},"Confirm order"),"requested"===y.status&&i.createElement(f,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be assigned an RMA number and will become available to the dispatcher. Status: requested - returning"),"finalising_process"===y.status&&i.createElement(f,{severity:"warning"},"Please finalise this return order. Make sure the customer receives a return payment if eligible and then confirm this step. Status: finalising_process - done"),"finalising_process"===y.status&&i.createElement(b,{variant:"contained",sx:{color:"yellow"}},"// TODO RE-PAYMENT PROCESS"),i.createElement(b,{variant:"contained",color:"error",onClick:function(){return re(!0)}},"Cancel order"),i.createElement($,{open:X,handleClose:function(){return Z(!1)},orderID:y.id,currentStatus:y.status,revalidateCallback:A,openOverwritesDialog:function(){return ie(!0)}}),i.createElement(J,{open:ae,handleClose:function(){return ie(!1)},overwrites:oe,setOverwrites:ce,iro:y}),i.createElement(H,{open:te,handleClose:function(){return re(!1)},orderID:y.id,revalidateCallback:A})))),i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h5"},"Documents"),i.createElement(w,{sx:{p:2}},i.createElement(q,{spacing:1})))),(null===(h=null===(g=null==y?void 0:y.notes)||void 0===g?void 0:g.data)||void 0===h?void 0:h.length)>0&&i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:2},i.createElement(_,{variant:"h5"},"Notes"),i.createElement(d,{notes:y.notes.data}),i.createElement(I,null))),i.createElement(x,{item:!0,xs:12},i.createElement(q,{spacing:1},i.createElement(_,{variant:"h5"},"Items"),i.createElement(q,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:w,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"}},i.createElement(_,{variant:"body2",color:"text.secondary"},"Show:"),["received","registered","released","reports"].map(function(r){return i.createElement(R,{key:r,control:i.createElement(D,{size:"small",checked:ue.includes(r),onChange:function(n){n.target.checked?me(t(t([],e(ue),!1),[r],!1)):me(ue.filter(function(e){return e!==r}))}}),label:i.createElement(_,{variant:"body2",color:"text.secondary"},r.charAt(0).toUpperCase()+r.slice(1)),sx:{mr:0}})})),"requested"===y.status&&i.createElement(f,{severity:"warning"},"Before confirmation you cannot update the items"),i.createElement(I,null),i.createElement("form",{action:F},i.createElement("input",{name:"id",type:"hidden",value:y.id}),i.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map(function(e){var t,r;return{id:e.id,returned_quantity:e.returned_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:(null===(r=null===(t=e.reports)||void 0===t?void 0:t.data)||void 0===r?void 0:r.map(function(e){return{id:"id"in e?e.id:void 0,quantity:e.quantity,content:e.content,type:e.type}}))||[]}})}(Q))}),Q&&Q.map(function(e,t){var r,n;return i.createElement(w,{sx:{p:2,mb:2},key:t},"requested"===y.status||"cancelled"===y.status||"done"===y.status?i.createElement(m,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):i.createElement(u,{item:e,index:t,handleUpdateQuantity:de,handleAddReport:ve,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,handleRemoveReportAtIndex:pe,revalidateCallback:A,showing:ue}))}),i.createElement(q,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2}},j&&i.createElement(b,{onClick:j,variant:"outlined"},"Cancel"),i.createElement(p,{text:"Save changes",loadingText:"Saving...",variant:"contained"})))))))}export{K as default};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{SubmitButton as m}from"../../SubmitButton.js";import{CustomerSelector as s}from"../customer/CustomerSelector.js";import{OPOItemFields as c}from"./OPOItemFields.js";import{useSnackbar as l}from"../../../context/common/SnackbarContext.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Stack";import v from"@mui/material/Button";var g={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function y(y){var x=y.sx,C=y.revalidateCallback,b=y.handleClose,w=y.customerLabels,j=y.productLabels,k=e(a(!1),2),A=k[0],I=k[1],L=e(n(i,g),2),O=L[0],S=L[1],B=l().handleAddMessage;return o((function(){(null==O?void 0:O.message)&&(B({message:O.message,severity:O.severity||"error"}),"success"===O.severity&&(C&&C(),b&&b()))}),[null==O?void 0:O.message]),o((function(){(null==O?void 0:O.strapiErrors)&&B({message:O.strapiErrors.message||"Error creating order",severity:O.severity||"error"})}),[null==O?void 0:O.strapiErrors]),t.createElement(p,{sx:r([],e(Array.isArray(x)?x:[x]),!1)},t.createElement("form",{action:S},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h3",component:"h1"},"Create new order"))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(s,{customerLabels:w}))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products for this order"),t.createElement(c,{productsArr:j})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices"),t.createElement(h,{direction:"row",spacing:1,alignItems:"center"},t.createElement(E,{value:A,checked:A,onChange:function(){return I(!A)}}),A&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:A?"ordered":"placed"})),t.createElement(d,{item:!0,xs:12},t.createElement(h,{direction:"row",justifyContent:"space-between"},b&&t.createElement(v,{onClick:b,variant:"outlined"},"Cancel"),t.createElement(m,{text:"Confirm",loadingText:"Loading...",variant:"contained"}))))))}export{y as default};
7
+ import{__read as e,__spreadArray as r}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a,useEffect as o}from"react";import{useFormState as n}from"react-dom";import{createOpoAction as i}from"../../../data/actions/e-commerce/opo/createOpoAction.js";import{SubmitButton as m}from"../../SubmitButton.js";import{CustomerSelector as s}from"../customer/CustomerSelector.js";import{OPOItemFields as c}from"./OPOItemFields.js";import{useSnackbar as l}from"../../../context/common/SnackbarContext.js";import u from"@mui/material/Typography";import d from"@mui/material/Grid";import p from"@mui/material/Box";import f from"@mui/material/TextField";import E from"@mui/material/Checkbox";import h from"@mui/material/Stack";import v from"@mui/material/Button";var g={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function y(y){var x=y.sx,C=y.revalidateCallback,b=y.handleClose,w=y.customerLabels,j=y.productLabels,k=e(a(!1),2),A=k[0],I=k[1],L=e(n(i,g),2),O=L[0],S=L[1],B=l().handleAddMessage;return o(function(){(null==O?void 0:O.message)&&(B({message:O.message,severity:O.severity||"error"}),"success"===O.severity&&(C&&C(),b&&b()))},[null==O?void 0:O.message]),o(function(){(null==O?void 0:O.strapiErrors)&&B({message:O.strapiErrors.message||"Error creating order",severity:O.severity||"error"})},[null==O?void 0:O.strapiErrors]),t.createElement(p,{sx:r([],e(Array.isArray(x)?x:[x]),!1)},t.createElement("form",{action:S},t.createElement(d,{container:!0,spacing:2},t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h3",component:"h1"},"Create new order"))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Choose a customer"),t.createElement(s,{customerLabels:w}))),t.createElement(d,{item:!0,xs:12},t.createElement(h,{spacing:2},t.createElement(u,{variant:"h6"},"Customer reference"),t.createElement(u,null,"If the customer utilizes a custom reference for inbound order management it should be left here"),t.createElement(f,{id:"customer_reference",name:"customer_reference",sx:{width:"100%"}}))),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Choose products for this order"),t.createElement(c,{productsArr:j})),t.createElement(d,{item:!0,xs:12},t.createElement(u,{variant:"h6"},"Confirm Order"),t.createElement(u,null,"Are you sure you want to confirm this order? Creating a order this way will not create a shipping label nor will it invoke a payment. It does however create an invoice which you can find under invoices"),t.createElement(h,{direction:"row",spacing:1,alignItems:"center"},t.createElement(E,{value:A,checked:A,onChange:function(){return I(!A)}}),A&&t.createElement(u,{color:"primary"},"I am sure I want to confirm this order")),t.createElement("input",{name:"status",type:"hidden",value:A?"ordered":"placed"})),t.createElement(d,{item:!0,xs:12},t.createElement(h,{direction:"row",justifyContent:"space-between"},b&&t.createElement(v,{onClick:b,variant:"outlined"},"Cancel"),t.createElement(m,{text:"Confirm",loadingText:"Loading...",variant:"contained"}))))))}export{y as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import s from"./OpoItemDisplay.js";import d from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{SubmitButton as u}from"../../SubmitButton.js";import v from"@mui/material/Alert";import E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import g from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import k from"@mui/material/Divider";import{confirmationService as D}from"../../../data/services/common/confirmation-service.js";import{useSnackbar as j}from"../../../context/common/SnackbarContext.js";var O={zodErrors:null,strapiErrors:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(E,{open:t},a.createElement(g,null,"Confirm Order"),a.createElement(y,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){D("opos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function N(E){var f,y,g,D,N,A=E.opo,I=E.sx,S=E.revalidateCallback,B=E.handleClose,F=E.role,P=e(i(o,O),2),M=P[0],T=P[1],U=j().handleAddMessage,z=e(r(A.opo_items.data?A.opo_items.data:[]),2),G=z[0],H=z[1],J=e(r(!1),2),L=J[0],Q=J[1],R=function(a,r,n){var i=t([],e(G),!1),o=i.findIndex((function(e){return e.id===r}));i[o][n]=a,H(i)};return n((function(){var e;(null===(e=A.opo_items)||void 0===e?void 0:e.data)&&H(A.opo_items.data)}),[A]),n((function(){(null==M?void 0:M.message)&&(U({message:M.message,severity:M.severity||"error"}),"success"===M.severity&&(S&&S(),B&&B()))}),[null==M?void 0:M.message]),n((function(){(null==M?void 0:M.strapiErrors)&&U({message:M.strapiErrors.message||"Error updating OPO",severity:M.severity||"error"})}),[null==M?void 0:M.strapiErrors]),a.createElement(C,{sx:t([],e(Array.isArray(I)?I:[I]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Manage Outbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:A.id,__type:"api::e-commerce.opo"}],revalidateCallback:S})),a.createElement(k,null))),a.createElement(x,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},A.opo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},A.customer_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},A.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Customer"),a.createElement(h,{variant:"body2"},null===(y=null===(f=A.customer)||void 0===f?void 0:f.business_credentials)||void 0===y?void 0:y.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},A.status)),("placed"===A.status||"external_shipping_process"===A.status)&&"enduser"===F&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),a.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(q,{open:L,handleClose:function(){return Q(!1)},orderID:A.id,currentStatus:A.status,revalidateCallback:S})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},A.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(g=A.delivery_note)||void 0===g?void 0:g.name),a.createElement(b,{variant:"contained",onClick:function(){m("api/opos/".concat(A.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(k,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:A.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:S})))))),(null===(N=null===(D=null==A?void 0:A.notes)||void 0===D?void 0:D.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(d,{notes:A.notes.data}),a.createElement(k,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===A.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(k,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:A.id}),G&&G.map((function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===A.status?a.createElement(s,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:R,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:S}))})),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},B&&a.createElement(b,{onClick:B,variant:"outlined"},"Cancel"),a.createElement(u,{text:"Update items",loadingText:"Loading..."}))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map((function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}}))}(G))}))))))}export{N as default};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,useEffect as n}from"react";import{useFormState as i}from"react-dom";import{updateOpoAction as o}from"../../../data/actions/e-commerce/opo/updateOpoAction.js";import{UploadBase64MediaForm as l}from"../../common/media/UploadBase64MediaForm.js";import m from"../../../data/loaders/common/media/downloadBase64File.js";import c from"./OpoItemUpdater.js";import d from"./OpoItemDisplay.js";import s from"../../logistics/note/NotesDisplay.js";import p from"../../logistics/note/NoteTakingComponent.js";import{SubmitButton as u}from"../../SubmitButton.js";import v from"@mui/material/Alert";import E from"@mui/material/Dialog";import f from"@mui/material/DialogActions";import y from"@mui/material/DialogContent";import g from"@mui/material/DialogTitle";import h from"@mui/material/Typography";import b from"@mui/material/Button";import x from"@mui/material/Grid";import C from"@mui/material/Box";import _ from"@mui/material/Paper";import w from"@mui/material/Stack";import k from"@mui/material/Divider";import{confirmationService as D}from"../../../data/services/common/confirmation-service.js";import{useSnackbar as j}from"../../../context/common/SnackbarContext.js";var O={zodErrors:null,strapiErrors:null,message:null};function q(e){var t=e.open,r=e.handleClose,n=e.orderID,i=e.currentStatus,o=e.revalidateCallback;return a.createElement(E,{open:t},a.createElement(g,null,"Confirm Order"),a.createElement(y,null,a.createElement(w,{spacing:2},a.createElement(h,null,"Are you sure you want to confirm this order?"),a.createElement(h,null,"Current status: ",i))),a.createElement(f,null,a.createElement(b,{variant:"contained",onClick:function(e){D("opos",[n]),o&&o()}},"Confirm"),a.createElement(b,{variant:"contained",onClick:r},"Cancel")))}function N(E){var f,y,g,D,N,A=E.opo,I=E.sx,S=E.revalidateCallback,B=E.handleClose,F=E.role,P=e(i(function(e,t){return o(A.id,e,t)},O),2),M=P[0],T=P[1],U=j().handleAddMessage,z=e(r(A.opo_items.data?A.opo_items.data:[]),2),G=z[0],H=z[1],J=e(r(!1),2),L=J[0],Q=J[1],R=function(a,r,n){var i=t([],e(G),!1),o=i.findIndex(function(e){return e.id===r});i[o][n]=a,H(i)};return n(function(){var e;(null===(e=A.opo_items)||void 0===e?void 0:e.data)&&H(A.opo_items.data)},[A]),n(function(){(null==M?void 0:M.message)&&(U({message:M.message,severity:M.severity||"error"}),"success"===M.severity&&(S&&S(),B&&B()))},[null==M?void 0:M.message]),n(function(){(null==M?void 0:M.strapiErrors)&&U({message:M.strapiErrors.message||"Error updating OPO",severity:M.severity||"error"})},[null==M?void 0:M.strapiErrors]),a.createElement(C,{sx:t([],e(Array.isArray(I)?I:[I]),!1)},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h3",component:"h1"},"Manage Outbound Purchase Order"),a.createElement(h,{variant:"body1"},"Manage picking, packing and shipping of purchase order")),a.createElement(p,{content:"",related:[{id:A.id,__type:"api::e-commerce.opo"}],revalidateCallback:S})),a.createElement(k,null))),a.createElement(x,{item:!0,xs:6},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Details"),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Purchase Order Number"),a.createElement(h,{variant:"body2"},A.opo_number)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Custom reference"),a.createElement(h,{variant:"body2"},A.customer_reference)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Date"),a.createElement(h,{variant:"body2"},A.order_date)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Customer"),a.createElement(h,{variant:"body2"},null===(y=null===(f=A.customer)||void 0===f?void 0:f.business_credentials)||void 0===y?void 0:y.company_name)),a.createElement(w,{direction:"row",spacing:2},a.createElement(h,{variant:"body1",width:"250px"},"Order Status"),a.createElement(h,{variant:"body2",width:"250px"},A.status)),("placed"===A.status||"external_shipping_process"===A.status)&&"enduser"===F&&a.createElement(a.Fragment,null,a.createElement(b,{variant:"contained",color:"primary",onClick:function(){return Q(!0)}},"Confirm order"),a.createElement(v,{severity:"warning"},"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"),a.createElement(q,{open:L,handleClose:function(){return Q(!1)},orderID:A.id,currentStatus:A.status,revalidateCallback:S})))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Documents"),a.createElement(_,{sx:{p:2}},a.createElement(w,{spacing:1},A.delivery_note?a.createElement(a.Fragment,null,a.createElement(h,{variant:"h6"},"Delivery Note"),a.createElement(h,null,null===(g=A.delivery_note)||void 0===g?void 0:g.name),a.createElement(b,{variant:"contained",onClick:function(){m("api/opos/".concat(A.id),"delivery_note")}},"Download")):a.createElement(a.Fragment,null,a.createElement(h,{variant:"h5"},"Delivery Note"),a.createElement(h,{variant:"body1"},"Here you can upload the the delivery note for this order"),a.createElement(k,null),a.createElement(l,{reference:"api::e-commerce.opo",refID:A.id,field:"delivery_note",multiple:!1,accept:"text/*,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",path:"api/opos",componentName:"delivery_note",componentReference:"common.base64-encoded-media",revalidateCallback:S})))))),(null===(N=null===(D=null==A?void 0:A.notes)||void 0===D?void 0:D.data)||void 0===N?void 0:N.length)>0&&a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:2},a.createElement(h,{variant:"h5"},"Notes"),a.createElement(s,{notes:A.notes.data}),a.createElement(k,null))),a.createElement(x,{item:!0,xs:12},a.createElement(w,{spacing:1},a.createElement(h,{variant:"h5"},"Items"),"placed"===A.status&&a.createElement(v,{severity:"warning"},"Before confirmation you cannot update the items"),a.createElement(k,null),a.createElement("form",{action:T},a.createElement("input",{name:"id",type:"hidden",value:A.id}),G&&G.map(function(e,t){var r,n;return console.log("item",e),a.createElement(_,{sx:{p:2,mb:2},key:t},"placed"===A.status?a.createElement(d,{item:e,index:t,image:null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.image}):a.createElement(c,{item:e,index:t,handleUpdateQuantity:R,image:null===(n=null==e?void 0:e.product)||void 0===n?void 0:n.image,revalidateCallback:S}))}),a.createElement(_,{sx:{p:2}},a.createElement(w,{direction:"row",spacing:2,justifyContent:"space-between"},B&&a.createElement(b,{onClick:B,variant:"outlined"},"Cancel"),a.createElement(u,{text:"Update items",loadingText:"Loading..."}))),a.createElement("input",{type:"hidden",name:"items",value:JSON.stringify(function(e){return e.map(function(e){return{id:e.id,ordered_quantity:e.ordered_quantity,picked_quantity:e.picked_quantity,packed_quantity:e.packed_quantity,shipped_quantity:e.shipped_quantity}})}(G))}))))))}export{N as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as m}from"react";import i from"@mui/material/Table";import a from"@mui/material/TableHead";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import p from"@mui/material/Typography";import s from"@mui/material/Stack";import f from"@mui/material/TextField";import E from"../products/ProductSelector.js";import"../../../../node_modules/dayjs/dayjs.min.js";import h from"@mui/icons-material/Delete";import{useTheme as b}from"@mui/material/styles";function x(x){var g=x.productsArr,w=e(n([]),2),y=w[0],v=w[1],_=e(n(null),2),T=_[0],C=_[1],j=e(n(0),2),k=j[0],A=j[1],I=e(n([]),2),N=I[0],P=I[1];b();var S=e(n([]),2),B=S[0],q=S[1];return m((function(){q(function(e){return e.map((function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product.id,ordered_quantity:e.amount}}))}(y))}),[y]),r.createElement(s,{spacing:2},r.createElement(i,null,r.createElement(a,null,r.createElement(u,null,r.createElement(o,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(o,{sx:[{width:"70%"}]},"Product Number"),r.createElement(o,{sx:[{width:"15%"}]},"Amount"),r.createElement(o,{sx:[]}))),r.createElement(l,null,y.map((function(e,t){return r.createElement(u,{key:t},r.createElement(o,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(o,{sx:[{width:"70%"}]},e.product.product_number," | ",e.product.title),r.createElement(o,{sx:{width:"15%"}},e.amount),r.createElement(o,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=y.filter((function(t,r){return r!==e}));v(t)}(t)}},r.createElement(h,null))))})))),r.createElement("input",{type:"hidden",name:"opo_items",value:JSON.stringify(B)}),r.createElement(s,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(p,{variant:"body1",sx:{width:"15%"}},y.length+1,".0.0"),g&&r.createElement(E,{productNames:g,currentValue:N,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=g.find((function(t){return t.id===e[0]}));C(t||null),P(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:k,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?A(0):A(parseInt(e.target.value)):A(0)},sx:{width:"15%"}}),r.createElement(c,{onClick:function(){if(null!==T&&null!==k){var r={product:T,amount:k};v(t(t([],e(y),!1),[r],!1)),C(null),A(0),P([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{x as OPOItemFields};
6
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n,useEffect as m}from"react";import i from"@mui/material/Table";import a from"@mui/material/TableHead";import l from"@mui/material/TableBody";import o from"@mui/material/TableCell";import u from"@mui/material/TableRow";import c from"@mui/material/IconButton";import d from"@mui/icons-material/Add";import p from"@mui/material/Typography";import s from"@mui/material/Stack";import f from"@mui/material/TextField";import E from"../products/ProductSelector.js";import"../../../../node_modules/dayjs/dayjs.min.js";import h from"@mui/icons-material/Delete";import{useTheme as b}from"@mui/material/styles";function x(x){var g=x.productsArr,w=e(n([]),2),y=w[0],v=w[1],_=e(n(null),2),T=_[0],C=_[1],j=e(n(0),2),k=j[0],A=j[1],I=e(n([]),2),N=I[0],P=I[1];b();var S=e(n([]),2),B=S[0],q=S[1];return m(function(){q(function(e){return e.map(function(e,t){return{line_item_number:"".concat(t+1,".0.0"),product:e.product.id,ordered_quantity:e.amount}})}(y))},[y]),r.createElement(s,{spacing:2},r.createElement(i,null,r.createElement(a,null,r.createElement(u,null,r.createElement(o,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),r.createElement(o,{sx:[{width:"70%"}]},"Product Number"),r.createElement(o,{sx:[{width:"15%"}]},"Amount"),r.createElement(o,{sx:[]}))),r.createElement(l,null,y.map(function(e,t){return r.createElement(u,{key:t},r.createElement(o,{sx:[{width:"15%"}]},t+1,".0.0"),r.createElement(o,{sx:[{width:"70%"}]},e.product.product_number," | ",e.product.title),r.createElement(o,{sx:{width:"15%"}},e.amount),r.createElement(o,{align:"right",sx:{width:"5%"}},r.createElement(c,{onClick:function(){return function(e){var t=y.filter(function(t,r){return r!==e});v(t)}(t)}},r.createElement(h,null))))}))),r.createElement("input",{type:"hidden",name:"opo_items",value:JSON.stringify(B)}),r.createElement(s,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},r.createElement(p,{variant:"body1",sx:{width:"15%"}},y.length+1,".0.0"),g&&r.createElement(E,{productNames:g,currentValue:N,sx:{width:"70%"},multiple:!1,onChangeCallback:function(e){var t=g.find(function(t){return t.id===e[0]});C(t||null),P(e)}}),r.createElement(f,{id:"amount",name:"amount",type:"number",label:"Amount",value:k,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?A(0):A(parseInt(e.target.value)):A(0)},sx:{width:"15%"}}),r.createElement(c,{onClick:function(){if(null!==T&&null!==k){var r={product:T,amount:k};v(t(t([],e(y),!1),[r],!1)),C(null),A(0),P([])}else console.log("nextProductName or nextAmount is null")}},r.createElement(d,null))))}export{x as OPOItemFields};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import n from"../../common/ImagePreviewTooltip.js";import a from"../../logistics/report/ReportsDisplay.js";function i(i){var c,m,o=i.item,l=i.index,p=i.image,d=o.line_item_number,s=o.product,u=o.ordered_quantity,E=o.picked_quantity,g=o.packed_quantity,v=o.shipped_quantity,y=o.reports;return e.createElement(t,{spacing:1,key:l},o&&e.createElement(t,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Line Item Number: ",d),e.createElement(r,{variant:"body1"},"Part Number: ",null==s?void 0:s.product_number)),p&&e.createElement(e.Fragment,null,e.createElement(n,{image:p,label:null===(c=o.product)||void 0===c?void 0:c.title}))),e.createElement(t,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center"},e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Ordered"),e.createElement(r,{variant:"h6"},u)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Received"),e.createElement(r,{variant:"h6"},E)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Registered"),e.createElement(r,{variant:"h6"},g)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Released"),e.createElement(r,{variant:"h6"},v))),(null===(m=null==y?void 0:y.data)||void 0===m?void 0:m.length)>0&&e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reports:"),e.createElement(a,{reports:y.data.filter((function(e){return"id"in e&&!("pre_report"in e)}))})))}export{i as default};
6
+ import e from"react";import t from"@mui/material/Stack";import r from"@mui/material/Typography";import n from"../../common/ImagePreviewTooltip.js";import a from"../../logistics/report/ReportsDisplay.js";function i(i){var c,m,o=i.item,l=i.index,p=i.image,d=o.line_item_number,s=o.product,u=o.ordered_quantity,E=o.picked_quantity,g=o.packed_quantity,v=o.shipped_quantity,y=o.reports;return e.createElement(t,{spacing:1,key:l},o&&e.createElement(t,{direction:"row",justifyContent:"space-between",alignItems:"center"},e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Line Item Number: ",d),e.createElement(r,{variant:"body1"},"Part Number: ",null==s?void 0:s.product_number)),p&&e.createElement(e.Fragment,null,e.createElement(n,{image:p,label:null===(c=o.product)||void 0===c?void 0:c.title}))),e.createElement(t,{direction:"row",spacing:1,justifyContent:"space-between",alignItems:"center"},e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Ordered"),e.createElement(r,{variant:"h6"},u)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Received"),e.createElement(r,{variant:"h6"},E)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Registered"),e.createElement(r,{variant:"h6"},g)),e.createElement(t,{direction:"row",spacing:1,alignItems:"center"},e.createElement(r,{variant:"caption"},"Released"),e.createElement(r,{variant:"h6"},v))),(null===(m=null==y?void 0:y.data)||void 0===m?void 0:m.length)>0&&e.createElement(t,{spacing:1},e.createElement(r,{variant:"body1"},"Reports:"),e.createElement(a,{reports:y.data.filter(function(e){return"id"in e&&!("pre_report"in e)})})))}export{i as default};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as a}from"react";import n from"@mui/material/Stack";import r from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import c from"@mui/icons-material/ArrowDropDown";import u from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/report/ReportMakingComponent.js";import p from"../../logistics/report/ReportsDisplay.js";function s(s){var f=s.item,y=s.index,E=s.handleUpdateQuantity,g=s.image,v=s.revalidateCallback,b=f.line_item_number,h=f.product,k=f.ordered_quantity,V=f.picked_quantity,w=f.packed_quantity,_=f.shipped_quantity,q=f.reports,C=e(a(!1),2),N=C[0],x=C[1];t.useMemo((function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"picked"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[q]);var j=t.useMemo((function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"packed"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[q]);return t.useMemo((function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter((function(e){return"shipped"===e.type})).reduce((function(e,t){return e+t.quantity}),0):0}),[q]),t.createElement(n,{spacing:1,key:y},f&&t.createElement(t.Fragment,null,t.createElement(n,{direction:"row",justifyContent:"space-between"},t.createElement(n,{spacing:1},t.createElement(r,{variant:"body1"},"Line Item Number: ",b),t.createElement(r,{variant:"body1"},"Part Number: ",null==h?void 0:h.product_number)),g&&t.createElement(t.Fragment,null,t.createElement(u,{image:g,label:null==h?void 0:h.title}))),t.createElement(r,{variant:"body2"},"Picked"),t.createElement(m,{currentValue:V,totalValue:k+-j,minNewValue:0+w+-j,maxNewValue:k+-j,color:"info",handleChange:function(e){E(e,f.id,"picked_quantity")}}),t.createElement(r,{variant:"body2"},"Packed"),t.createElement(m,{currentValue:w,totalValue:k,minNewValue:0+_,maxNewValue:V+j,color:"info",handleChange:function(e){E(e,f.id,"packed_quantity")},offsetEnd:j}),t.createElement(o,{sx:{p:0}},t.createElement(n,{direction:"row",spacing:1,alignItems:"center"},t.createElement(r,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return x(!N)}},t.createElement(c,null)))),t.createElement(l,{in:N},t.createElement(n,{spacing:2},t.createElement(r,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:q.data}),t.createElement(d,{content:"content",quantity:0,type:"packed",minValue:-(V+j),maxValue:0,related:[{id:f.id,__type:"api::e-commerce.opo-item"}],revalidateCallback:v}))),t.createElement(r,{variant:"body2"},"Shipped"),t.createElement(m,{currentValue:_,totalValue:k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){E(e,f.id,"shipped_quantity")}})))}export{s as default};
6
+ import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n}from"react";import r from"@mui/material/Stack";import a from"@mui/material/Typography";import i from"@mui/material/IconButton";import o from"@mui/material/Divider";import l from"@mui/material/Collapse";import{AmountUpdater as m}from"../../common/AmountUpdater.js";import u from"@mui/icons-material/ArrowDropDown";import c from"../../common/ImagePreviewTooltip.js";import d from"../../logistics/report/ReportMakingComponent.js";import p from"../../logistics/report/ReportsDisplay.js";function f(f){var s=f.item,y=f.index,E=f.handleUpdateQuantity,g=f.image,v=f.revalidateCallback,b=s.line_item_number,h=s.product,k=s.ordered_quantity,V=s.picked_quantity,w=s.packed_quantity,_=s.shipped_quantity,q=s.reports,C=e(n(!1),2),N=C[0],x=C[1];t.useMemo(function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter(function(e){return"picked"===e.type}).reduce(function(e,t){return e+t.quantity},0):0},[q]);var j=t.useMemo(function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter(function(e){return"packed"===e.type}).reduce(function(e,t){return e+t.quantity},0):0},[q]);return t.useMemo(function(){return void 0!==(null==q?void 0:q.data)&&q.data.length>0?q.data.filter(function(e){return"shipped"===e.type}).reduce(function(e,t){return e+t.quantity},0):0},[q]),t.createElement(r,{spacing:1,key:y},s&&t.createElement(t.Fragment,null,t.createElement(r,{direction:"row",justifyContent:"space-between"},t.createElement(r,{spacing:1},t.createElement(a,{variant:"body1"},"Line Item Number: ",b),t.createElement(a,{variant:"body1"},"Part Number: ",null==h?void 0:h.product_number)),g&&t.createElement(t.Fragment,null,t.createElement(c,{image:g,label:null==h?void 0:h.title}))),t.createElement(a,{variant:"body2"},"Picked"),t.createElement(m,{currentValue:V,totalValue:k+-j,minNewValue:0+w+-j,maxNewValue:k+-j,color:"info",handleChange:function(e){E(e,s.id,"picked_quantity")}}),t.createElement(a,{variant:"body2"},"Packed"),t.createElement(m,{currentValue:w,totalValue:k,minNewValue:0+_,maxNewValue:V+j,color:"info",handleChange:function(e){E(e,s.id,"packed_quantity")},offsetEnd:j}),t.createElement(o,{sx:{p:0}},t.createElement(r,{direction:"row",spacing:1,alignItems:"center"},t.createElement(a,{variant:"body2"},"Irregularities / Corrections"),t.createElement(i,{onClick:function(){return x(!N)}},t.createElement(u,null)))),t.createElement(l,{in:N},t.createElement(r,{spacing:2},t.createElement(a,{variant:"body2"},"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"),t.createElement(p,{reports:q.data.filter(function(e){return"id"in e&&"number"==typeof e.id})}),t.createElement(d,{content:"content",quantity:0,type:"packed",minValue:-(V+j),maxValue:0,related:[{id:s.id,__type:"api::e-commerce.opo-item"}],revalidateCallback:v}))),t.createElement(a,{variant:"body2"},"Shipped"),t.createElement(m,{currentValue:_,totalValue:k,minNewValue:0,maxNewValue:w,color:"info",handleChange:function(e){E(e,s.id,"shipped_quantity")}})))}export{f as default};