wad-lab 1.2.2 → 1.2.3
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.
- package/bin/index.js +472 -631
- package/package.json +1 -1
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +241 -429
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/components/ItemTable.vue +177 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +150 -441
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemStats.vue +64 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/components/ItemTable.vue +195 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +41 -90
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemFormModal.vue +173 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/ItemTable.vue +102 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/components/NavBar.vue +57 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +132 -296
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +126 -219
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/ItemTable.vue +104 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/components/SideBar.vue +59 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/App.vue +19 -70
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
- package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
- package/templates/game-bingo/script.js +1 -1
- package/templates/game-memory-cards/script.js +2 -2
- package/templates/game-rock-paper-scissors/index.html +3 -3
- package/templates/game-rock-paper-scissors/script.js +2 -2
- package/templates/game-tic-tac-toe/script.js +2 -2
- package/templates/game-whack-a-mole/index.html +9 -9
- package/templates/servlet-basic/WEB-INF/ItemServlet.java +13 -0
- package/templates/servlet-basic/WEB-INF/classes/ItemServlet.class +0 -0
- package/templates/servlet-flow/WEB-INF/HelloServlet.java +34 -25
- package/templates/servlet-flow/WEB-INF/classes/HelloServlet.class +0 -0
- package/templates/servlet-jdbc/WEB-INF/JdbcItemServlet.java +13 -0
- package/templates/servlet-jdbc/WEB-INF/classes/JdbcItemServlet.class +0 -0
- package/templates/snippets/mongo-queries-cheatsheet.txt +105 -0
- package/templates/springboot-2model-aggregation-join/.mvn/wrapper/maven-wrapper.properties +3 -0
- package/templates/springboot-2model-aggregation-join/mvnw +295 -0
- package/templates/springboot-2model-aggregation-join/mvnw.cmd +189 -0
- package/templates/springboot-2model-aggregation-join/pom.xml +54 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/AggregationApplication.java +11 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/DepartmentController.java +65 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/controller/EmployeeController.java +65 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/DepartmentStatsDTO.java +15 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/dto/EmployeeJoinDTO.java +19 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Department.java +20 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/model/Employee.java +21 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/DepartmentRepository.java +9 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/repository/EmployeeRepository.java +9 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/DepartmentService.java +81 -0
- package/templates/springboot-2model-aggregation-join/src/main/java/com/example/aggregation/service/EmployeeService.java +80 -0
- package/templates/springboot-2model-aggregation-join/src/main/resources/application.properties +2 -0
- package/templates/springboot-2model-aggregation-join/src/test/java/com/example/aggregation/AggregationApplicationTests.java +13 -0
- package/templates/vue-2model-crud-patch/README.md +64 -0
- package/templates/vue-2model-crud-patch/index.html +12 -0
- package/templates/vue-2model-crud-patch/package-lock.json +1785 -0
- package/templates/vue-2model-crud-patch/package.json +21 -0
- package/templates/vue-2model-crud-patch/src/App.vue +63 -0
- package/templates/vue-2model-crud-patch/src/components/AnalyticsBoard.vue +291 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentFormModal.vue +138 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentPatchModal.vue +210 -0
- package/templates/vue-2model-crud-patch/src/components/DepartmentTable.vue +133 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeeFormModal.vue +177 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeePatchModal.vue +221 -0
- package/templates/vue-2model-crud-patch/src/components/EmployeeTable.vue +171 -0
- package/templates/vue-2model-crud-patch/src/components/NavBar.vue +156 -0
- package/templates/vue-2model-crud-patch/src/main.js +12 -0
- package/templates/vue-2model-crud-patch/src/router/index.js +33 -0
- package/templates/vue-2model-crud-patch/src/services/api.js +64 -0
- package/templates/vue-2model-crud-patch/src/stores/departmentStore.js +149 -0
- package/templates/vue-2model-crud-patch/src/stores/employeeStore.js +143 -0
- package/templates/vue-2model-crud-patch/src/style.css +415 -0
- package/templates/vue-2model-crud-patch/src/views/AnalyticsView.vue +59 -0
- package/templates/vue-2model-crud-patch/src/views/DepartmentsView.vue +135 -0
- package/templates/vue-2model-crud-patch/src/views/EmployeesView.vue +143 -0
- package/templates/vue-2model-crud-patch/vite.config.js +9 -0
- package/templates/vue-axios/src/App.vue +255 -264
- package/templates/vue-axios/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-axios/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-axios/src/components/ItemTable.vue +177 -0
- package/templates/vue-axios-basic/src/App.vue +241 -429
- package/templates/vue-axios-basic/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-axios-basic/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-axios-basic/src/components/ItemTable.vue +177 -0
- package/templates/vue-axios-pinia/src/App.vue +150 -441
- package/templates/vue-axios-pinia/src/components/ItemFormModal.vue +207 -0
- package/templates/vue-axios-pinia/src/components/ItemStats.vue +64 -0
- package/templates/vue-axios-pinia/src/components/ItemTable.vue +195 -0
- package/templates/vue-axios-router/src/App.vue +41 -90
- package/templates/vue-axios-router/src/components/ItemFormModal.vue +173 -0
- package/templates/vue-axios-router/src/components/ItemTable.vue +102 -0
- package/templates/vue-axios-router/src/components/NavBar.vue +57 -0
- package/templates/vue-axios-router/src/views/DepartmentView.vue +132 -296
- package/templates/vue-axios-router/src/views/EmployeeView.vue +126 -219
- package/templates/vue-axios-router-children/src/components/ItemDetail.vue +115 -0
- package/templates/vue-axios-router-children/src/components/ItemTable.vue +104 -0
- package/templates/vue-axios-router-children/src/components/SideBar.vue +59 -0
- package/templates/vue-axios-router-children/src/views/CompanyLayout.vue +2 -51
- package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +92 -250
- package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +59 -181
- package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +67 -315
- package/templates/vue-axios-router-pinia/src/App.vue +19 -70
- package/templates/vue-axios-router-pinia/src/components/ItemFormModal.vue +173 -0
- package/templates/vue-axios-router-pinia/src/components/ItemPatchModal.vue +144 -0
- package/templates/vue-axios-router-pinia/src/components/ItemTable.vue +102 -0
- package/templates/vue-axios-router-pinia/src/components/NavBar.vue +53 -0
- package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +107 -229
- package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +143 -257
- package/templates/vue-banking-app/src/components/AccountOverview.vue +75 -0
- package/templates/vue-banking-app/src/components/TransactionForm.vue +89 -0
- package/templates/vue-banking-app/src/components/TransactionTable.vue +113 -0
- package/templates/vue-banking-app/src/stores/bankStore.js +16 -3
- package/templates/vue-banking-app/src/views/DashboardView.vue +23 -71
- package/templates/vue-banking-app/src/views/StatementView.vue +11 -158
- package/templates/vue-banking-app/src/views/TransactionFormView.vue +23 -121
- package/templates/vue-basics/src/App.vue +105 -76
- package/templates/vue-basics/src/components/CounterCard.vue +107 -0
- package/templates/vue-basics/src/components/ItemList.vue +99 -0
- package/templates/vue-basics/src/components/UserForm.vue +138 -0
- package/templates/vue-cart-router-pinia/src/components/CartSummary.vue +139 -0
- package/templates/vue-cart-router-pinia/src/components/CheckoutModal.vue +149 -0
- package/templates/vue-cart-router-pinia/src/components/ProductCard.vue +63 -0
- package/templates/vue-cart-router-pinia/src/stores/cartStore.js +11 -0
- package/templates/vue-cart-router-pinia/src/views/CartView.vue +52 -118
- package/templates/vue-cart-router-pinia/src/views/CheckoutView.vue +2 -5
- package/templates/vue-cart-router-pinia/src/views/ProductCatalogView.vue +20 -56
- package/templates/vue-employee-system/src/App.vue +75 -344
- package/templates/vue-employee-system/src/components/DepartmentFilter.vue +108 -0
- package/templates/vue-employee-system/src/components/EmployeeModal.vue +183 -0
- package/templates/vue-employee-system/src/components/EmployeeTable.vue +91 -0
- package/templates/vue-employee-system/src/stores/employeeStore.js +12 -0
- package/templates/vue-fetch/src/App.vue +261 -285
- package/templates/vue-fetch/src/components/FetchFormModal.vue +183 -0
- package/templates/vue-fetch/src/components/FetchPatchModal.vue +193 -0
- package/templates/vue-fetch/src/components/FetchTable.vue +177 -0
- package/templates/vue-food-ordering/src/components/CartSummary.vue +134 -0
- package/templates/vue-food-ordering/src/components/FoodMenu.vue +126 -0
- package/templates/vue-food-ordering/src/components/OrderModal.vue +150 -0
- package/templates/vue-food-ordering/src/views/MenuView.vue +11 -132
- package/templates/vue-food-ordering/src/views/OrderCartView.vue +31 -164
- package/templates/vue-game-rps/src/App.vue +29 -88
- package/templates/vue-game-tictactoe/src/App.vue +23 -53
- package/templates/vue-game-whackamole/src/App.vue +44 -63
- package/templates/vue-hospital-portal/src/components/AppointmentForm.vue +144 -0
- package/templates/vue-hospital-portal/src/components/DoctorCard.vue +73 -0
- package/templates/vue-hospital-portal/src/components/PatientTable.vue +123 -0
- package/templates/vue-hospital-portal/src/stores/hospitalStore.js +10 -1
- package/templates/vue-hospital-portal/src/views/OPDRegistrationView.vue +40 -416
- package/templates/vue-hospital-portal/src/views/PatientListView.vue +11 -301
- package/templates/vue-library-system/src/components/BookForm.vue +125 -0
- package/templates/vue-library-system/src/components/BookTable.vue +112 -0
- package/templates/vue-library-system/src/components/BorrowModal.vue +131 -0
- package/templates/vue-library-system/src/stores/libraryStore.js +26 -1
- package/templates/vue-library-system/src/views/BookCatalogView.vue +34 -415
- package/templates/vue-memory-game/src/App.vue +36 -40
- package/templates/vue-memory-game/src/stores/memoryStore.js +32 -37
- package/templates/vue-router/src/App.vue +24 -14
- package/templates/vue-router/src/components/AboutCard.vue +38 -0
- package/templates/vue-router/src/components/HomeHero.vue +75 -0
- package/templates/vue-router/src/components/NavBar.vue +54 -0
- package/templates/vue-router/src/views/ItemsLayout.vue +17 -9
- package/templates/vue-router/src/views/ListView.vue +106 -18
- package/templates/vue-router-pinia/src/App.vue +24 -14
- package/templates/vue-router-pinia/src/components/ItemFormModal.vue +163 -0
- package/templates/vue-router-pinia/src/components/ItemTable.vue +90 -0
- package/templates/vue-router-pinia/src/components/NavBar.vue +54 -0
- package/templates/vue-router-pinia/src/stores/itemStore.js +8 -1
- package/templates/vue-router-pinia/src/views/ListView.vue +78 -14
- package/templates/vue-router-pinia-springboot/frontend/src/App.vue +25 -8
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/ItemTable.vue +177 -0
- package/templates/vue-router-pinia-springboot/frontend/src/components/NavBar.vue +54 -0
- package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +92 -76
- package/templates/vue-springboot-mongo-aggregation/frontend/src/App.vue +184 -193
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/AnalyticsCards.vue +56 -0
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/CategorySummaryTable.vue +71 -0
- package/templates/vue-springboot-mongo-aggregation/frontend/src/components/ItemTable.vue +114 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +228 -158
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemFormModal.vue +183 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemPatchModal.vue +193 -0
- package/templates/vue-springboot-mongo-crud/frontend/src/components/ItemTable.vue +177 -0
- package/templates/vue-symposium-system/src/App.vue +41 -256
- package/templates/vue-symposium-system/src/components/AttendeeTable.vue +100 -0
- package/templates/vue-symposium-system/src/components/EventCard.vue +67 -0
- package/templates/vue-symposium-system/src/components/RegistrationForm.vue +118 -0
- package/templates/vue-symposium-system/src/stores/symposiumStore.js +10 -0
- package/templates/vue-todo-pinia/src/App.vue +40 -138
- package/templates/vue-todo-pinia/src/components/TodoFilter.vue +74 -0
- package/templates/vue-todo-pinia/src/components/TodoInput.vue +53 -0
- package/templates/vue-todo-pinia/src/components/TodoList.vue +101 -0
- package/templates/vue-todo-pinia/src/stores/todoStore.js +6 -0
- package/templates/vue-todo-router/src/App.vue +5 -36
- package/templates/vue-todo-router/src/components/TodoForm.vue +78 -0
- package/templates/vue-todo-router/src/components/TodoList.vue +84 -0
- package/templates/vue-todo-router/src/components/TodoNavBar.vue +47 -0
- package/templates/vue-todo-router/src/data/todoState.js +7 -0
- package/templates/vue-todo-router/src/views/AddTodoView.vue +7 -66
- package/templates/vue-todo-router/src/views/TodoDetailView.vue +15 -1
- package/templates/vue-todo-router/src/views/TodoListView.vue +22 -64
package/package.json
CHANGED
|
@@ -1,429 +1,241 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
console.error(error)
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const patchEmployeeSalary = async (id, currentSalary) => {
|
|
247
|
-
const salary = prompt('Enter new salary:', currentSalary)
|
|
248
|
-
if (!salary || Number(salary) === Number(currentSalary)) return
|
|
249
|
-
try {
|
|
250
|
-
await api.patch(`/employees/${id}`, { salary: Number(salary) })
|
|
251
|
-
await fetchEmployees()
|
|
252
|
-
} catch (error) {
|
|
253
|
-
console.error(error)
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const getDepartmentName = (deptId) => {
|
|
258
|
-
const dept = departments.value.find((d) => d.id === deptId)
|
|
259
|
-
return dept ? dept.name : `Dept #${deptId}`
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
onMounted(() => {
|
|
263
|
-
fetchDepartments()
|
|
264
|
-
fetchEmployees()
|
|
265
|
-
})
|
|
266
|
-
</script>
|
|
267
|
-
|
|
268
|
-
<style>
|
|
269
|
-
* {
|
|
270
|
-
box-sizing: border-box;
|
|
271
|
-
margin: 0;
|
|
272
|
-
padding: 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
body {
|
|
276
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
277
|
-
background-color: #f4f5f7;
|
|
278
|
-
color: #333333;
|
|
279
|
-
line-height: 1.5;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
.container {
|
|
283
|
-
max-width: 1200px;
|
|
284
|
-
margin: 0 auto;
|
|
285
|
-
padding: 32px 16px;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
.header {
|
|
289
|
-
margin-bottom: 24px;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
.header h1 {
|
|
293
|
-
font-size: 28px;
|
|
294
|
-
color: #1a1a1a;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.header p {
|
|
298
|
-
color: #666666;
|
|
299
|
-
font-size: 14px;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.grid {
|
|
303
|
-
display: grid;
|
|
304
|
-
grid-template-columns: 1fr;
|
|
305
|
-
gap: 24px;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
@media (min-width: 900px) {
|
|
309
|
-
.grid {
|
|
310
|
-
grid-template-columns: 1fr 1fr;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.card {
|
|
315
|
-
background: #ffffff;
|
|
316
|
-
border: 1px solid #e1e4e8;
|
|
317
|
-
border-radius: 8px;
|
|
318
|
-
padding: 20px;
|
|
319
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.card h2 {
|
|
323
|
-
font-size: 20px;
|
|
324
|
-
margin-bottom: 16px;
|
|
325
|
-
color: #222222;
|
|
326
|
-
border-bottom: 1px solid #edf0f2;
|
|
327
|
-
padding-bottom: 8px;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.form {
|
|
331
|
-
display: flex;
|
|
332
|
-
flex-direction: column;
|
|
333
|
-
gap: 12px;
|
|
334
|
-
margin-bottom: 20px;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.form-group {
|
|
338
|
-
display: flex;
|
|
339
|
-
flex-direction: column;
|
|
340
|
-
gap: 4px;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
.form-group label {
|
|
344
|
-
font-size: 13px;
|
|
345
|
-
font-weight: 600;
|
|
346
|
-
color: #444444;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
.form-group input,
|
|
350
|
-
.form-group select {
|
|
351
|
-
padding: 8px 10px;
|
|
352
|
-
border: 1px solid #cccccc;
|
|
353
|
-
border-radius: 4px;
|
|
354
|
-
font-size: 14px;
|
|
355
|
-
background-color: #ffffff;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
.form-group input:focus,
|
|
359
|
-
.form-group select:focus {
|
|
360
|
-
outline: none;
|
|
361
|
-
border-color: #0066cc;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
.btn {
|
|
365
|
-
padding: 8px 14px;
|
|
366
|
-
border: none;
|
|
367
|
-
border-radius: 4px;
|
|
368
|
-
cursor: pointer;
|
|
369
|
-
font-size: 13px;
|
|
370
|
-
font-weight: 600;
|
|
371
|
-
transition: background-color 0.15s ease;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.btn-primary {
|
|
375
|
-
background-color: #0066cc;
|
|
376
|
-
color: #ffffff;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
.btn-primary:hover {
|
|
380
|
-
background-color: #0052a3;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.btn-danger {
|
|
384
|
-
background-color: #d9383a;
|
|
385
|
-
color: #ffffff;
|
|
386
|
-
padding: 4px 8px;
|
|
387
|
-
font-size: 12px;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.btn-danger:hover {
|
|
391
|
-
background-color: #b8282a;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
.table-wrapper {
|
|
395
|
-
overflow-x: auto;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
table {
|
|
399
|
-
width: 100%;
|
|
400
|
-
border-collapse: collapse;
|
|
401
|
-
font-size: 13px;
|
|
402
|
-
margin-top: 8px;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
th, td {
|
|
406
|
-
text-align: left;
|
|
407
|
-
padding: 8px 10px;
|
|
408
|
-
border-bottom: 1px solid #eeeeee;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
th {
|
|
412
|
-
background-color: #fafbfc;
|
|
413
|
-
color: #555555;
|
|
414
|
-
font-weight: 600;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
code {
|
|
418
|
-
background: #f0f0f0;
|
|
419
|
-
padding: 2px 4px;
|
|
420
|
-
border-radius: 3px;
|
|
421
|
-
font-size: 12px;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
.empty {
|
|
425
|
-
text-align: center;
|
|
426
|
-
color: #888888;
|
|
427
|
-
padding: 16px;
|
|
428
|
-
}
|
|
429
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, onMounted } from 'vue'
|
|
3
|
+
import api from './services/api'
|
|
4
|
+
import ItemTable from './components/ItemTable.vue'
|
|
5
|
+
import ItemFormModal from './components/ItemFormModal.vue'
|
|
6
|
+
import ItemPatchModal from './components/ItemPatchModal.vue'
|
|
7
|
+
|
|
8
|
+
const items = ref([])
|
|
9
|
+
const loading = ref(false)
|
|
10
|
+
const errorMessage = ref('')
|
|
11
|
+
const selectedItem = ref(null)
|
|
12
|
+
|
|
13
|
+
const isFormModalOpen = ref(false)
|
|
14
|
+
const isEditMode = ref(false)
|
|
15
|
+
const activeItemData = ref(null)
|
|
16
|
+
|
|
17
|
+
const isPatchModalOpen = ref(false)
|
|
18
|
+
const activePatchItem = ref(null)
|
|
19
|
+
|
|
20
|
+
async function fetchAll() {
|
|
21
|
+
loading.value = true
|
|
22
|
+
errorMessage.value = ''
|
|
23
|
+
try {
|
|
24
|
+
const res = await api.get('/items')
|
|
25
|
+
items.value = res.data || []
|
|
26
|
+
} catch (err) {
|
|
27
|
+
errorMessage.value = err.message || 'Failed to fetch items'
|
|
28
|
+
} finally {
|
|
29
|
+
loading.value = false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function openCreateModal() {
|
|
34
|
+
isEditMode.value = false
|
|
35
|
+
activeItemData.value = { name: '', description: '', price: 0 }
|
|
36
|
+
isFormModalOpen.value = true
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function openEditModal(item) {
|
|
40
|
+
isEditMode.value = true
|
|
41
|
+
activeItemData.value = { ...item }
|
|
42
|
+
isFormModalOpen.value = true
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function openPatchModal(item) {
|
|
46
|
+
activePatchItem.value = item
|
|
47
|
+
isPatchModalOpen.value = true
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async function handleFormSubmit(payload) {
|
|
51
|
+
loading.value = true
|
|
52
|
+
errorMessage.value = ''
|
|
53
|
+
try {
|
|
54
|
+
if (isEditMode.value) {
|
|
55
|
+
await api.put('/items/' + payload.id, payload)
|
|
56
|
+
} else {
|
|
57
|
+
await api.post('/items', payload)
|
|
58
|
+
}
|
|
59
|
+
isFormModalOpen.value = false
|
|
60
|
+
await fetchAll()
|
|
61
|
+
} catch (err) {
|
|
62
|
+
errorMessage.value = err.message || 'Failed to save item'
|
|
63
|
+
} finally {
|
|
64
|
+
loading.value = false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function handlePatchSubmit({ id, partial }) {
|
|
69
|
+
loading.value = true
|
|
70
|
+
errorMessage.value = ''
|
|
71
|
+
try {
|
|
72
|
+
await api.patch('/items/' + id, partial)
|
|
73
|
+
isPatchModalOpen.value = false
|
|
74
|
+
await fetchAll()
|
|
75
|
+
} catch (err) {
|
|
76
|
+
errorMessage.value = err.message || 'Failed to patch item'
|
|
77
|
+
} finally {
|
|
78
|
+
loading.value = false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function handleDelete(id) {
|
|
83
|
+
if (!confirm('Are you sure you want to delete this item?')) return
|
|
84
|
+
loading.value = true
|
|
85
|
+
errorMessage.value = ''
|
|
86
|
+
try {
|
|
87
|
+
await api.delete('/items/' + id)
|
|
88
|
+
if (selectedItem.value && selectedItem.value.id === id) {
|
|
89
|
+
selectedItem.value = null
|
|
90
|
+
}
|
|
91
|
+
await fetchAll()
|
|
92
|
+
} catch (err) {
|
|
93
|
+
errorMessage.value = err.message || 'Failed to delete item'
|
|
94
|
+
} finally {
|
|
95
|
+
loading.value = false
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function handleViewDetails(item) {
|
|
100
|
+
selectedItem.value = item
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onMounted(() => {
|
|
104
|
+
fetchAll()
|
|
105
|
+
})
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<div class="app-container">
|
|
110
|
+
<header class="app-header">
|
|
111
|
+
<h1>Vue 3 Axios Basic CRUD</h1>
|
|
112
|
+
<p>Direct Axios with ItemTable, ItemFormModal, ItemPatchModal</p>
|
|
113
|
+
</header>
|
|
114
|
+
|
|
115
|
+
<div v-if="errorMessage" class="error-banner">
|
|
116
|
+
{{ errorMessage }}
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div v-if="selectedItem" class="detail-card">
|
|
120
|
+
<div class="detail-header">
|
|
121
|
+
<h3>Selected Item</h3>
|
|
122
|
+
<button type="button" class="btn-close" @click="selectedItem = null">Close</button>
|
|
123
|
+
</div>
|
|
124
|
+
<div class="detail-body">
|
|
125
|
+
<p><strong>ID:</strong> {{ selectedItem.id }}</p>
|
|
126
|
+
<p><strong>Name:</strong> {{ selectedItem.name }}</p>
|
|
127
|
+
<p><strong>Description:</strong> {{ selectedItem.description || selectedItem.describtion || 'N/A' }}</p>
|
|
128
|
+
<p><strong>Price:</strong> ${{ Number(selectedItem.price).toFixed(2) }}</p>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<ItemTable
|
|
133
|
+
:items="items"
|
|
134
|
+
:loading="loading"
|
|
135
|
+
@open-create="openCreateModal"
|
|
136
|
+
@edit="openEditModal"
|
|
137
|
+
@patch="openPatchModal"
|
|
138
|
+
@delete="handleDelete"
|
|
139
|
+
@view-details="handleViewDetails"
|
|
140
|
+
@refresh="fetchAll"
|
|
141
|
+
/>
|
|
142
|
+
|
|
143
|
+
<ItemFormModal
|
|
144
|
+
:show="isFormModalOpen"
|
|
145
|
+
:is-edit="isEditMode"
|
|
146
|
+
:item-data="activeItemData"
|
|
147
|
+
@close="isFormModalOpen = false"
|
|
148
|
+
@submit="handleFormSubmit"
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<ItemPatchModal
|
|
152
|
+
:show="isPatchModalOpen"
|
|
153
|
+
:item="activePatchItem"
|
|
154
|
+
@close="isPatchModalOpen = false"
|
|
155
|
+
@submit="handlePatchSubmit"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
</template>
|
|
159
|
+
|
|
160
|
+
<style>
|
|
161
|
+
* {
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
margin: 0;
|
|
164
|
+
padding: 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
body {
|
|
168
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
169
|
+
background-color: #f4f6f8;
|
|
170
|
+
color: #333333;
|
|
171
|
+
}
|
|
172
|
+
</style>
|
|
173
|
+
|
|
174
|
+
<style scoped>
|
|
175
|
+
.app-container {
|
|
176
|
+
max-width: 1000px;
|
|
177
|
+
margin: 0 auto;
|
|
178
|
+
padding: 32px 16px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.app-header {
|
|
182
|
+
margin-bottom: 24px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.app-header h1 {
|
|
186
|
+
font-size: 26px;
|
|
187
|
+
color: #1a1a1a;
|
|
188
|
+
margin-bottom: 4px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.app-header p {
|
|
192
|
+
color: #666666;
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.error-banner {
|
|
197
|
+
background-color: #ffebe9;
|
|
198
|
+
color: #cf222e;
|
|
199
|
+
border: 1px solid #ff818266;
|
|
200
|
+
padding: 12px 16px;
|
|
201
|
+
border-radius: 6px;
|
|
202
|
+
margin-bottom: 20px;
|
|
203
|
+
font-size: 14px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.detail-card {
|
|
207
|
+
background: #ffffff;
|
|
208
|
+
border: 1px solid #d0d7de;
|
|
209
|
+
border-radius: 8px;
|
|
210
|
+
padding: 16px;
|
|
211
|
+
margin-bottom: 20px;
|
|
212
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.05);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.detail-header {
|
|
216
|
+
display: flex;
|
|
217
|
+
justify-content: space-between;
|
|
218
|
+
align-items: center;
|
|
219
|
+
border-bottom: 1px solid #eaecef;
|
|
220
|
+
padding-bottom: 8px;
|
|
221
|
+
margin-bottom: 12px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.detail-header h3 {
|
|
225
|
+
font-size: 16px;
|
|
226
|
+
color: #24292f;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.btn-close {
|
|
230
|
+
background: none;
|
|
231
|
+
border: none;
|
|
232
|
+
cursor: pointer;
|
|
233
|
+
color: #57606a;
|
|
234
|
+
font-size: 14px;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.detail-body p {
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
margin-bottom: 6px;
|
|
240
|
+
}
|
|
241
|
+
</style>
|