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,100 @@
1
+ <script setup>
2
+ defineProps({
3
+ registrations: { type: Array, required: true }
4
+ })
5
+
6
+ const emit = defineEmits(['patch', 'delete'])
7
+
8
+ function handlePatchCollege(reg) {
9
+ const newCollege = prompt('Update college for ' + reg.studentName + ':', reg.college)
10
+ if (newCollege !== null && newCollege.trim() !== '') {
11
+ emit('patch', { id: reg.id, college: newCollege.trim() })
12
+ }
13
+ }
14
+ </script>
15
+
16
+ <template>
17
+ <div class="table-container">
18
+ <h3>Registered Attendees</h3>
19
+ <table class="attendee-table">
20
+ <thead>
21
+ <tr>
22
+ <th>Student Name</th>
23
+ <th>College</th>
24
+ <th>Email</th>
25
+ <th>Event</th>
26
+ <th>Actions</th>
27
+ </tr>
28
+ </thead>
29
+ <tbody>
30
+ <tr v-if="registrations.length === 0">
31
+ <td colspan="5" class="empty">No registrations recorded yet.</td>
32
+ </tr>
33
+ <tr v-for="reg in registrations" :key="reg.id">
34
+ <td><strong>{{ reg.studentName }}</strong></td>
35
+ <td>{{ reg.college }}</td>
36
+ <td>{{ reg.email }}</td>
37
+ <td>{{ reg.eventTitle }}</td>
38
+ <td class="action-cell">
39
+ <button type="button" class="btn btn-patch" @click="handlePatchCollege(reg)">Patch</button>
40
+ <button type="button" class="btn btn-delete" @click="emit('delete', reg.id)">Cancel</button>
41
+ </td>
42
+ </tr>
43
+ </tbody>
44
+ </table>
45
+ </div>
46
+ </template>
47
+
48
+ <style scoped>
49
+ .table-container {
50
+ overflow-x: auto;
51
+ background: #ffffff;
52
+ border: 1px solid #e2e8f0;
53
+ border-radius: 8px;
54
+ padding: 16px;
55
+ }
56
+
57
+ .table-container h3 {
58
+ font-size: 16px;
59
+ margin-bottom: 12px;
60
+ }
61
+
62
+ .attendee-table {
63
+ width: 100%;
64
+ border-collapse: collapse;
65
+ font-size: 13px;
66
+ }
67
+
68
+ th, td {
69
+ padding: 10px;
70
+ border-bottom: 1px solid #f1f5f9;
71
+ text-align: left;
72
+ }
73
+
74
+ th {
75
+ background: #f8fafc;
76
+ color: #475569;
77
+ }
78
+
79
+ .action-cell {
80
+ display: flex;
81
+ gap: 6px;
82
+ }
83
+
84
+ .btn {
85
+ padding: 4px 8px;
86
+ border-radius: 4px;
87
+ font-size: 12px;
88
+ cursor: pointer;
89
+ border: 1px solid transparent;
90
+ }
91
+
92
+ .btn-patch { background: #8250df; color: #fff; }
93
+ .btn-delete { background: #cf222e; color: #fff; }
94
+
95
+ .empty {
96
+ text-align: center;
97
+ color: #94a3b8;
98
+ padding: 20px;
99
+ }
100
+ </style>
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ defineProps({
3
+ events: { type: Array, required: true },
4
+ getEventCount: { type: Function, required: true }
5
+ })
6
+ </script>
7
+
8
+ <template>
9
+ <div class="event-cards">
10
+ <div v-for="ev in events" :key="ev.id" class="ev-card">
11
+ <span class="category">{{ ev.category }}</span>
12
+ <h3>{{ ev.title }}</h3>
13
+ <div class="ev-meta">
14
+ <span>Fee: ${{ ev.fee }}</span>
15
+ <span class="count-badge">Registered: {{ getEventCount(ev.id) }}</span>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <style scoped>
22
+ .event-cards {
23
+ display: grid;
24
+ grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
25
+ gap: 16px;
26
+ margin-bottom: 20px;
27
+ }
28
+
29
+ .ev-card {
30
+ background: #ffffff;
31
+ border: 1px solid #e2e8f0;
32
+ border-radius: 8px;
33
+ padding: 16px;
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 6px;
37
+ }
38
+
39
+ .category {
40
+ font-size: 11px;
41
+ text-transform: uppercase;
42
+ color: #64748b;
43
+ font-weight: 600;
44
+ }
45
+
46
+ .ev-card h3 {
47
+ font-size: 16px;
48
+ margin: 0;
49
+ color: #1e293b;
50
+ }
51
+
52
+ .ev-meta {
53
+ display: flex;
54
+ justify-content: space-between;
55
+ align-items: center;
56
+ font-size: 13px;
57
+ margin-top: 6px;
58
+ }
59
+
60
+ .count-badge {
61
+ background: #e0f2fe;
62
+ color: #0369a1;
63
+ padding: 2px 6px;
64
+ border-radius: 4px;
65
+ font-weight: 600;
66
+ }
67
+ </style>
@@ -0,0 +1,118 @@
1
+ <script setup>
2
+ import { reactive } from 'vue'
3
+
4
+ defineProps({
5
+ events: { type: Array, required: true }
6
+ })
7
+
8
+ const emit = defineEmits(['submit-registration'])
9
+
10
+ const form = reactive({
11
+ studentName: '',
12
+ college: '',
13
+ email: '',
14
+ eventId: ''
15
+ })
16
+
17
+ function handleSubmit() {
18
+ if (!form.studentName.trim() || !form.college.trim() || !form.email.trim() || !form.eventId) return
19
+ emit('submit-registration', { ...form })
20
+ form.studentName = ''
21
+ form.college = ''
22
+ form.email = ''
23
+ form.eventId = ''
24
+ }
25
+ </script>
26
+
27
+ <template>
28
+ <form @submit.prevent="handleSubmit" class="reg-form">
29
+ <h3>Student Event Registration</h3>
30
+
31
+ <div class="form-row">
32
+ <div class="form-group">
33
+ <label for="st-name">Student Name</label>
34
+ <input id="st-name" v-model="form.studentName" required placeholder="John Doe" />
35
+ </div>
36
+
37
+ <div class="form-group">
38
+ <label for="st-coll">College / University</label>
39
+ <input id="st-coll" v-model="form.college" required placeholder="MIT" />
40
+ </div>
41
+ </div>
42
+
43
+ <div class="form-row">
44
+ <div class="form-group">
45
+ <label for="st-email">Email Address</label>
46
+ <input id="st-email" v-model="form.email" type="email" required placeholder="john@example.com" />
47
+ </div>
48
+
49
+ <div class="form-group">
50
+ <label for="st-evt">Select Event</label>
51
+ <select id="st-evt" v-model="form.eventId" required>
52
+ <option value="" disabled>Choose an event...</option>
53
+ <option v-for="ev in events" :key="ev.id" :value="ev.id">
54
+ {{ ev.title }} (${{ ev.fee }})
55
+ </option>
56
+ </select>
57
+ </div>
58
+ </div>
59
+
60
+ <button type="submit" class="btn btn-primary">Register Student</button>
61
+ </form>
62
+ </template>
63
+
64
+ <style scoped>
65
+ .reg-form {
66
+ background: #ffffff;
67
+ border: 1px solid #e2e8f0;
68
+ border-radius: 8px;
69
+ padding: 16px;
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 12px;
73
+ margin-bottom: 20px;
74
+ }
75
+
76
+ .reg-form h3 {
77
+ font-size: 16px;
78
+ margin: 0;
79
+ }
80
+
81
+ .form-row {
82
+ display: flex;
83
+ gap: 12px;
84
+ flex-wrap: wrap;
85
+ }
86
+
87
+ .form-group {
88
+ flex: 1;
89
+ min-width: 160px;
90
+ display: flex;
91
+ flex-direction: column;
92
+ gap: 4px;
93
+ }
94
+
95
+ .form-group label {
96
+ font-size: 12px;
97
+ font-weight: 600;
98
+ color: #475569;
99
+ }
100
+
101
+ .form-group input,
102
+ .form-group select {
103
+ padding: 8px 10px;
104
+ border: 1px solid #cbd5e1;
105
+ border-radius: 6px;
106
+ font-size: 13px;
107
+ }
108
+
109
+ .btn-primary {
110
+ background: #0284c7;
111
+ color: #fff;
112
+ border: none;
113
+ padding: 8px 16px;
114
+ border-radius: 6px;
115
+ cursor: pointer;
116
+ align-self: flex-start;
117
+ }
118
+ </style>
@@ -37,6 +37,16 @@ export const useSymposiumStore = defineStore('symposium', {
37
37
  eventTitle: matchedEvent ? matchedEvent.title : ''
38
38
  })
39
39
  },
40
+ patchRegistration(id, partial) {
41
+ const reg = this.registrations.find(r => r.id === id)
42
+ if (reg) {
43
+ Object.assign(reg, partial)
44
+ if (partial.eventId) {
45
+ const matchedEvent = this.events.find(e => e.id === partial.eventId)
46
+ if (matchedEvent) reg.eventTitle = matchedEvent.title
47
+ }
48
+ }
49
+ },
40
50
  deleteRegistration(id) {
41
51
  this.registrations = this.registrations.filter((reg) => reg.id !== id)
42
52
  }
@@ -1,13 +1,25 @@
1
1
  <script setup>
2
- import { ref } from 'vue'
3
2
  import { useTodoStore } from './stores/todoStore'
3
+ import TodoInput from './components/TodoInput.vue'
4
+ import TodoFilter from './components/TodoFilter.vue'
5
+ import TodoList from './components/TodoList.vue'
4
6
 
5
7
  const store = useTodoStore()
6
- const newTodoText = ref('')
7
8
 
8
- function handleAdd() {
9
- store.addTodo(newTodoText.value)
10
- newTodoText.value = ''
9
+ function handleAdd(text) {
10
+ store.addTodo(text)
11
+ }
12
+
13
+ function handleToggle(id) {
14
+ store.toggleTodo(id)
15
+ }
16
+
17
+ function handlePatch({ id, text }) {
18
+ store.patchTodo(id, { text })
19
+ }
20
+
21
+ function handleDelete(id) {
22
+ store.deleteTodo(id)
11
23
  }
12
24
  </script>
13
25
 
@@ -15,66 +27,22 @@ function handleAdd() {
15
27
  <div class="todo-app">
16
28
  <h1>Todo List (Pinia)</h1>
17
29
 
18
- <form @submit.prevent="handleAdd" class="add-form">
19
- <input
20
- type="text"
21
- v-model="newTodoText"
22
- placeholder="What needs to be done?"
23
- required
24
- />
25
- <button type="submit" class="btn btn-add">Add</button>
26
- </form>
30
+ <TodoInput @add="handleAdd" />
27
31
 
28
- <div class="filters">
29
- <button
30
- type="button"
31
- class="filter-btn"
32
- :class="{ active: store.filter === 'all' }"
33
- @click="store.setFilter('all')"
34
- >
35
- All ({{ store.totalCount }})
36
- </button>
37
- <button
38
- type="button"
39
- class="filter-btn"
40
- :class="{ active: store.filter === 'active' }"
41
- @click="store.setFilter('active')"
42
- >
43
- Pending ({{ store.pendingCount }})
44
- </button>
45
- <button
46
- type="button"
47
- class="filter-btn"
48
- :class="{ active: store.filter === 'completed' }"
49
- @click="store.setFilter('completed')"
50
- >
51
- Completed ({{ store.completedCount }})
52
- </button>
53
- </div>
32
+ <TodoFilter
33
+ :current-filter="store.filter"
34
+ :total-count="store.totalCount"
35
+ :pending-count="store.pendingCount"
36
+ :completed-count="store.completedCount"
37
+ @change-filter="store.setFilter"
38
+ />
54
39
 
55
- <ul class="todo-list">
56
- <li v-for="item in store.filteredTodos" :key="item.id" class="todo-item">
57
- <label>
58
- <input
59
- type="checkbox"
60
- :checked="item.done"
61
- @change="store.toggleTodo(item.id)"
62
- />
63
- <span :class="{ completed: item.done }">{{ item.text }}</span>
64
- </label>
65
- <button
66
- type="button"
67
- class="btn-delete"
68
- @click="store.deleteTodo(item.id)"
69
- >
70
- ✕
71
- </button>
72
- </li>
73
- </ul>
74
-
75
- <div v-if="store.todos.length === 0" class="empty-state">
76
- No todos found. Add one above!
77
- </div>
40
+ <TodoList
41
+ :todos="store.filteredTodos"
42
+ @toggle="handleToggle"
43
+ @patch="handlePatch"
44
+ @delete="handleDelete"
45
+ />
78
46
 
79
47
  <div class="footer-actions" v-if="store.completedCount > 0">
80
48
  <button type="button" class="btn btn-clear" @click="store.clearCompleted()">
@@ -86,84 +54,15 @@ function handleAdd() {
86
54
 
87
55
  <style scoped>
88
56
  .todo-app {
89
- max-width: 450px;
57
+ max-width: 480px;
90
58
  margin: 30px auto;
91
- font-family: Arial, sans-serif;
92
- }
93
-
94
- .add-form {
95
- display: flex;
96
- gap: 8px;
97
- margin-bottom: 15px;
98
- }
99
-
100
- .add-form input {
101
- flex: 1;
102
- padding: 8px;
103
- font-size: 14px;
104
- }
105
-
106
- .btn {
107
- padding: 8px 16px;
108
- cursor: pointer;
109
- }
110
-
111
- .btn-add {
112
- background-color: #27ae60;
113
- color: white;
114
- border: none;
115
- }
116
-
117
- .filters {
118
- display: flex;
119
- gap: 8px;
120
- margin-bottom: 15px;
59
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
121
60
  }
122
61
 
123
- .filter-btn {
124
- padding: 5px 10px;
125
- background-color: #eee;
126
- border: 1px solid #ccc;
127
- cursor: pointer;
128
- }
129
-
130
- .filter-btn.active {
131
- background-color: #2980b9;
132
- color: white;
133
- border-color: #2980b9;
134
- }
135
-
136
- .todo-list {
137
- list-style: none;
138
- padding: 0;
139
- margin: 0;
140
- }
141
-
142
- .todo-item {
143
- display: flex;
144
- justify-content: space-between;
145
- align-items: center;
146
- padding: 8px 0;
147
- border-bottom: 1px solid #eee;
148
- }
149
-
150
- .completed {
151
- text-decoration: line-through;
152
- color: #888;
153
- }
154
-
155
- .btn-delete {
156
- background: none;
157
- border: none;
158
- color: #e74c3c;
159
- cursor: pointer;
160
- font-size: 16px;
161
- }
162
-
163
- .empty-state {
164
- text-align: center;
165
- color: #888;
166
- padding: 20px 0;
62
+ h1 {
63
+ font-size: 24px;
64
+ margin-bottom: 16px;
65
+ color: #1e293b;
167
66
  }
168
67
 
169
68
  .footer-actions {
@@ -175,5 +74,8 @@ function handleAdd() {
175
74
  background-color: #e74c3c;
176
75
  color: white;
177
76
  border: none;
77
+ padding: 6px 12px;
78
+ border-radius: 4px;
79
+ cursor: pointer;
178
80
  }
179
81
  </style>
@@ -0,0 +1,74 @@
1
+ <script setup>
2
+ defineProps({
3
+ currentFilter: {
4
+ type: String,
5
+ default: 'all'
6
+ },
7
+ totalCount: {
8
+ type: Number,
9
+ default: 0
10
+ },
11
+ pendingCount: {
12
+ type: Number,
13
+ default: 0
14
+ },
15
+ completedCount: {
16
+ type: Number,
17
+ default: 0
18
+ }
19
+ })
20
+
21
+ const emit = defineEmits(['change-filter'])
22
+ </script>
23
+
24
+ <template>
25
+ <div class="filters">
26
+ <button
27
+ type="button"
28
+ class="filter-btn"
29
+ :class="{ active: currentFilter === 'all' }"
30
+ @click="emit('change-filter', 'all')"
31
+ >
32
+ All ({{ totalCount }})
33
+ </button>
34
+ <button
35
+ type="button"
36
+ class="filter-btn"
37
+ :class="{ active: currentFilter === 'active' }"
38
+ @click="emit('change-filter', 'active')"
39
+ >
40
+ Pending ({{ pendingCount }})
41
+ </button>
42
+ <button
43
+ type="button"
44
+ class="filter-btn"
45
+ :class="{ active: currentFilter === 'completed' }"
46
+ @click="emit('change-filter', 'completed')"
47
+ >
48
+ Completed ({{ completedCount }})
49
+ </button>
50
+ </div>
51
+ </template>
52
+
53
+ <style scoped>
54
+ .filters {
55
+ display: flex;
56
+ gap: 8px;
57
+ margin-bottom: 15px;
58
+ }
59
+
60
+ .filter-btn {
61
+ padding: 6px 12px;
62
+ background-color: #eee;
63
+ border: 1px solid #ccc;
64
+ border-radius: 4px;
65
+ cursor: pointer;
66
+ font-size: 13px;
67
+ }
68
+
69
+ .filter-btn.active {
70
+ background-color: #2980b9;
71
+ color: white;
72
+ border-color: #2980b9;
73
+ }
74
+ </style>
@@ -0,0 +1,53 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+
4
+ const emit = defineEmits(['add'])
5
+ const text = ref('')
6
+
7
+ function handleSubmit() {
8
+ if (!text.value.trim()) return
9
+ emit('add', text.value.trim())
10
+ text.value = ''
11
+ }
12
+ </script>
13
+
14
+ <template>
15
+ <form @submit.prevent="handleSubmit" class="add-form">
16
+ <input
17
+ type="text"
18
+ v-model="text"
19
+ placeholder="What needs to be done?"
20
+ required
21
+ />
22
+ <button type="submit" class="btn btn-add">Add</button>
23
+ </form>
24
+ </template>
25
+
26
+ <style scoped>
27
+ .add-form {
28
+ display: flex;
29
+ gap: 8px;
30
+ margin-bottom: 15px;
31
+ }
32
+
33
+ .add-form input {
34
+ flex: 1;
35
+ padding: 8px 12px;
36
+ font-size: 14px;
37
+ border: 1px solid #ccc;
38
+ border-radius: 4px;
39
+ }
40
+
41
+ .btn {
42
+ padding: 8px 16px;
43
+ cursor: pointer;
44
+ border: none;
45
+ border-radius: 4px;
46
+ font-weight: 500;
47
+ }
48
+
49
+ .btn-add {
50
+ background-color: #27ae60;
51
+ color: white;
52
+ }
53
+ </style>