create-myexam-app 1.0.21 → 1.0.23

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 (226) hide show
  1. package/index.js +25 -17
  2. package/package.json +1 -1
  3. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/README.md +84 -0
  4. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/.env +3 -0
  5. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/config/db.js +13 -0
  6. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/authController.js +115 -0
  7. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/employeeController.js +97 -0
  8. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/payrollController.js +113 -0
  9. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/reportController.js +35 -0
  10. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/middleware/authMiddleware.js +9 -0
  11. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Employee.js +52 -0
  12. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Payroll.js +50 -0
  13. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/User.js +19 -0
  14. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package-lock.json +1509 -0
  15. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package.json +19 -0
  16. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/authRoutes.js +18 -0
  17. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/employeeRoutes.js +19 -0
  18. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/payrollRoutes.js +19 -0
  19. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/reportRoutes.js +9 -0
  20. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/server.js +71 -0
  21. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/index.html +12 -0
  22. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package-lock.json +2888 -0
  23. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package.json +23 -0
  24. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/postcss.config.js +6 -0
  25. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/App.jsx +57 -0
  26. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/apiClient.js +16 -0
  27. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/authApi.js +26 -0
  28. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/employeeApi.js +26 -0
  29. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/payrollApi.js +26 -0
  30. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/reportApi.js +6 -0
  31. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Header.jsx +17 -0
  32. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Layout.jsx +17 -0
  33. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Message.jsx +15 -0
  34. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/ProtectedRoute.jsx +41 -0
  35. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Sidebar.jsx +38 -0
  36. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/index.css +30 -0
  37. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/main.jsx +13 -0
  38. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/DashboardPage.jsx +64 -0
  39. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/EmployeePage.jsx +166 -0
  40. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/LoginPage.jsx +73 -0
  41. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/PayrollPage.jsx +198 -0
  42. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/RecoverPasswordPage.jsx +69 -0
  43. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/RegisterPage.jsx +69 -0
  44. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/ReportsPage.jsx +113 -0
  45. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/tailwind.config.js +13 -0
  46. package/projects/EPMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/vite.config.js +9 -0
  47. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/README.md +106 -0
  48. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/01_Introduction.md +8 -0
  49. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/02_Problem_Statement.md +12 -0
  50. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/03_Objectives.md +17 -0
  51. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/04_Technologies_Used.md +23 -0
  52. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/05_ERD.md +60 -0
  53. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/06_Database_Design.md +71 -0
  54. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/07_System_Architecture.md +28 -0
  55. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/08_API_Documentation.md +43 -0
  56. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/09_Testing.md +43 -0
  57. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/10_Challenges.md +12 -0
  58. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/REPORT/11_Conclusion.md +8 -0
  59. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/.env.example +4 -0
  60. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/config/db.js +16 -0
  61. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/deliveryController.js +145 -0
  62. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/shipmentController.js +149 -0
  63. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/supplierController.js +56 -0
  64. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/userController.js +158 -0
  65. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/middleware/authMiddleware.js +9 -0
  66. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Delivery.js +34 -0
  67. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Shipment.js +34 -0
  68. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Supplier.js +38 -0
  69. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/User.js +21 -0
  70. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package-lock.json +1540 -0
  71. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package.json +22 -0
  72. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/deliveryRoutes.js +11 -0
  73. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/shipmentRoutes.js +11 -0
  74. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/supplierRoutes.js +9 -0
  75. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/userRoutes.js +11 -0
  76. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/server.js +70 -0
  77. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/.env.example +2 -0
  78. package/projects/{SCMS/frontend → SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project}/index.html +2 -2
  79. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package-lock.json +2944 -0
  80. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package.json +23 -0
  81. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/postcss.config.js +6 -0
  82. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/App.jsx +72 -0
  83. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/apiClient.js +14 -0
  84. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/deliveryApi.js +17 -0
  85. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/shipmentApi.js +17 -0
  86. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/supplierApi.js +9 -0
  87. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/userApi.js +21 -0
  88. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Layout.jsx +16 -0
  89. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Message.jsx +15 -0
  90. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/PageHeader.jsx +12 -0
  91. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Sidebar.jsx +40 -0
  92. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/main.jsx +13 -0
  93. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Dashboard.jsx +62 -0
  94. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Delivery.jsx +212 -0
  95. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Login.jsx +158 -0
  96. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Logout.jsx +24 -0
  97. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Reports.jsx +221 -0
  98. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Shipment.jsx +212 -0
  99. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/Supplier.jsx +118 -0
  100. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/styles.css +27 -0
  101. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/tailwind.config.js +8 -0
  102. package/projects/SCMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/vite.config.js +6 -0
  103. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/README.md +84 -0
  104. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/.env +3 -0
  105. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/config/db.js +13 -0
  106. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/productController.js +29 -0
  107. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/reportController.js +52 -0
  108. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/stockTransactionController.js +128 -0
  109. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/userController.js +115 -0
  110. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/controllers/warehouseController.js +29 -0
  111. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/middleware/authMiddleware.js +9 -0
  112. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Product.js +44 -0
  113. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/StockTransaction.js +33 -0
  114. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/User.js +19 -0
  115. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/models/Warehouse.js +25 -0
  116. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package-lock.json +1509 -0
  117. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/package.json +19 -0
  118. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/productRoutes.js +10 -0
  119. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/reportRoutes.js +9 -0
  120. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/stockTransactionRoutes.js +17 -0
  121. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/userRoutes.js +18 -0
  122. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/routes/warehouseRoutes.js +10 -0
  123. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/backend-project/server.js +73 -0
  124. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/index.html +12 -0
  125. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package-lock.json +2888 -0
  126. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/package.json +23 -0
  127. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/postcss.config.js +6 -0
  128. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/App.jsx +66 -0
  129. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/apiClient.js +16 -0
  130. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/productApi.js +11 -0
  131. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/reportApi.js +6 -0
  132. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/transactionApi.js +21 -0
  133. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/userApi.js +26 -0
  134. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/api/warehouseApi.js +11 -0
  135. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Header.jsx +17 -0
  136. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Layout.jsx +17 -0
  137. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Message.jsx +15 -0
  138. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/ProtectedRoute.jsx +41 -0
  139. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/components/Sidebar.jsx +39 -0
  140. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/index.css +30 -0
  141. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/main.jsx +13 -0
  142. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/DashboardPage.jsx +64 -0
  143. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/LoginPage.jsx +73 -0
  144. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/ProductPage.jsx +107 -0
  145. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/RecoverPasswordPage.jsx +69 -0
  146. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/RegisterPage.jsx +69 -0
  147. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/ReportsPage.jsx +152 -0
  148. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/TransactionPage.jsx +195 -0
  149. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/src/pages/WarehousePage.jsx +93 -0
  150. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/tailwind.config.js +13 -0
  151. package/projects/SHMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026/frontend-project/vite.config.js +9 -0
  152. package/projects/SMS-/frontend-project/src/pages/Reports.jsx +179 -23
  153. package/projects/SRMS/frontend/src/pages/Reports.jsx +170 -58
  154. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/README.md +49 -0
  155. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/.env +3 -0
  156. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/middleware/authMiddleware.js +19 -0
  157. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/models/Customer.js +11 -0
  158. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/models/Product.js +10 -0
  159. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/models/Sale.js +19 -0
  160. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/models/User.js +8 -0
  161. package/projects/{SCMS/backend → SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project}/package-lock.json +1609 -2190
  162. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/package.json +20 -0
  163. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/routes/authRoutes.js +75 -0
  164. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/routes/customerRoutes.js +42 -0
  165. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/routes/productRoutes.js +41 -0
  166. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/routes/reportRoutes.js +129 -0
  167. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/routes/saleRoutes.js +107 -0
  168. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/backend-project/server.js +49 -0
  169. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/dist/assets/index-DZxY56Bj.js +75 -0
  170. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/dist/assets/index-J8MKb3Fq.css +1 -0
  171. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/dist/index.html +13 -0
  172. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/index.html +12 -0
  173. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/package-lock.json +2029 -0
  174. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/package.json +21 -0
  175. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/App.jsx +77 -0
  176. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/index.css +333 -0
  177. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/main.jsx +10 -0
  178. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Customers.jsx +85 -0
  179. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Dashboard.jsx +75 -0
  180. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Login.jsx +65 -0
  181. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Products.jsx +91 -0
  182. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Register.jsx +82 -0
  183. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Reports.jsx +138 -0
  184. package/projects/SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project/src/pages/Sales.jsx +154 -0
  185. package/projects/{SCMS/frontend → SRMS(Ely)/KALIWABO_SHEMA_ELYSEE_National_Practical_Examination_2026(/frontend-project}/vite.config.js +5 -3
  186. package/projects/SCMS/backend/.env +0 -5
  187. package/projects/SCMS/backend/config/db.js +0 -12
  188. package/projects/SCMS/backend/controllers/authController.js +0 -90
  189. package/projects/SCMS/backend/controllers/deliveryController.js +0 -79
  190. package/projects/SCMS/backend/controllers/productController.js +0 -74
  191. package/projects/SCMS/backend/controllers/reportsController.js +0 -77
  192. package/projects/SCMS/backend/controllers/shipmentController.js +0 -80
  193. package/projects/SCMS/backend/controllers/supplierController.js +0 -58
  194. package/projects/SCMS/backend/middleware/auth.js +0 -32
  195. package/projects/SCMS/backend/models/User.js +0 -28
  196. package/projects/SCMS/backend/models/delivery.js +0 -33
  197. package/projects/SCMS/backend/models/product.js +0 -43
  198. package/projects/SCMS/backend/models/shipment.js +0 -34
  199. package/projects/SCMS/backend/models/supplier.js +0 -36
  200. package/projects/SCMS/backend/package.json +0 -23
  201. package/projects/SCMS/backend/routes/SupplierRoutes.js +0 -15
  202. package/projects/SCMS/backend/routes/authRoutes.js +0 -11
  203. package/projects/SCMS/backend/routes/deliveryRoutes.js +0 -18
  204. package/projects/SCMS/backend/routes/productRoutes.js +0 -15
  205. package/projects/SCMS/backend/routes/protectedRoutes.js +0 -10
  206. package/projects/SCMS/backend/routes/reportsRoutes.js +0 -8
  207. package/projects/SCMS/backend/routes/shipmentRoutes.js +0 -18
  208. package/projects/SCMS/backend/server.js +0 -35
  209. package/projects/SCMS/frontend/README.md +0 -16
  210. package/projects/SCMS/frontend/eslint.config.js +0 -21
  211. package/projects/SCMS/frontend/package-lock.json +0 -3053
  212. package/projects/SCMS/frontend/package.json +0 -31
  213. package/projects/SCMS/frontend/public/favicon.svg +0 -1
  214. package/projects/SCMS/frontend/src/App.jsx +0 -35
  215. package/projects/SCMS/frontend/src/components/DashboardLayout.jsx +0 -103
  216. package/projects/SCMS/frontend/src/components/ProtectedRoute.jsx +0 -30
  217. package/projects/SCMS/frontend/src/index.css +0 -114
  218. package/projects/SCMS/frontend/src/main.jsx +0 -10
  219. package/projects/SCMS/frontend/src/pages/DashboardHome.jsx +0 -34
  220. package/projects/SCMS/frontend/src/pages/Delivery.jsx +0 -183
  221. package/projects/SCMS/frontend/src/pages/Login.jsx +0 -81
  222. package/projects/SCMS/frontend/src/pages/Profile.jsx +0 -62
  223. package/projects/SCMS/frontend/src/pages/Register.jsx +0 -110
  224. package/projects/SCMS/frontend/src/pages/Reports.jsx +0 -94
  225. package/projects/SCMS/frontend/src/pages/Shipment.jsx +0 -182
  226. package/projects/SCMS/frontend/src/pages/Supplier.jsx +0 -165
@@ -0,0 +1,17 @@
1
+ # 03. Objectives
2
+
3
+ ## General Objective
4
+
5
+ To develop a Supply Chain Management System that helps SupplyNet Ltd manage suppliers, shipments, deliveries, and reports digitally.
6
+
7
+ ## Specific Objectives
8
+
9
+ - To create a secure login system using sessions and encrypted passwords.
10
+ - To insert supplier records with validation and duplicate prevention.
11
+ - To manage shipment records using insert, get, update, and delete operations.
12
+ - To manage delivery records using insert, get, update, and delete operations.
13
+ - To connect suppliers to shipments using Mongoose references.
14
+ - To connect shipments to deliveries using Mongoose references.
15
+ - To generate daily, weekly, and monthly reports.
16
+ - To design a responsive user interface using React.js and Tailwind CSS.
17
+
@@ -0,0 +1,23 @@
1
+ # 04. Technologies Used
2
+
3
+ ## Frontend Technologies
4
+
5
+ - React.js: Used to build the user interface.
6
+ - React Router DOM: Used for page navigation.
7
+ - Axios: Used to send requests from frontend to backend.
8
+ - Tailwind CSS: Used for responsive styling.
9
+
10
+ ## Backend Technologies
11
+
12
+ - Node.js: Used as the JavaScript runtime environment.
13
+ - Express.js: Used to create REST API routes.
14
+ - Mongoose: Used to model and validate MongoDB data.
15
+ - bcryptjs: Used to encrypt user passwords.
16
+ - express-session: Used for session-based authentication.
17
+ - cors: Used to allow frontend and backend communication.
18
+ - dotenv: Used to manage environment variables.
19
+
20
+ ## Database
21
+
22
+ - MongoDB: Used as the NoSQL database.
23
+
@@ -0,0 +1,60 @@
1
+ # 05. Entity Relationship Diagram
2
+
3
+ ## Entity List
4
+
5
+ 1. User
6
+ 2. Supplier
7
+ 3. Shipment
8
+ 4. Delivery
9
+
10
+ ## Primary Keys
11
+
12
+ - User: `_id`
13
+ - Supplier: `_id`
14
+ - Shipment: `_id`
15
+ - Delivery: `_id`
16
+
17
+ MongoDB automatically creates `_id` as the primary key for every document.
18
+
19
+ ## Important Unique Fields
20
+
21
+ - User: `username`
22
+ - Supplier: `supplierCode`, `email`
23
+ - Shipment: `shipmentNumber`
24
+ - Delivery: `deliveryCode`
25
+
26
+ ## Foreign Key References
27
+
28
+ - Shipment contains `supplier`, which references Supplier `_id`.
29
+ - Delivery contains `shipment`, which references Shipment `_id`.
30
+
31
+ ## Relationships and Cardinalities
32
+
33
+ ### Supplier to Shipment
34
+
35
+ One Supplier can have many Shipments.
36
+
37
+ Manual ERD drawing:
38
+
39
+ ```text
40
+ Supplier (1) -------------------- (Many) Shipment
41
+ ```
42
+
43
+ The `supplier` field in the Shipment collection stores the referenced Supplier `_id`.
44
+
45
+ ### Shipment to Delivery
46
+
47
+ One Shipment can have many Deliveries.
48
+
49
+ Manual ERD drawing:
50
+
51
+ ```text
52
+ Shipment (1) -------------------- (Many) Delivery
53
+ ```
54
+
55
+ The `shipment` field in the Delivery collection stores the referenced Shipment `_id`.
56
+
57
+ ## ERD Drawing Explanation
58
+
59
+ Draw four rectangles named User, Supplier, Shipment, and Delivery. Under each rectangle, list its fields. Mark `_id` as the primary key. In Shipment, mark `supplier` as a foreign key to Supplier. In Delivery, mark `shipment` as a foreign key to Shipment. Connect Supplier to Shipment using a one-to-many line. Connect Shipment to Delivery using a one-to-many line.
60
+
@@ -0,0 +1,71 @@
1
+ # 06. Database Design
2
+
3
+ ## Database Name
4
+
5
+ ```text
6
+ SCMS
7
+ ```
8
+
9
+ ## Collections
10
+
11
+ ### Users
12
+
13
+ Fields:
14
+
15
+ - username
16
+ - password
17
+
18
+ Validation:
19
+
20
+ - username is required and unique.
21
+ - password is required and encrypted using bcrypt.
22
+
23
+ ### Suppliers
24
+
25
+ Fields:
26
+
27
+ - supplierCode
28
+ - supplierName
29
+ - telephone
30
+ - address
31
+ - email
32
+
33
+ Validation:
34
+
35
+ - All fields are required.
36
+ - supplierCode is unique.
37
+ - email is unique.
38
+
39
+ ### Shipments
40
+
41
+ Fields:
42
+
43
+ - supplier
44
+ - shipmentNumber
45
+ - shipmentDate
46
+ - shipmentStatus
47
+ - destination
48
+
49
+ Validation:
50
+
51
+ - All fields are required.
52
+ - shipmentNumber is unique.
53
+ - supplier references the Suppliers collection.
54
+
55
+ ### Deliveries
56
+
57
+ Fields:
58
+
59
+ - shipment
60
+ - deliveryCode
61
+ - deliveryDate
62
+ - quantityDelivered
63
+ - deliveryStatus
64
+
65
+ Validation:
66
+
67
+ - All fields are required.
68
+ - deliveryCode is unique.
69
+ - quantityDelivered must be greater than zero.
70
+ - shipment references the Shipments collection.
71
+
@@ -0,0 +1,28 @@
1
+ # 07. System Architecture
2
+
3
+ The system uses MVC architecture on the backend and a component-based React frontend.
4
+
5
+ ## Backend MVC Structure
6
+
7
+ - Models: Define MongoDB collections and validation rules.
8
+ - Controllers: Contain business logic for authentication and CRUD operations.
9
+ - Routes: Define API endpoints.
10
+ - Middleware: Protect routes using session authentication.
11
+ - Config: Contains MongoDB database connection.
12
+
13
+ ## Frontend Structure
14
+
15
+ - api: Contains Axios API request files.
16
+ - components: Contains reusable layout and message components.
17
+ - pages: Contains main system pages.
18
+
19
+ ## System Flow
20
+
21
+ 1. The user logs in from the React frontend.
22
+ 2. The backend checks username and encrypted password.
23
+ 3. If login is successful, a session is created.
24
+ 4. The user can access protected pages.
25
+ 5. React sends requests to Express API routes using Axios.
26
+ 6. Controllers process requests and use Mongoose models to communicate with MongoDB.
27
+ 7. Data is returned to the frontend and displayed in forms, tables, and reports.
28
+
@@ -0,0 +1,43 @@
1
+ # 08. API Documentation
2
+
3
+ Base URL:
4
+
5
+ ```text
6
+ http://localhost:5000/api
7
+ ```
8
+
9
+ ## User API
10
+
11
+ | Method | Endpoint | Description |
12
+ | --- | --- | --- |
13
+ | POST | `/users/register` | Create a user account |
14
+ | POST | `/users/login` | Login user |
15
+ | POST | `/users/recover-password` | Recover password |
16
+ | POST | `/users/logout` | Logout user |
17
+ | GET | `/users/session` | Get current session user |
18
+
19
+ ## Supplier API
20
+
21
+ | Method | Endpoint | Description |
22
+ | --- | --- | --- |
23
+ | POST | `/suppliers` | Insert supplier |
24
+ | GET | `/suppliers` | Get suppliers for display, dropdowns, and reports |
25
+
26
+ ## Shipment API
27
+
28
+ | Method | Endpoint | Description |
29
+ | --- | --- | --- |
30
+ | POST | `/shipments` | Insert shipment |
31
+ | GET | `/shipments` | Get shipments |
32
+ | PUT | `/shipments/:id` | Update shipment |
33
+ | DELETE | `/shipments/:id` | Delete shipment |
34
+
35
+ ## Delivery API
36
+
37
+ | Method | Endpoint | Description |
38
+ | --- | --- | --- |
39
+ | POST | `/deliveries` | Insert delivery |
40
+ | GET | `/deliveries` | Get deliveries |
41
+ | PUT | `/deliveries/:id` | Update delivery |
42
+ | DELETE | `/deliveries/:id` | Delete delivery |
43
+
@@ -0,0 +1,43 @@
1
+ # 09. Testing
2
+
3
+ ## Authentication Testing
4
+
5
+ - Create a new user with username and password.
6
+ - Try to create another user with the same username.
7
+ - Login using valid credentials.
8
+ - Login using invalid credentials.
9
+ - Recover password and login with the new password.
10
+ - Logout and confirm protected pages are not accessible.
11
+
12
+ ## Supplier Testing
13
+
14
+ - Insert a supplier with all required fields.
15
+ - Try to insert a supplier with missing fields.
16
+ - Try to insert duplicate supplierCode.
17
+ - Try to insert duplicate email.
18
+
19
+ ## Shipment Testing
20
+
21
+ - Insert a shipment linked to an existing supplier.
22
+ - Display all shipments.
23
+ - Update shipment information.
24
+ - Delete a shipment.
25
+ - Confirm duplicate shipmentNumber is prevented.
26
+
27
+ ## Delivery Testing
28
+
29
+ - Insert a delivery linked to an existing shipment.
30
+ - Display all deliveries.
31
+ - Update delivery information.
32
+ - Delete a delivery.
33
+ - Confirm duplicate deliveryCode is prevented.
34
+
35
+ ## Report Testing
36
+
37
+ - Open Reports page.
38
+ - Select Daily Report.
39
+ - Select Weekly Report.
40
+ - Select Monthly Report.
41
+ - Change between Suppliers, Shipments, and Deliveries.
42
+ - Print report using the Print Report button.
43
+
@@ -0,0 +1,12 @@
1
+ # 10. Challenges
2
+
3
+ During development, the following challenges may be faced:
4
+
5
+ - Maintaining correct references between Supplier, Shipment, and Delivery.
6
+ - Preventing duplicate records using unique fields.
7
+ - Protecting backend routes using session authentication.
8
+ - Displaying reports for different periods.
9
+ - Keeping the user interface simple and responsive.
10
+
11
+ These challenges were handled using Mongoose validation, duplicate checking in controllers, Express session middleware, and responsive Tailwind CSS classes.
12
+
@@ -0,0 +1,8 @@
1
+ # 11. Conclusion
2
+
3
+ The Supply Chain Management System was developed to help SupplyNet Ltd manage suppliers, shipments, and deliveries digitally.
4
+
5
+ The system includes session-based authentication, password encryption, MVC backend architecture, MongoDB database design, React frontend pages, and printable reports.
6
+
7
+ This project meets the National Practical Examination requirements by using simple, readable, and assessment-friendly MERN stack code.
8
+
@@ -0,0 +1,4 @@
1
+ PORT=5000
2
+ MONGO_URI=mongodb://127.0.0.1:27017/SCMS
3
+ SESSION_SECRET=scms_exam_secret
4
+ CLIENT_URLS=http://localhost:5173,http://localhost:5174
@@ -0,0 +1,16 @@
1
+ var mongoose = require("mongoose");
2
+
3
+ function connectDB() {
4
+ var mongoURI = process.env.MONGO_URI || "mongodb://127.0.0.1:27017/SCMS";
5
+
6
+ return mongoose.connect(mongoURI)
7
+ .then(function () {
8
+ console.log("MongoDB connected successfully to SCMS database");
9
+ })
10
+ .catch(function (error) {
11
+ console.error("MongoDB connection failed:", error.message);
12
+ process.exit(1);
13
+ });
14
+ }
15
+
16
+ module.exports = connectDB;
@@ -0,0 +1,145 @@
1
+ var Delivery = require("../models/Delivery");
2
+ var Shipment = require("../models/Shipment");
3
+
4
+ function createDelivery(req, res) {
5
+ var shipment = req.body.shipment;
6
+ var deliveryCode = req.body.deliveryCode;
7
+ var deliveryDate = req.body.deliveryDate;
8
+ var quantityDelivered = req.body.quantityDelivered;
9
+ var deliveryStatus = req.body.deliveryStatus;
10
+
11
+ if (!shipment || !deliveryCode || !deliveryDate || !quantityDelivered || !deliveryStatus) {
12
+ return res.status(400).json({ message: "All delivery fields are required" });
13
+ }
14
+
15
+ Shipment.findById(shipment)
16
+ .then(function (shipmentExists) {
17
+ if (!shipmentExists) {
18
+ return { shipmentNotFound: true };
19
+ }
20
+
21
+ return Delivery.findOne({ deliveryCode: deliveryCode });
22
+ })
23
+ .then(function (deliveryExists) {
24
+ if (deliveryExists && deliveryExists.shipmentNotFound) {
25
+ return res.status(404).json({ message: "Selected shipment was not found" });
26
+ }
27
+
28
+ if (deliveryExists) {
29
+ return res.status(409).json({ message: "Delivery code already exists" });
30
+ }
31
+
32
+ return Delivery.create({
33
+ shipment: shipment,
34
+ deliveryCode: deliveryCode,
35
+ deliveryDate: deliveryDate,
36
+ quantityDelivered: quantityDelivered,
37
+ deliveryStatus: deliveryStatus,
38
+ });
39
+ })
40
+ .then(function (delivery) {
41
+ if (!delivery) {
42
+ return;
43
+ }
44
+
45
+ res.status(201).json({ message: "Delivery inserted successfully", delivery: delivery });
46
+ })
47
+ .catch(function (error) {
48
+ res.status(500).json({ message: "Failed to insert delivery", error: error.message });
49
+ });
50
+ }
51
+
52
+ function getDeliveries(req, res) {
53
+ Delivery.find()
54
+ .populate({
55
+ path: "shipment",
56
+ select: "shipmentNumber destination shipmentDate supplier",
57
+ populate: { path: "supplier", select: "supplierName supplierCode" },
58
+ })
59
+ .sort({ createdAt: -1 })
60
+ .then(function (deliveries) {
61
+ res.status(200).json(deliveries);
62
+ })
63
+ .catch(function (error) {
64
+ res.status(500).json({ message: "Failed to get deliveries", error: error.message });
65
+ });
66
+ }
67
+
68
+ function updateDelivery(req, res) {
69
+ var id = req.params.id;
70
+ var shipment = req.body.shipment;
71
+ var deliveryCode = req.body.deliveryCode;
72
+ var deliveryDate = req.body.deliveryDate;
73
+ var quantityDelivered = req.body.quantityDelivered;
74
+ var deliveryStatus = req.body.deliveryStatus;
75
+
76
+ if (!shipment || !deliveryCode || !deliveryDate || !quantityDelivered || !deliveryStatus) {
77
+ return res.status(400).json({ message: "All delivery fields are required" });
78
+ }
79
+
80
+ Shipment.findById(shipment)
81
+ .then(function (shipmentExists) {
82
+ if (!shipmentExists) {
83
+ return { shipmentNotFound: true };
84
+ }
85
+
86
+ return Delivery.findOne({
87
+ deliveryCode: deliveryCode,
88
+ _id: { $ne: id },
89
+ });
90
+ })
91
+ .then(function (duplicateDelivery) {
92
+ if (duplicateDelivery && duplicateDelivery.shipmentNotFound) {
93
+ return res.status(404).json({ message: "Selected shipment was not found" });
94
+ }
95
+
96
+ if (duplicateDelivery) {
97
+ return res.status(409).json({ message: "Delivery code already exists" });
98
+ }
99
+
100
+ return Delivery.findByIdAndUpdate(
101
+ id,
102
+ {
103
+ shipment: shipment,
104
+ deliveryCode: deliveryCode,
105
+ deliveryDate: deliveryDate,
106
+ quantityDelivered: quantityDelivered,
107
+ deliveryStatus: deliveryStatus,
108
+ },
109
+ { new: true, runValidators: true }
110
+ );
111
+ })
112
+ .then(function (delivery) {
113
+ if (!delivery) {
114
+ return;
115
+ }
116
+
117
+ res.status(200).json({ message: "Delivery updated successfully", delivery: delivery });
118
+ })
119
+ .catch(function (error) {
120
+ res.status(500).json({ message: "Failed to update delivery", error: error.message });
121
+ });
122
+ }
123
+
124
+ function deleteDelivery(req, res) {
125
+ var id = req.params.id;
126
+
127
+ Delivery.findByIdAndDelete(id)
128
+ .then(function (delivery) {
129
+ if (!delivery) {
130
+ return res.status(404).json({ message: "Delivery not found" });
131
+ }
132
+
133
+ res.status(200).json({ message: "Delivery deleted successfully" });
134
+ })
135
+ .catch(function (error) {
136
+ res.status(500).json({ message: "Failed to delete delivery", error: error.message });
137
+ });
138
+ }
139
+
140
+ module.exports = {
141
+ createDelivery: createDelivery,
142
+ getDeliveries: getDeliveries,
143
+ updateDelivery: updateDelivery,
144
+ deleteDelivery: deleteDelivery,
145
+ };
@@ -0,0 +1,149 @@
1
+ var Shipment = require("../models/Shipment");
2
+ var Supplier = require("../models/Supplier");
3
+ var Delivery = require("../models/Delivery");
4
+
5
+ function createShipment(req, res) {
6
+ var supplier = req.body.supplier;
7
+ var shipmentNumber = req.body.shipmentNumber;
8
+ var shipmentDate = req.body.shipmentDate;
9
+ var shipmentStatus = req.body.shipmentStatus;
10
+ var destination = req.body.destination;
11
+
12
+ if (!supplier || !shipmentNumber || !shipmentDate || !shipmentStatus || !destination) {
13
+ return res.status(400).json({ message: "All shipment fields are required" });
14
+ }
15
+
16
+ Supplier.findById(supplier)
17
+ .then(function (supplierExists) {
18
+ if (!supplierExists) {
19
+ return { supplierNotFound: true };
20
+ }
21
+
22
+ return Shipment.findOne({ shipmentNumber: shipmentNumber });
23
+ })
24
+ .then(function (shipmentExists) {
25
+ if (shipmentExists && shipmentExists.supplierNotFound) {
26
+ return res.status(404).json({ message: "Selected supplier was not found" });
27
+ }
28
+
29
+ if (shipmentExists) {
30
+ return res.status(409).json({ message: "Shipment number already exists" });
31
+ }
32
+
33
+ return Shipment.create({
34
+ supplier: supplier,
35
+ shipmentNumber: shipmentNumber,
36
+ shipmentDate: shipmentDate,
37
+ shipmentStatus: shipmentStatus,
38
+ destination: destination,
39
+ });
40
+ })
41
+ .then(function (shipment) {
42
+ if (!shipment) {
43
+ return;
44
+ }
45
+
46
+ res.status(201).json({ message: "Shipment inserted successfully", shipment: shipment });
47
+ })
48
+ .catch(function (error) {
49
+ res.status(500).json({ message: "Failed to insert shipment", error: error.message });
50
+ });
51
+ }
52
+
53
+ function getShipments(req, res) {
54
+ Shipment.find()
55
+ .populate("supplier", "supplierCode supplierName telephone")
56
+ .sort({ createdAt: -1 })
57
+ .then(function (shipments) {
58
+ res.status(200).json(shipments);
59
+ })
60
+ .catch(function (error) {
61
+ res.status(500).json({ message: "Failed to get shipments", error: error.message });
62
+ });
63
+ }
64
+
65
+ function updateShipment(req, res) {
66
+ var id = req.params.id;
67
+ var supplier = req.body.supplier;
68
+ var shipmentNumber = req.body.shipmentNumber;
69
+ var shipmentDate = req.body.shipmentDate;
70
+ var shipmentStatus = req.body.shipmentStatus;
71
+ var destination = req.body.destination;
72
+
73
+ if (!supplier || !shipmentNumber || !shipmentDate || !shipmentStatus || !destination) {
74
+ return res.status(400).json({ message: "All shipment fields are required" });
75
+ }
76
+
77
+ Supplier.findById(supplier)
78
+ .then(function (supplierExists) {
79
+ if (!supplierExists) {
80
+ return { supplierNotFound: true };
81
+ }
82
+
83
+ return Shipment.findOne({
84
+ shipmentNumber: shipmentNumber,
85
+ _id: { $ne: id },
86
+ });
87
+ })
88
+ .then(function (duplicateShipment) {
89
+ if (duplicateShipment && duplicateShipment.supplierNotFound) {
90
+ return res.status(404).json({ message: "Selected supplier was not found" });
91
+ }
92
+
93
+ if (duplicateShipment) {
94
+ return res.status(409).json({ message: "Shipment number already exists" });
95
+ }
96
+
97
+ return Shipment.findByIdAndUpdate(
98
+ id,
99
+ {
100
+ supplier: supplier,
101
+ shipmentNumber: shipmentNumber,
102
+ shipmentDate: shipmentDate,
103
+ shipmentStatus: shipmentStatus,
104
+ destination: destination,
105
+ },
106
+ { new: true, runValidators: true }
107
+ );
108
+ })
109
+ .then(function (shipment) {
110
+ if (!shipment) {
111
+ return;
112
+ }
113
+
114
+ res.status(200).json({ message: "Shipment updated successfully", shipment: shipment });
115
+ })
116
+ .catch(function (error) {
117
+ res.status(500).json({ message: "Failed to update shipment", error: error.message });
118
+ });
119
+ }
120
+
121
+ function deleteShipment(req, res) {
122
+ var id = req.params.id;
123
+
124
+ Shipment.findByIdAndDelete(id)
125
+ .then(function (shipment) {
126
+ if (!shipment) {
127
+ return null;
128
+ }
129
+
130
+ return Delivery.deleteMany({ shipment: id });
131
+ })
132
+ .then(function (result) {
133
+ if (!result) {
134
+ return res.status(404).json({ message: "Shipment not found" });
135
+ }
136
+
137
+ res.status(200).json({ message: "Shipment deleted successfully" });
138
+ })
139
+ .catch(function (error) {
140
+ res.status(500).json({ message: "Failed to delete shipment", error: error.message });
141
+ });
142
+ }
143
+
144
+ module.exports = {
145
+ createShipment: createShipment,
146
+ getShipments: getShipments,
147
+ updateShipment: updateShipment,
148
+ deleteShipment: deleteShipment,
149
+ };
@@ -0,0 +1,56 @@
1
+ var Supplier = require("../models/Supplier");
2
+
3
+ function createSupplier(req, res) {
4
+ var supplierCode = req.body.supplierCode;
5
+ var supplierName = req.body.supplierName;
6
+ var telephone = req.body.telephone;
7
+ var address = req.body.address;
8
+ var email = req.body.email;
9
+
10
+ if (!supplierCode || !supplierName || !telephone || !address || !email) {
11
+ return res.status(400).json({ message: "All supplier fields are required" });
12
+ }
13
+
14
+ Supplier.findOne({
15
+ $or: [{ supplierCode: supplierCode }, { email: email }],
16
+ })
17
+ .then(function (supplierExists) {
18
+ if (supplierExists) {
19
+ return res.status(409).json({ message: "Supplier code or email already exists" });
20
+ }
21
+
22
+ return Supplier.create({
23
+ supplierCode: supplierCode,
24
+ supplierName: supplierName,
25
+ telephone: telephone,
26
+ address: address,
27
+ email: email,
28
+ });
29
+ })
30
+ .then(function (supplier) {
31
+ if (!supplier) {
32
+ return;
33
+ }
34
+
35
+ res.status(201).json({ message: "Supplier inserted successfully", supplier: supplier });
36
+ })
37
+ .catch(function (error) {
38
+ res.status(500).json({ message: "Failed to insert supplier", error: error.message });
39
+ });
40
+ }
41
+
42
+ function getSuppliers(req, res) {
43
+ Supplier.find()
44
+ .sort({ createdAt: -1 })
45
+ .then(function (suppliers) {
46
+ res.status(200).json(suppliers);
47
+ })
48
+ .catch(function (error) {
49
+ res.status(500).json({ message: "Failed to get suppliers", error: error.message });
50
+ });
51
+ }
52
+
53
+ module.exports = {
54
+ createSupplier: createSupplier,
55
+ getSuppliers: getSuppliers,
56
+ };