wad-lab 1.2.2 → 1.2.4

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 (207) hide show
  1. package/bin/index.js +477 -627
  2. package/package.json +1 -1
  3. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +241 -429
  4. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
  5. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
  6. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemTable.vue +177 -0
  7. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +150 -441
  8. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
  9. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemStats.vue +64 -0
  10. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemTable.vue +195 -0
  11. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +41 -90
  12. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemFormModal.vue +173 -0
  13. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemTable.vue +102 -0
  14. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/NavBar.vue +57 -0
  15. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +132 -296
  16. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +126 -219
  17. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
  18. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemTable.vue +104 -0
  19. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/SideBar.vue +59 -0
  20. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
  21. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
  22. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
  23. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
  24. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/App.vue +19 -70
  25. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
  26. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
  27. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
  28. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
  29. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
  30. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
  31. package/templates/game-bingo/script.js +1 -1
  32. package/templates/game-memory-cards/script.js +2 -2
  33. package/templates/game-rock-paper-scissors/index.html +3 -3
  34. package/templates/game-rock-paper-scissors/script.js +2 -2
  35. package/templates/game-tic-tac-toe/script.js +2 -2
  36. package/templates/game-whack-a-mole/index.html +9 -9
  37. package/templates/servlet-basic/WEB-INF/ItemServlet.java +13 -0
  38. package/templates/servlet-basic/WEB-INF/classes/ItemServlet.class +0 -0
  39. package/templates/servlet-flow/WEB-INF/HelloServlet.java +34 -25
  40. package/templates/servlet-flow/WEB-INF/classes/HelloServlet.class +0 -0
  41. package/templates/servlet-jdbc/WEB-INF/JdbcItemServlet.java +13 -0
  42. package/templates/servlet-jdbc/WEB-INF/classes/JdbcItemServlet.class +0 -0
  43. package/templates/snippets/mongo-queries-cheatsheet.txt +105 -0
  44. package/templates/springboot-2model-aggregation-join/.mvn/wrapper/maven-wrapper.properties +3 -0
  45. package/templates/springboot-2model-aggregation-join/mvnw +295 -0
  46. package/templates/springboot-2model-aggregation-join/mvnw.cmd +189 -0
  47. package/templates/springboot-2model-aggregation-join/pom.xml +54 -0
  48. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/AggregationApplication.java +11 -0
  49. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/DepartmentController.java +65 -0
  50. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/EmployeeController.java +65 -0
  51. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/DepartmentStatsDTO.java +15 -0
  52. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/EmployeeJoinDTO.java +19 -0
  53. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Department.java +20 -0
  54. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Employee.java +21 -0
  55. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/DepartmentRepository.java +9 -0
  56. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/EmployeeRepository.java +9 -0
  57. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/DepartmentService.java +81 -0
  58. package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/EmployeeService.java +80 -0
  59. package/templates/springboot-2model-aggregation-join/src/main/resources/application.properties +2 -0
  60. package/templates/springboot-2model-aggregation-join/src/test/java/com/example/aggregation/AggregationApplicationTests.java +13 -0
  61. package/templates/vue-2model-crud-patch/README.md +64 -0
  62. package/templates/vue-2model-crud-patch/index.html +12 -0
  63. package/templates/vue-2model-crud-patch/package-lock.json +1785 -0
  64. package/templates/vue-2model-crud-patch/package.json +21 -0
  65. package/templates/vue-2model-crud-patch/src/App.vue +63 -0
  66. package/templates/vue-2model-crud-patch/src/components/AnalyticsBoard.vue +291 -0
  67. package/templates/vue-2model-crud-patch/src/components/DepartmentFormModal.vue +138 -0
  68. package/templates/vue-2model-crud-patch/src/components/DepartmentPatchModal.vue +210 -0
  69. package/templates/vue-2model-crud-patch/src/components/DepartmentTable.vue +133 -0
  70. package/templates/vue-2model-crud-patch/src/components/EmployeeFormModal.vue +177 -0
  71. package/templates/vue-2model-crud-patch/src/components/EmployeePatchModal.vue +221 -0
  72. package/templates/vue-2model-crud-patch/src/components/EmployeeTable.vue +171 -0
  73. package/templates/vue-2model-crud-patch/src/components/NavBar.vue +156 -0
  74. package/templates/vue-2model-crud-patch/src/main.js +12 -0
  75. package/templates/vue-2model-crud-patch/src/router/index.js +33 -0
  76. package/templates/vue-2model-crud-patch/src/services/api.js +64 -0
  77. package/templates/vue-2model-crud-patch/src/stores/departmentStore.js +149 -0
  78. package/templates/vue-2model-crud-patch/src/stores/employeeStore.js +143 -0
  79. package/templates/vue-2model-crud-patch/src/style.css +415 -0
  80. package/templates/vue-2model-crud-patch/src/views/AnalyticsView.vue +59 -0
  81. package/templates/vue-2model-crud-patch/src/views/DepartmentsView.vue +135 -0
  82. package/templates/vue-2model-crud-patch/src/views/EmployeesView.vue +143 -0
  83. package/templates/vue-2model-crud-patch/vite.config.js +9 -0
  84. package/templates/vue-axios/src/App.vue +255 -264
  85. package/templates/vue-axios/src/components/ItemFormModal.vue +183 -0
  86. package/templates/vue-axios/src/components/ItemPatchModal.vue +193 -0
  87. package/templates/vue-axios/src/components/ItemTable.vue +177 -0
  88. package/templates/vue-axios-basic/src/App.vue +241 -429
  89. package/templates/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
  90. package/templates/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
  91. package/templates/vue-axios-basic/src/components/ItemTable.vue +177 -0
  92. package/templates/vue-axios-pinia/src/App.vue +150 -441
  93. package/templates/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
  94. package/templates/vue-axios-pinia/src/components/ItemStats.vue +64 -0
  95. package/templates/vue-axios-pinia/src/components/ItemTable.vue +195 -0
  96. package/templates/vue-axios-router/src/App.vue +41 -90
  97. package/templates/vue-axios-router/src/components/ItemFormModal.vue +173 -0
  98. package/templates/vue-axios-router/src/components/ItemTable.vue +102 -0
  99. package/templates/vue-axios-router/src/components/NavBar.vue +57 -0
  100. package/templates/vue-axios-router/src/views/DepartmentView.vue +132 -296
  101. package/templates/vue-axios-router/src/views/EmployeeView.vue +126 -219
  102. package/templates/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
  103. package/templates/vue-axios-router-children/src/components/ItemTable.vue +104 -0
  104. package/templates/vue-axios-router-children/src/components/SideBar.vue +59 -0
  105. package/templates/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
  106. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
  107. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
  108. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
  109. package/templates/vue-axios-router-pinia/src/App.vue +19 -70
  110. package/templates/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
  111. package/templates/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
  112. package/templates/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
  113. package/templates/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
  114. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
  115. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
  116. package/templates/vue-banking-app/src/components/AccountOverview.vue +75 -0
  117. package/templates/vue-banking-app/src/components/TransactionForm.vue +89 -0
  118. package/templates/vue-banking-app/src/components/TransactionTable.vue +113 -0
  119. package/templates/vue-banking-app/src/stores/bankStore.js +16 -3
  120. package/templates/vue-banking-app/src/views/DashboardView.vue +23 -71
  121. package/templates/vue-banking-app/src/views/StatementView.vue +11 -158
  122. package/templates/vue-banking-app/src/views/TransactionFormView.vue +23 -121
  123. package/templates/vue-basics/src/App.vue +105 -76
  124. package/templates/vue-basics/src/components/CounterCard.vue +107 -0
  125. package/templates/vue-basics/src/components/ItemList.vue +99 -0
  126. package/templates/vue-basics/src/components/UserForm.vue +138 -0
  127. package/templates/vue-cart-router-pinia/src/components/CartSummary.vue +139 -0
  128. package/templates/vue-cart-router-pinia/src/components/CheckoutModal.vue +149 -0
  129. package/templates/vue-cart-router-pinia/src/components/ProductCard.vue +63 -0
  130. package/templates/vue-cart-router-pinia/src/stores/cartStore.js +11 -0
  131. package/templates/vue-cart-router-pinia/src/views/CartView.vue +52 -118
  132. package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +2 -5
  133. package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +20 -56
  134. package/templates/vue-employee-system/src/App.vue +75 -344
  135. package/templates/vue-employee-system/src/components/DepartmentFilter.vue +108 -0
  136. package/templates/vue-employee-system/src/components/EmployeeModal.vue +183 -0
  137. package/templates/vue-employee-system/src/components/EmployeeTable.vue +91 -0
  138. package/templates/vue-employee-system/src/stores/employeeStore.js +12 -0
  139. package/templates/vue-fetch/src/App.vue +261 -285
  140. package/templates/vue-fetch/src/components/FetchFormModal.vue +183 -0
  141. package/templates/vue-fetch/src/components/FetchPatchModal.vue +193 -0
  142. package/templates/vue-fetch/src/components/FetchTable.vue +177 -0
  143. package/templates/vue-food-ordering/src/components/CartSummary.vue +134 -0
  144. package/templates/vue-food-ordering/src/components/FoodMenu.vue +126 -0
  145. package/templates/vue-food-ordering/src/components/OrderModal.vue +150 -0
  146. package/templates/vue-food-ordering/src/views/MenuView.vue +11 -132
  147. package/templates/vue-food-ordering/src/views/OrderCartView.vue +31 -164
  148. package/templates/vue-game-rps/src/App.vue +29 -88
  149. package/templates/vue-game-tictactoe/src/App.vue +23 -53
  150. package/templates/vue-game-whackamole/src/App.vue +44 -63
  151. package/templates/vue-hospital-portal/src/components/AppointmentForm.vue +144 -0
  152. package/templates/vue-hospital-portal/src/components/DoctorCard.vue +73 -0
  153. package/templates/vue-hospital-portal/src/components/PatientTable.vue +123 -0
  154. package/templates/vue-hospital-portal/src/stores/hospitalStore.js +10 -1
  155. package/templates/vue-hospital-portal/src/views/OPDRegistrationView.vue +40 -416
  156. package/templates/vue-hospital-portal/src/views/PatientListView.vue +11 -301
  157. package/templates/vue-library-system/src/components/BookForm.vue +125 -0
  158. package/templates/vue-library-system/src/components/BookTable.vue +112 -0
  159. package/templates/vue-library-system/src/components/BorrowModal.vue +131 -0
  160. package/templates/vue-library-system/src/stores/libraryStore.js +26 -1
  161. package/templates/vue-library-system/src/views/BookCatalogView.vue +34 -415
  162. package/templates/vue-memory-game/src/App.vue +36 -40
  163. package/templates/vue-memory-game/src/stores/memoryStore.js +32 -37
  164. package/templates/vue-router/src/App.vue +24 -14
  165. package/templates/vue-router/src/components/AboutCard.vue +38 -0
  166. package/templates/vue-router/src/components/HomeHero.vue +75 -0
  167. package/templates/vue-router/src/components/NavBar.vue +54 -0
  168. package/templates/vue-router/src/views/ItemsLayout.vue +17 -9
  169. package/templates/vue-router/src/views/ListView.vue +106 -18
  170. package/templates/vue-router-pinia/src/App.vue +24 -14
  171. package/templates/vue-router-pinia/src/components/ItemFormModal.vue +163 -0
  172. package/templates/vue-router-pinia/src/components/ItemTable.vue +90 -0
  173. package/templates/vue-router-pinia/src/components/NavBar.vue +54 -0
  174. package/templates/vue-router-pinia/src/stores/itemStore.js +8 -1
  175. package/templates/vue-router-pinia/src/views/ListView.vue +78 -14
  176. package/templates/vue-router-pinia-springboot/frontend/src/App.vue +25 -8
  177. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemFormModal.vue +183 -0
  178. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemPatchModal.vue +193 -0
  179. package/templates/vue-router-pinia-springboot/frontend/src/components/ItemTable.vue +177 -0
  180. package/templates/vue-router-pinia-springboot/frontend/src/components/NavBar.vue +54 -0
  181. package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +92 -76
  182. package/templates/vue-springboot-mongo-aggregation/frontend/src/App.vue +184 -193
  183. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/AnalyticsCards.vue +56 -0
  184. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/CategorySummaryTable.vue +71 -0
  185. package/templates/vue-springboot-mongo-aggregation/frontend/src/components/ItemTable.vue +114 -0
  186. package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +228 -158
  187. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemFormModal.vue +183 -0
  188. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemPatchModal.vue +193 -0
  189. package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemTable.vue +177 -0
  190. package/templates/vue-symposium-system/src/App.vue +41 -256
  191. package/templates/vue-symposium-system/src/components/AttendeeTable.vue +100 -0
  192. package/templates/vue-symposium-system/src/components/EventCard.vue +67 -0
  193. package/templates/vue-symposium-system/src/components/RegistrationForm.vue +118 -0
  194. package/templates/vue-symposium-system/src/stores/symposiumStore.js +10 -0
  195. package/templates/vue-todo-pinia/src/App.vue +40 -138
  196. package/templates/vue-todo-pinia/src/components/TodoFilter.vue +74 -0
  197. package/templates/vue-todo-pinia/src/components/TodoInput.vue +53 -0
  198. package/templates/vue-todo-pinia/src/components/TodoList.vue +101 -0
  199. package/templates/vue-todo-pinia/src/stores/todoStore.js +6 -0
  200. package/templates/vue-todo-router/src/App.vue +5 -36
  201. package/templates/vue-todo-router/src/components/TodoForm.vue +78 -0
  202. package/templates/vue-todo-router/src/components/TodoList.vue +84 -0
  203. package/templates/vue-todo-router/src/components/TodoNavBar.vue +47 -0
  204. package/templates/vue-todo-router/src/data/todoState.js +7 -0
  205. package/templates/vue-todo-router/src/views/AddTodoView.vue +7 -66
  206. package/templates/vue-todo-router/src/views/TodoDetailView.vue +15 -1
  207. package/templates/vue-todo-router/src/views/TodoListView.vue +22 -64
@@ -0,0 +1,123 @@
1
+ <script setup>
2
+ defineProps({
3
+ patients: { type: Array, required: true }
4
+ })
5
+
6
+ const emit = defineEmits(['patch', 'discharge', 'settle'])
7
+
8
+ function handlePatchVitals(p) {
9
+ const newBp = prompt('Enter new BP (e.g. 120/80):', p.vitals?.bp || '120/80')
10
+ if (newBp !== null) {
11
+ emit('patch', { id: p.id, vitals: { ...p.vitals, bp: newBp } })
12
+ }
13
+ }
14
+ </script>
15
+
16
+ <template>
17
+ <div class="table-container">
18
+ <table class="patient-table">
19
+ <thead>
20
+ <tr>
21
+ <th>ID</th>
22
+ <th>Name</th>
23
+ <th>Age</th>
24
+ <th>Doctor</th>
25
+ <th>Bed</th>
26
+ <th>Risk</th>
27
+ <th>Bill</th>
28
+ <th>Status</th>
29
+ <th>Actions</th>
30
+ </tr>
31
+ </thead>
32
+ <tbody>
33
+ <tr v-if="patients.length === 0">
34
+ <td colspan="9" class="empty">No patient records.</td>
35
+ </tr>
36
+ <tr v-for="p in patients" :key="p.id">
37
+ <td>{{ p.id }}</td>
38
+ <td><strong>{{ p.name }}</strong></td>
39
+ <td>{{ p.age }}</td>
40
+ <td>{{ p.doctor }}</td>
41
+ <td>{{ p.bedType }}</td>
42
+ <td>
43
+ <span :class="['badge', p.risk === 'High' ? 'badge-red' : p.risk === 'Moderate' ? 'badge-yellow' : 'badge-green']">
44
+ {{ p.risk }}
45
+ </span>
46
+ </td>
47
+ <td>${{ p.bill }}</td>
48
+ <td>
49
+ <span :class="['badge', p.paymentStatus === 'Paid' ? 'badge-green' : 'badge-yellow']">
50
+ {{ p.paymentStatus }}
51
+ </span>
52
+ </td>
53
+ <td class="action-cell">
54
+ <button type="button" class="btn btn-patch" @click="handlePatchVitals(p)">Patch</button>
55
+ <button v-if="p.paymentStatus !== 'Paid'" type="button" class="btn btn-settle" @click="emit('settle', p.id)">Pay</button>
56
+ <button type="button" class="btn btn-discharge" @click="emit('discharge', p.id)">Discharge</button>
57
+ </td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+ </div>
62
+ </template>
63
+
64
+ <style scoped>
65
+ .table-container {
66
+ overflow-x: auto;
67
+ background: #ffffff;
68
+ border: 1px solid #e2e8f0;
69
+ border-radius: 8px;
70
+ padding: 16px;
71
+ }
72
+
73
+ .patient-table {
74
+ width: 100%;
75
+ border-collapse: collapse;
76
+ font-size: 13px;
77
+ }
78
+
79
+ th, td {
80
+ padding: 10px 8px;
81
+ border-bottom: 1px solid #f1f5f9;
82
+ text-align: left;
83
+ }
84
+
85
+ th {
86
+ background: #f8fafc;
87
+ color: #475569;
88
+ }
89
+
90
+ .badge {
91
+ padding: 2px 6px;
92
+ border-radius: 4px;
93
+ font-size: 11px;
94
+ font-weight: 600;
95
+ }
96
+
97
+ .badge-red { background: #fee2e2; color: #991b1b; }
98
+ .badge-yellow { background: #fef9c3; color: #854d0e; }
99
+ .badge-green { background: #dcfce7; color: #166534; }
100
+
101
+ .action-cell {
102
+ display: flex;
103
+ gap: 4px;
104
+ }
105
+
106
+ .btn {
107
+ padding: 4px 6px;
108
+ border-radius: 4px;
109
+ font-size: 11px;
110
+ cursor: pointer;
111
+ border: 1px solid transparent;
112
+ }
113
+
114
+ .btn-patch { background: #8250df; color: #fff; }
115
+ .btn-settle { background: #16a34a; color: #fff; }
116
+ .btn-discharge { background: #cf222e; color: #fff; }
117
+
118
+ .empty {
119
+ text-align: center;
120
+ color: #94a3b8;
121
+ padding: 20px;
122
+ }
123
+ </style>
@@ -70,6 +70,15 @@ export const useHospitalStore = defineStore('hospital', {
70
70
  this.patients.unshift(newPatient)
71
71
  return newPatient
72
72
  },
73
+ patchPatient(id, partial) {
74
+ const p = this.patients.find(item => item.id === id)
75
+ if (p) {
76
+ Object.assign(p, partial)
77
+ if (partial.vitals) {
78
+ p.risk = this.calculateRisk(p.vitals)
79
+ }
80
+ }
81
+ },
73
82
  dischargePatient(id) {
74
83
  this.patients = this.patients.filter((p) => p.id !== id)
75
84
  },
@@ -77,7 +86,7 @@ export const useHospitalStore = defineStore('hospital', {
77
86
  const doc = this.doctors.find((d) => d.id === doctorId)
78
87
  if (doc && doc.availableSlots > 0) {
79
88
  doc.availableSlots -= 1
80
- return { success: true, message: `Appointment confirmed with ${doc.name}` }
89
+ return { success: true, message: 'Appointment confirmed with ' + doc.name }
81
90
  }
82
91
  return { success: false, message: 'No appointment slots available for this doctor' }
83
92
  },
@@ -1,453 +1,77 @@
1
1
  <script setup>
2
- import { ref, computed } from 'vue'
2
+ import { ref } from 'vue'
3
3
  import { useRouter } from 'vue-router'
4
4
  import { useHospitalStore } from '../stores/hospitalStore'
5
+ import DoctorCard from '../components/DoctorCard.vue'
6
+ import AppointmentForm from '../components/AppointmentForm.vue'
5
7
 
6
8
  const hospital = useHospitalStore()
7
9
  const router = useRouter()
10
+ const message = ref('')
8
11
 
9
- const opdMessage = ref('')
10
- const admissionMessage = ref('')
11
-
12
- const form = ref({
13
- name: '',
14
- age: '',
15
- doctor: hospital.doctors[0]?.name || 'Dr. Sarah Connor',
16
- bedType: 'General Ward',
17
- vitals: {
18
- bp: '120/80',
19
- hr: 75,
20
- temp: 98.6
21
- },
22
- bill: 350
23
- })
24
-
25
- function updateBedType(type) {
26
- form.value.bedType = type
27
- if (type === 'ICU') {
28
- form.value.bill = 1200
29
- } else {
30
- form.value.bill = 350
31
- }
12
+ function handleBookDoctor(doctorId) {
13
+ const res = hospital.bookAppointment(doctorId)
14
+ message.value = res.message
32
15
  }
33
16
 
34
- const predictedRisk = computed(() => {
35
- return hospital.calculateRisk(form.value.vitals)
36
- })
37
-
38
- function handleBookOpd(doctorId) {
39
- const result = hospital.bookAppointment(doctorId)
40
- opdMessage.value = result.message
41
- setTimeout(() => {
42
- opdMessage.value = ''
43
- }, 3500)
44
- }
45
-
46
- function handleAdmitPatient() {
47
- if (!form.value.name.trim() || !form.value.age) {
48
- return
49
- }
50
- hospital.admitPatient({
51
- name: form.value.name,
52
- age: form.value.age,
53
- doctor: form.value.doctor,
54
- bedType: form.value.bedType,
55
- vitals: {
56
- bp: form.value.vitals.bp,
57
- hr: form.value.vitals.hr,
58
- temp: form.value.vitals.temp
59
- },
60
- bill: form.value.bill,
61
- paymentStatus: 'Pending'
62
- })
63
-
64
- admissionMessage.value = `Patient ${form.value.name} successfully admitted to ${form.value.bedType}!`
65
- form.value.name = ''
66
- form.value.age = ''
67
- form.value.vitals = { bp: '120/80', hr: 75, temp: 98.6 }
68
- form.value.bedType = 'General Ward'
69
- form.value.bill = 350
70
-
71
- setTimeout(() => {
72
- admissionMessage.value = ''
73
- router.push('/patients')
74
- }, 1200)
17
+ function handleAdmit(patientData) {
18
+ hospital.admitPatient(patientData)
19
+ router.push('/patients')
75
20
  }
76
21
  </script>
77
22
 
78
23
  <template>
79
- <div class="registration-page">
80
- <section class="card opd-section">
81
- <h2>OPD Doctor Appointments</h2>
82
- <div v-if="opdMessage" class="alert alert-info">
83
- {{ opdMessage }}
84
- </div>
85
- <div class="doctor-grid">
86
- <div v-for="doc in hospital.doctors" :key="doc.id" class="doctor-card">
87
- <div class="doctor-header">
88
- <h3>{{ doc.name }}</h3>
89
- <span class="specialty-badge">{{ doc.specialty }}</span>
90
- </div>
91
- <p class="fee-text">Consultation Fee: <strong>${{ doc.fee }}</strong></p>
92
- <p class="slot-text">
93
- Available Slots:
94
- <span :class="['slot-count', doc.availableSlots > 0 ? 'slot-open' : 'slot-full']">
95
- {{ doc.availableSlots }}
96
- </span>
97
- </p>
98
- <button
99
- class="btn btn-opd"
100
- :disabled="doc.availableSlots === 0"
101
- @click="handleBookOpd(doc.id)"
102
- >
103
- {{ doc.availableSlots > 0 ? 'Book Appointment' : 'Fully Booked' }}
104
- </button>
105
- </div>
106
- </div>
107
- </section>
108
-
109
- <section class="card admission-section">
110
- <h2>Patient Bed & ICU Admission Form</h2>
111
- <div v-if="admissionMessage" class="alert alert-success">
112
- {{ admissionMessage }}
113
- </div>
114
- <form @submit.prevent="handleAdmitPatient" class="admission-form">
115
- <div class="form-row">
116
- <div class="form-group flex-1">
117
- <label for="pName">Patient Name</label>
118
- <input id="pName" v-model="form.name" type="text" placeholder="e.g. Eleanor Vance" required />
119
- </div>
120
- <div class="form-group width-small">
121
- <label for="pAge">Age</label>
122
- <input id="pAge" v-model="form.age" type="number" min="1" max="130" placeholder="e.g. 34" required />
123
- </div>
124
- </div>
125
-
126
- <div class="form-row">
127
- <div class="form-group flex-1">
128
- <label for="pDoc">Assigned Doctor</label>
129
- <select id="pDoc" v-model="form.doctor">
130
- <option v-for="doc in hospital.doctors" :key="doc.id" :value="doc.name">
131
- {{ doc.name }} ({{ doc.specialty }})
132
- </option>
133
- </select>
134
- </div>
135
- <div class="form-group flex-1">
136
- <label>Bed Allocation</label>
137
- <div class="bed-options">
138
- <button
139
- type="button"
140
- :class="['bed-btn', form.bedType === 'General Ward' ? 'bed-btn-active' : '']"
141
- @click="updateBedType('General Ward')"
142
- >
143
- General Ward ($350)
144
- </button>
145
- <button
146
- type="button"
147
- :class="['bed-btn', form.bedType === 'ICU' ? 'bed-btn-active bed-btn-icu' : '']"
148
- @click="updateBedType('ICU')"
149
- >
150
- ICU ($1,200)
151
- </button>
152
- </div>
153
- </div>
154
- </div>
24
+ <div class="opd-page">
25
+ <h2>OPD Registration & Doctor Appointments</h2>
155
26
 
156
- <fieldset class="vitals-fieldset">
157
- <legend>Patient Vitals</legend>
158
- <div class="vitals-row">
159
- <div class="form-group flex-1">
160
- <label for="vBp">Blood Pressure (mmHg)</label>
161
- <input id="vBp" v-model="form.vitals.bp" type="text" placeholder="120/80" required />
162
- </div>
163
- <div class="form-group flex-1">
164
- <label for="vHr">Heart Rate (bpm)</label>
165
- <input id="vHr" v-model.number="form.vitals.hr" type="number" min="30" max="250" required />
166
- </div>
167
- <div class="form-group flex-1">
168
- <label for="vTemp">Temperature (°F)</label>
169
- <input id="vTemp" v-model.number="form.vitals.temp" type="number" step="0.1" min="90" max="110" required />
170
- </div>
171
- </div>
27
+ <div v-if="message" class="info-banner">{{ message }}</div>
172
28
 
173
- <div class="risk-preview">
174
- <span>Evaluated Risk Level: </span>
175
- <span :class="['risk-tag', 'risk-' + predictedRisk.toLowerCase()]">
176
- {{ predictedRisk }} Risk
177
- </span>
178
- </div>
179
- </fieldset>
180
-
181
- <div class="form-row">
182
- <div class="form-group flex-1">
183
- <label for="pBill">Estimated Billing ($)</label>
184
- <input id="pBill" v-model.number="form.bill" type="number" min="0" required />
185
- </div>
186
- </div>
29
+ <div class="doctors-section">
30
+ <h3>Available Doctors</h3>
31
+ <div class="doctor-grid">
32
+ <DoctorCard
33
+ v-for="d in hospital.doctors"
34
+ :key="d.id"
35
+ :doctor="d"
36
+ @book="handleBookDoctor"
37
+ />
38
+ </div>
39
+ </div>
187
40
 
188
- <button type="submit" class="btn btn-submit">
189
- Admit Patient & Allocate Bed
190
- </button>
191
- </form>
192
- </section>
41
+ <AppointmentForm
42
+ :doctors="hospital.doctors"
43
+ @submit-patient="handleAdmit"
44
+ />
193
45
  </div>
194
46
  </template>
195
47
 
196
48
  <style scoped>
197
- .registration-page {
49
+ .opd-page {
198
50
  display: flex;
199
51
  flex-direction: column;
200
- gap: 25px;
52
+ gap: 20px;
201
53
  }
202
54
 
203
- .card {
204
- background-color: #ffffff;
205
- border: 1px solid #e1e8ed;
206
- border-radius: 8px;
207
- padding: 20px 24px;
55
+ .opd-page h2 {
56
+ font-size: 22px;
208
57
  }
209
58
 
210
- h2 {
211
- margin-top: 0;
212
- margin-bottom: 16px;
213
- font-size: 19px;
214
- color: #1a202c;
215
- border-bottom: 2px solid #edf2f7;
216
- padding-bottom: 8px;
217
- }
218
-
219
- .alert {
59
+ .info-banner {
60
+ background: #f0fdf4;
61
+ color: #166534;
62
+ border: 1px solid #bbf7d0;
220
63
  padding: 10px 14px;
221
- border-radius: 4px;
222
- margin-bottom: 16px;
223
- font-size: 14px;
224
- }
225
-
226
- .alert-info {
227
- background-color: #ebf8ff;
228
- color: #2b6cb0;
229
- border: 1px solid #bee3f8;
64
+ border-radius: 6px;
230
65
  }
231
66
 
232
- .alert-success {
233
- background-color: #f0fff4;
234
- color: #276749;
235
- border: 1px solid #c6f6d5;
67
+ .doctors-section h3 {
68
+ font-size: 16px;
69
+ margin-bottom: 12px;
236
70
  }
237
71
 
238
72
  .doctor-grid {
239
73
  display: grid;
240
74
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
241
- gap: 15px;
242
- }
243
-
244
- .doctor-card {
245
- border: 1px solid #e2e8f0;
246
- border-radius: 6px;
247
- padding: 14px;
248
- background-color: #fafbfc;
249
- display: flex;
250
- flex-direction: column;
251
- justify-content: space-between;
252
- }
253
-
254
- .doctor-header h3 {
255
- margin: 0 0 6px 0;
256
- font-size: 16px;
257
- color: #2d3748;
258
- }
259
-
260
- .specialty-badge {
261
- display: inline-block;
262
- background-color: #e2e8f0;
263
- color: #4a5568;
264
- font-size: 12px;
265
- padding: 2px 8px;
266
- border-radius: 12px;
267
- }
268
-
269
- .fee-text,
270
- .slot-text {
271
- margin: 8px 0;
272
- font-size: 14px;
273
- color: #4a5568;
274
- }
275
-
276
- .slot-count {
277
- font-weight: bold;
278
- padding: 2px 6px;
279
- border-radius: 4px;
280
- }
281
-
282
- .slot-open {
283
- background-color: #c6f6d5;
284
- color: #22543d;
285
- }
286
-
287
- .slot-full {
288
- background-color: #fed7d7;
289
- color: #742a2a;
290
- }
291
-
292
- .admission-form {
293
- display: flex;
294
- flex-direction: column;
295
75
  gap: 16px;
296
76
  }
297
-
298
- .form-row {
299
- display: flex;
300
- gap: 15px;
301
- flex-wrap: wrap;
302
- }
303
-
304
- .flex-1 {
305
- flex: 1;
306
- min-width: 200px;
307
- }
308
-
309
- .width-small {
310
- width: 110px;
311
- }
312
-
313
- .form-group {
314
- display: flex;
315
- flex-direction: column;
316
- gap: 5px;
317
- }
318
-
319
- label {
320
- font-size: 13px;
321
- font-weight: 600;
322
- color: #4a5568;
323
- }
324
-
325
- input,
326
- select {
327
- padding: 8px 10px;
328
- border: 1px solid #cbd5e0;
329
- border-radius: 5px;
330
- font-size: 14px;
331
- background-color: #ffffff;
332
- }
333
-
334
- input:focus,
335
- select:focus {
336
- outline: none;
337
- border-color: #3182ce;
338
- }
339
-
340
- .bed-options {
341
- display: flex;
342
- gap: 10px;
343
- }
344
-
345
- .bed-btn {
346
- flex: 1;
347
- padding: 8px 12px;
348
- border: 1px solid #cbd5e0;
349
- background-color: #f7fafc;
350
- color: #4a5568;
351
- border-radius: 5px;
352
- cursor: pointer;
353
- font-size: 13px;
354
- font-weight: 500;
355
- }
356
-
357
- .bed-btn-active {
358
- background-color: #3182ce;
359
- color: #ffffff;
360
- border-color: #3182ce;
361
- }
362
-
363
- .bed-btn-active.bed-btn-icu {
364
- background-color: #dd6b20;
365
- border-color: #dd6b20;
366
- }
367
-
368
- .vitals-fieldset {
369
- border: 1px solid #e2e8f0;
370
- border-radius: 6px;
371
- padding: 12px 16px;
372
- background-color: #f7fafc;
373
- }
374
-
375
- legend {
376
- font-size: 13px;
377
- font-weight: bold;
378
- color: #2b6cb0;
379
- padding: 0 6px;
380
- }
381
-
382
- .vitals-row {
383
- display: flex;
384
- gap: 12px;
385
- flex-wrap: wrap;
386
- }
387
-
388
- .risk-preview {
389
- margin-top: 10px;
390
- font-size: 13px;
391
- display: flex;
392
- align-items: center;
393
- gap: 8px;
394
- }
395
-
396
- .risk-tag {
397
- font-weight: 700;
398
- padding: 3px 10px;
399
- border-radius: 12px;
400
- font-size: 12px;
401
- text-transform: uppercase;
402
- }
403
-
404
- .risk-high {
405
- background-color: #fed7d7;
406
- color: #9b2c2c;
407
- }
408
-
409
- .risk-moderate {
410
- background-color: #feebc8;
411
- color: #c05621;
412
- }
413
-
414
- .risk-normal {
415
- background-color: #c6f6d5;
416
- color: #22543d;
417
- }
418
-
419
- .btn {
420
- padding: 9px 16px;
421
- border: none;
422
- border-radius: 5px;
423
- font-weight: 600;
424
- font-size: 14px;
425
- cursor: pointer;
426
- }
427
-
428
- .btn-opd {
429
- background-color: #2b6cb0;
430
- color: #ffffff;
431
- margin-top: 8px;
432
- }
433
-
434
- .btn-opd:hover:not(:disabled) {
435
- background-color: #2c5282;
436
- }
437
-
438
- .btn-opd:disabled {
439
- background-color: #cbd5e0;
440
- cursor: not-allowed;
441
- color: #718096;
442
- }
443
-
444
- .btn-submit {
445
- background-color: #2f855a;
446
- color: #ffffff;
447
- padding: 12px;
448
- }
449
-
450
- .btn-submit:hover {
451
- background-color: #276749;
452
- }
453
77
  </style>