wad-lab 1.1.5 → 1.1.7

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 (100) hide show
  1. package/bin/index.js +30 -3
  2. package/package.json +1 -1
  3. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  4. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/model/Employee.java +73 -73
  5. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/service/CompanyService.java +90 -60
  6. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +429 -405
  7. package/templates/fullstack-springboot-vue/frontend/vue-axios-interceptor/src/App.vue +177 -159
  8. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +441 -427
  9. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/stores/companyStore.js +126 -96
  10. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/App.vue +84 -69
  11. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  12. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  13. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  14. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/App.vue +191 -167
  15. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
  16. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentList.vue +92 -91
  17. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
  18. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeList.vue +95 -94
  19. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +90 -90
  20. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
  21. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +296 -273
  22. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +219 -196
  23. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
  24. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  25. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  26. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  27. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  28. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  29. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  30. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  31. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  32. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  33. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  34. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/App.vue +59 -59
  35. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/components/DataCard.vue +72 -53
  36. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  37. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  38. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  39. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Employee.java +73 -73
  40. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/service/CompanyService.java +90 -60
  41. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/controller/CourseController.java +46 -42
  42. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/service/CourseService.java +70 -60
  43. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/controller/HospitalController.java +54 -50
  44. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/service/HospitalService.java +65 -54
  45. package/templates/springboot-library-api/src/main/java/com/example/library/controller/LibraryController.java +57 -51
  46. package/templates/springboot-library-api/src/main/java/com/example/library/service/LibraryService.java +70 -60
  47. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/controller/ItemController.java +45 -41
  48. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/service/ItemService.java +48 -38
  49. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  50. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/service/ItemService.java +48 -38
  51. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/controller/ItemController.java +45 -41
  52. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/service/ItemService.java +48 -38
  53. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  54. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/service/ItemService.java +48 -38
  55. package/templates/vue-axios/src/App.vue +264 -243
  56. package/templates/vue-axios/src/services/ItemService.js +27 -21
  57. package/templates/vue-axios-basic/src/App.vue +429 -405
  58. package/templates/vue-axios-interceptor/src/App.vue +177 -159
  59. package/templates/vue-axios-pinia/src/App.vue +441 -427
  60. package/templates/vue-axios-pinia/src/stores/companyStore.js +126 -96
  61. package/templates/vue-axios-pinia-props/src/App.vue +84 -69
  62. package/templates/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  63. package/templates/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  64. package/templates/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  65. package/templates/vue-axios-props-emits/src/App.vue +191 -167
  66. package/templates/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
  67. package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +92 -91
  68. package/templates/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
  69. package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +95 -94
  70. package/templates/vue-axios-router/src/App.vue +90 -90
  71. package/templates/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
  72. package/templates/vue-axios-router/src/views/DepartmentView.vue +296 -273
  73. package/templates/vue-axios-router/src/views/EmployeeView.vue +219 -196
  74. package/templates/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
  75. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  76. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  77. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  78. package/templates/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  79. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  80. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  81. package/templates/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  82. package/templates/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  83. package/templates/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  84. package/templates/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  85. package/templates/vue-axios-router-props/src/App.vue +59 -59
  86. package/templates/vue-axios-router-props/src/components/DataCard.vue +72 -53
  87. package/templates/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  88. package/templates/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  89. package/templates/vue-fetch/src/App.vue +285 -259
  90. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  91. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  92. package/templates/vue-router-pinia-springboot/frontend/src/services/ItemService.js +24 -21
  93. package/templates/vue-router-pinia-springboot/frontend/src/stores/itemStore.js +42 -37
  94. package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +76 -67
  95. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  96. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/service/ItemService.java +45 -35
  97. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  98. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  99. package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +158 -149
  100. package/templates/vue-springboot-mongo-crud/frontend/src/services/ItemService.js +24 -21
@@ -1,231 +1,250 @@
1
- <template>
2
- <div class="departments-page">
3
- <header class="page-header">
4
- <h1>Departments</h1>
5
- <p>Manage company departments.</p>
6
- </header>
7
-
8
- <section class="card form-card">
9
- <h2>Add New Department</h2>
10
- <form @submit.prevent="createDepartment" class="form">
11
- <div class="form-row">
12
- <div class="form-group">
13
- <label for="dept-name">Department Name</label>
14
- <input
15
- id="dept-name"
16
- v-model="form.name"
17
- type="text"
18
- required
19
- placeholder="e.g. Finance"
20
- />
21
- </div>
22
- <div class="form-group">
23
- <label for="dept-code">Department Code</label>
24
- <input
25
- id="dept-code"
26
- v-model="form.code"
27
- type="text"
28
- required
29
- placeholder="e.g. FIN"
30
- />
31
- </div>
32
- </div>
33
- <button type="submit" class="btn btn-primary">Add Department</button>
34
- </form>
35
- </section>
36
-
37
- <section class="card table-card">
38
- <h2>All Departments</h2>
39
- <table class="data-table">
40
- <thead>
41
- <tr>
42
- <th>ID</th>
43
- <th>Name</th>
44
- <th>Code</th>
45
- <th>Actions</th>
46
- </tr>
47
- </thead>
48
- <tbody>
49
- <tr v-if="departments.length === 0">
50
- <td colspan="4" class="empty">No departments found.</td>
51
- </tr>
52
- <tr v-for="dept in departments" :key="dept.id">
53
- <td>{{ dept.id }}</td>
54
- <td>{{ dept.name }}</td>
55
- <td><code>{{ dept.code }}</code></td>
56
- <td>
57
- <button @click="deleteDepartment(dept.id)" class="btn btn-danger">Delete</button>
58
- </td>
59
- </tr>
60
- </tbody>
61
- </table>
62
- </section>
63
- </div>
64
- </template>
65
-
66
- <script setup>
67
- import { ref, reactive, onMounted } from 'vue'
68
- import api from '../services/api'
69
-
70
- const departments = ref([])
71
- const form = reactive({
72
- name: '',
73
- code: ''
74
- })
75
-
76
- const fetchDepartments = async () => {
77
- try {
78
- const res = await api.get('/departments')
79
- departments.value = Array.isArray(res.data) ? res.data : []
80
- } catch (err) {
81
- departments.value = []
82
- }
83
- }
84
-
85
- const createDepartment = async () => {
86
- try {
87
- await api.post('/departments', {
88
- name: form.name,
89
- code: form.code
90
- })
91
- form.name = ''
92
- form.code = ''
93
- await fetchDepartments()
94
- } catch (err) {
95
- alert('Failed to add department')
96
- }
97
- }
98
-
99
- const deleteDepartment = async (id) => {
100
- try {
101
- await api.delete(`/departments/${id}`)
102
- await fetchDepartments()
103
- } catch (err) {
104
- alert('Failed to delete department')
105
- }
106
- }
107
-
108
- onMounted(() => {
109
- fetchDepartments()
110
- })
111
- </script>
112
-
113
- <style scoped>
114
- .departments-page {
115
- max-width: 900px;
116
- }
117
-
118
- .page-header {
119
- margin-bottom: 24px;
120
- }
121
-
122
- .page-header h1 {
123
- font-size: 1.75rem;
124
- margin-bottom: 6px;
125
- color: #1e293b;
126
- }
127
-
128
- .page-header p {
129
- color: #64748b;
130
- }
131
-
132
- .card {
133
- background: #ffffff;
134
- padding: 24px;
135
- border-radius: 8px;
136
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
137
- margin-bottom: 24px;
138
- }
139
-
140
- .card h2 {
141
- font-size: 1.2rem;
142
- margin-bottom: 16px;
143
- color: #334155;
144
- }
145
-
146
- .form-row {
147
- display: flex;
148
- gap: 16px;
149
- margin-bottom: 16px;
150
- }
151
-
152
- .form-group {
153
- flex: 1;
154
- display: flex;
155
- flex-direction: column;
156
- gap: 6px;
157
- }
158
-
159
- label {
160
- font-size: 0.875rem;
161
- font-weight: 500;
162
- color: #475569;
163
- }
164
-
165
- input {
166
- padding: 8px 12px;
167
- border: 1px solid #cbd5e1;
168
- border-radius: 6px;
169
- font-size: 0.95rem;
170
- }
171
-
172
- input:focus {
173
- outline: none;
174
- border-color: #2563eb;
175
- }
176
-
177
- .btn {
178
- padding: 8px 16px;
179
- border: none;
180
- border-radius: 6px;
181
- cursor: pointer;
182
- font-weight: 500;
183
- transition: opacity 0.2s;
184
- }
185
-
186
- .btn:hover {
187
- opacity: 0.9;
188
- }
189
-
190
- .btn-primary {
191
- background-color: #2563eb;
192
- color: #ffffff;
193
- }
194
-
195
- .btn-danger {
196
- background-color: #ef4444;
197
- color: #ffffff;
198
- }
199
-
200
- .data-table {
201
- width: 100%;
202
- border-collapse: collapse;
203
- }
204
-
205
- .data-table th,
206
- .data-table td {
207
- padding: 12px;
208
- text-align: left;
209
- border-bottom: 1px solid #e2e8f0;
210
- }
211
-
212
- .data-table th {
213
- background-color: #f8fafc;
214
- font-size: 0.875rem;
215
- color: #475569;
216
- font-weight: 600;
217
- }
218
-
219
- .data-table td code {
220
- background-color: #f1f5f9;
221
- padding: 2px 6px;
222
- border-radius: 4px;
223
- font-size: 0.85rem;
224
- }
225
-
226
- .empty {
227
- text-align: center;
228
- color: #94a3b8;
229
- padding: 24px;
230
- }
231
- </style>
1
+ <template>
2
+ <div class="departments-page">
3
+ <header class="page-header">
4
+ <h1>Departments</h1>
5
+ <p>Manage company departments.</p>
6
+ </header>
7
+
8
+ <section class="card form-card">
9
+ <h2>Add New Department</h2>
10
+ <form @submit.prevent="createDepartment" class="form">
11
+ <div class="form-row">
12
+ <div class="form-group">
13
+ <label for="dept-name">Department Name</label>
14
+ <input
15
+ id="dept-name"
16
+ v-model="form.name"
17
+ type="text"
18
+ required
19
+ placeholder="e.g. Finance"
20
+ />
21
+ </div>
22
+ <div class="form-group">
23
+ <label for="dept-code">Department Code</label>
24
+ <input
25
+ id="dept-code"
26
+ v-model="form.code"
27
+ type="text"
28
+ required
29
+ placeholder="e.g. FIN"
30
+ />
31
+ </div>
32
+ </div>
33
+ <button type="submit" class="btn btn-primary">Add Department</button>
34
+ </form>
35
+ </section>
36
+
37
+ <section class="card table-card">
38
+ <h2>All Departments</h2>
39
+ <table class="data-table">
40
+ <thead>
41
+ <tr>
42
+ <th>ID</th>
43
+ <th>Name</th>
44
+ <th>Code</th>
45
+ <th>Actions</th>
46
+ </tr>
47
+ </thead>
48
+ <tbody>
49
+ <tr v-if="departments.length === 0">
50
+ <td colspan="4" class="empty">No departments found.</td>
51
+ </tr>
52
+ <tr v-for="dept in departments" :key="dept.id">
53
+ <td>{{ dept.id }}</td>
54
+ <td>{{ dept.name }}</td>
55
+ <td><code>{{ dept.code }}</code></td>
56
+ <td>
57
+ <button @click="handlePatch(dept.id, dept.code)" class="btn btn-warning">Patch</button>
58
+ <button @click="deleteDepartment(dept.id)" class="btn btn-danger">Delete</button>
59
+ </td>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+ </section>
64
+ </div>
65
+ </template>
66
+
67
+ <script setup>
68
+ import { ref, reactive, onMounted } from 'vue'
69
+ import api from '../services/api'
70
+
71
+ const departments = ref([])
72
+ const form = reactive({
73
+ name: '',
74
+ code: ''
75
+ })
76
+
77
+ const fetchDepartments = async () => {
78
+ try {
79
+ const res = await api.get('/departments')
80
+ departments.value = Array.isArray(res.data) ? res.data : []
81
+ } catch (err) {
82
+ departments.value = []
83
+ }
84
+ }
85
+
86
+ const createDepartment = async () => {
87
+ try {
88
+ await api.post('/departments', {
89
+ name: form.name,
90
+ code: form.code
91
+ })
92
+ form.name = ''
93
+ form.code = ''
94
+ await fetchDepartments()
95
+ } catch (err) {
96
+ alert('Failed to add department')
97
+ }
98
+ }
99
+
100
+ const deleteDepartment = async (id) => {
101
+ try {
102
+ await api.delete(`/departments/${id}`)
103
+ await fetchDepartments()
104
+ } catch (err) {
105
+ alert('Failed to delete department')
106
+ }
107
+ }
108
+
109
+ const handlePatch = async (id, code) => {
110
+ const newCode = prompt('New code:', code)
111
+ if (newCode) {
112
+ try {
113
+ await api.patch(`/departments/${id}`, { code: newCode })
114
+ await fetchDepartments()
115
+ } catch (err) {
116
+ alert('Failed to patch department')
117
+ }
118
+ }
119
+ }
120
+
121
+ onMounted(() => {
122
+ fetchDepartments()
123
+ })
124
+ </script>
125
+
126
+ <style scoped>
127
+ .departments-page {
128
+ max-width: 900px;
129
+ }
130
+
131
+ .page-header {
132
+ margin-bottom: 24px;
133
+ }
134
+
135
+ .page-header h1 {
136
+ font-size: 1.75rem;
137
+ margin-bottom: 6px;
138
+ color: #1e293b;
139
+ }
140
+
141
+ .page-header p {
142
+ color: #64748b;
143
+ }
144
+
145
+ .card {
146
+ background: #ffffff;
147
+ padding: 24px;
148
+ border-radius: 8px;
149
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
150
+ margin-bottom: 24px;
151
+ }
152
+
153
+ .card h2 {
154
+ font-size: 1.2rem;
155
+ margin-bottom: 16px;
156
+ color: #334155;
157
+ }
158
+
159
+ .form-row {
160
+ display: flex;
161
+ gap: 16px;
162
+ margin-bottom: 16px;
163
+ }
164
+
165
+ .form-group {
166
+ flex: 1;
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 6px;
170
+ }
171
+
172
+ label {
173
+ font-size: 0.875rem;
174
+ font-weight: 500;
175
+ color: #475569;
176
+ }
177
+
178
+ input {
179
+ padding: 8px 12px;
180
+ border: 1px solid #cbd5e1;
181
+ border-radius: 6px;
182
+ font-size: 0.95rem;
183
+ }
184
+
185
+ input:focus {
186
+ outline: none;
187
+ border-color: #2563eb;
188
+ }
189
+
190
+ .btn {
191
+ padding: 8px 16px;
192
+ border: none;
193
+ border-radius: 6px;
194
+ cursor: pointer;
195
+ font-weight: 500;
196
+ transition: opacity 0.2s;
197
+ }
198
+
199
+ .btn:hover {
200
+ opacity: 0.9;
201
+ }
202
+
203
+ .btn-primary {
204
+ background-color: #2563eb;
205
+ color: #ffffff;
206
+ }
207
+
208
+ .btn-danger {
209
+ background-color: #ef4444;
210
+ color: #ffffff;
211
+ }
212
+
213
+ .btn-warning {
214
+ background-color: #f59e0b;
215
+ color: #ffffff;
216
+ margin-right: 8px;
217
+ }
218
+
219
+ .data-table {
220
+ width: 100%;
221
+ border-collapse: collapse;
222
+ }
223
+
224
+ .data-table th,
225
+ .data-table td {
226
+ padding: 12px;
227
+ text-align: left;
228
+ border-bottom: 1px solid #e2e8f0;
229
+ }
230
+
231
+ .data-table th {
232
+ background-color: #f8fafc;
233
+ font-size: 0.875rem;
234
+ color: #475569;
235
+ font-weight: 600;
236
+ }
237
+
238
+ .data-table td code {
239
+ background-color: #f1f5f9;
240
+ padding: 2px 6px;
241
+ border-radius: 4px;
242
+ font-size: 0.85rem;
243
+ }
244
+
245
+ .empty {
246
+ text-align: center;
247
+ color: #94a3b8;
248
+ padding: 24px;
249
+ }
250
+ </style>