wad-lab 1.1.6 → 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 (93) hide show
  1. package/package.json +1 -1
  2. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  3. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/model/Employee.java +73 -73
  4. package/templates/fullstack-springboot-vue/backend/src/main/java/com/example/company/service/CompanyService.java +90 -60
  5. package/templates/fullstack-springboot-vue/frontend/vue-axios-basic/src/App.vue +429 -405
  6. package/templates/fullstack-springboot-vue/frontend/vue-axios-interceptor/src/App.vue +177 -159
  7. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/App.vue +441 -427
  8. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia/src/stores/companyStore.js +126 -96
  9. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/App.vue +84 -69
  10. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  11. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  12. package/templates/fullstack-springboot-vue/frontend/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  13. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/App.vue +191 -167
  14. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentForm.vue +98 -98
  15. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/DepartmentList.vue +92 -91
  16. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeForm.vue +128 -128
  17. package/templates/fullstack-springboot-vue/frontend/vue-axios-props-emits/src/components/EmployeeList.vue +95 -94
  18. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/App.vue +90 -90
  19. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/AddEmployeeView.vue +247 -247
  20. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/DepartmentView.vue +296 -273
  21. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/EmployeeView.vue +219 -196
  22. package/templates/fullstack-springboot-vue/frontend/vue-axios-router/src/views/HomeDashboardView.vue +263 -263
  23. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  24. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  25. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  26. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  27. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  28. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  29. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  30. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  31. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  32. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  33. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/App.vue +59 -59
  34. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/components/DataCard.vue +72 -53
  35. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  36. package/templates/fullstack-springboot-vue/frontend/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  37. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/controller/CompanyController.java +88 -74
  38. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/model/Employee.java +73 -73
  39. package/templates/springboot-2model-1controller-api/src/main/java/com/example/company/service/CompanyService.java +90 -60
  40. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/controller/CourseController.java +46 -42
  41. package/templates/springboot-course-registration/src/main/java/com/example/coursereg/service/CourseService.java +70 -60
  42. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/controller/HospitalController.java +54 -50
  43. package/templates/springboot-hospital-api/src/main/java/com/example/hospital/service/HospitalService.java +65 -54
  44. package/templates/springboot-library-api/src/main/java/com/example/library/controller/LibraryController.java +57 -51
  45. package/templates/springboot-library-api/src/main/java/com/example/library/service/LibraryService.java +70 -60
  46. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/controller/ItemController.java +45 -41
  47. package/templates/springboot-mockmvc/src/main/java/com/example/mockmvc/service/ItemService.java +48 -38
  48. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  49. package/templates/springboot-mongo-aggregation/src/main/java/com/example/aggregation/service/ItemService.java +48 -38
  50. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/controller/ItemController.java +45 -41
  51. package/templates/springboot-mongo-aggregation-mockmvc/src/main/java/com/example/aggmockmvc/service/ItemService.java +48 -38
  52. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  53. package/templates/springboot-mongo-crud/src/main/java/com/example/crud/service/ItemService.java +48 -38
  54. package/templates/vue-axios/src/App.vue +264 -243
  55. package/templates/vue-axios/src/services/ItemService.js +27 -21
  56. package/templates/vue-axios-basic/src/App.vue +24 -0
  57. package/templates/vue-axios-interceptor/src/App.vue +177 -159
  58. package/templates/vue-axios-pinia/src/App.vue +14 -0
  59. package/templates/vue-axios-pinia/src/stores/companyStore.js +126 -96
  60. package/templates/vue-axios-pinia-props/src/App.vue +84 -69
  61. package/templates/vue-axios-pinia-props/src/components/DepartmentSection.vue +164 -152
  62. package/templates/vue-axios-pinia-props/src/components/EmployeeSection.vue +193 -181
  63. package/templates/vue-axios-pinia-props/src/stores/companyStore.js +126 -35
  64. package/templates/vue-axios-props-emits/src/App.vue +24 -0
  65. package/templates/vue-axios-props-emits/src/components/DepartmentList.vue +2 -1
  66. package/templates/vue-axios-props-emits/src/components/EmployeeList.vue +2 -1
  67. package/templates/vue-axios-router/src/views/DepartmentView.vue +23 -0
  68. package/templates/vue-axios-router/src/views/EmployeeView.vue +23 -0
  69. package/templates/vue-axios-router-children/src/views/DepartmentListView.vue +250 -231
  70. package/templates/vue-axios-router-children/src/views/EmployeeDetailView.vue +181 -159
  71. package/templates/vue-axios-router-children/src/views/EmployeeListView.vue +315 -295
  72. package/templates/vue-axios-router-pinia/src/stores/companyStore.js +137 -70
  73. package/templates/vue-axios-router-pinia/src/views/DepartmentView.vue +229 -209
  74. package/templates/vue-axios-router-pinia/src/views/EmployeeView.vue +257 -237
  75. package/templates/vue-axios-router-pinia-props/src/components/EntityTable.vue +106 -92
  76. package/templates/vue-axios-router-pinia-props/src/stores/companyStore.js +139 -84
  77. package/templates/vue-axios-router-pinia-props/src/views/ManageDepartmentsView.vue +73 -64
  78. package/templates/vue-axios-router-pinia-props/src/views/ManageEmployeesView.vue +76 -67
  79. package/templates/vue-axios-router-props/src/components/DataCard.vue +72 -53
  80. package/templates/vue-axios-router-props/src/views/DepartmentPage.vue +89 -77
  81. package/templates/vue-axios-router-props/src/views/EmployeePage.vue +128 -116
  82. package/templates/vue-fetch/src/App.vue +285 -259
  83. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  84. package/templates/vue-router-pinia-springboot/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  85. package/templates/vue-router-pinia-springboot/frontend/src/services/ItemService.js +24 -21
  86. package/templates/vue-router-pinia-springboot/frontend/src/stores/itemStore.js +42 -37
  87. package/templates/vue-router-pinia-springboot/frontend/src/views/ListView.vue +76 -67
  88. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/controller/ItemController.java +45 -41
  89. package/templates/vue-springboot-mongo-aggregation/backend/src/main/java/com/example/aggregation/service/ItemService.java +45 -35
  90. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/controller/ItemController.java +45 -41
  91. package/templates/vue-springboot-mongo-crud/backend/src/main/java/com/example/crud/service/ItemService.java +45 -35
  92. package/templates/vue-springboot-mongo-crud/frontend/src/App.vue +158 -149
  93. package/templates/vue-springboot-mongo-crud/frontend/src/services/ItemService.js +24 -21
@@ -1,237 +1,257 @@
1
- <template>
2
- <div class="employee-view">
3
- <h2>Employees Management</h2>
4
-
5
- <section class="card">
6
- <h3>Add Employee</h3>
7
- <form @submit.prevent="handleSubmit" class="form">
8
- <div class="form-group">
9
- <label for="emp-name">Full Name</label>
10
- <input
11
- id="emp-name"
12
- v-model="form.name"
13
- type="text"
14
- required
15
- placeholder="e.g. Jane Doe"
16
- />
17
- </div>
18
- <div class="form-group">
19
- <label for="emp-email">Email Address</label>
20
- <input
21
- id="emp-email"
22
- v-model="form.email"
23
- type="email"
24
- required
25
- placeholder="e.g. jane@example.com"
26
- />
27
- </div>
28
- <div class="form-group">
29
- <label for="emp-dept">Department</label>
30
- <select id="emp-dept" v-model="form.departmentId" required>
31
- <option value="" disabled>Select Department</option>
32
- <option v-for="dept in companyStore.departments" :key="dept.id" :value="dept.id">
33
- {{ dept.name }} ({{ dept.code }})
34
- </option>
35
- </select>
36
- </div>
37
- <div class="form-group">
38
- <label for="emp-salary">Salary</label>
39
- <input
40
- id="emp-salary"
41
- v-model.number="form.salary"
42
- type="number"
43
- min="0"
44
- step="any"
45
- required
46
- placeholder="e.g. 75000"
47
- />
48
- </div>
49
- <button type="submit" class="btn btn-primary">Add Employee</button>
50
- </form>
51
- </section>
52
-
53
- <section class="card table-card">
54
- <h3>Employee List</h3>
55
- <div class="table-wrapper">
56
- <table>
57
- <thead>
58
- <tr>
59
- <th>ID</th>
60
- <th>Name</th>
61
- <th>Email</th>
62
- <th>Department</th>
63
- <th>Salary</th>
64
- <th>Action</th>
65
- </tr>
66
- </thead>
67
- <tbody>
68
- <tr v-if="companyStore.employees.length === 0">
69
- <td colspan="6" class="empty">No employees found</td>
70
- </tr>
71
- <tr v-for="emp in companyStore.employees" :key="emp.id">
72
- <td>{{ emp.id }}</td>
73
- <td>{{ emp.name }}</td>
74
- <td>{{ emp.email }}</td>
75
- <td>{{ companyStore.getDepartmentName(emp.departmentId) }}</td>
76
- <td>${{ Number(emp.salary).toLocaleString() }}</td>
77
- <td>
78
- <button @click="handleDelete(emp.id)" class="btn btn-danger">Delete</button>
79
- </td>
80
- </tr>
81
- </tbody>
82
- </table>
83
- </div>
84
- </section>
85
- </div>
86
- </template>
87
-
88
- <script setup>
89
- import { reactive, onMounted } from 'vue'
90
- import { useCompanyStore } from '../stores/companyStore'
91
-
92
- const companyStore = useCompanyStore()
93
-
94
- const form = reactive({
95
- name: '',
96
- email: '',
97
- departmentId: '',
98
- salary: ''
99
- })
100
-
101
- const handleSubmit = async () => {
102
- await companyStore.addEmployee({
103
- name: form.name,
104
- email: form.email,
105
- departmentId: Number(form.departmentId),
106
- salary: Number(form.salary)
107
- })
108
- form.name = ''
109
- form.email = ''
110
- form.departmentId = ''
111
- form.salary = ''
112
- }
113
-
114
- const handleDelete = async (id) => {
115
- await companyStore.deleteEmployee(id)
116
- }
117
-
118
- onMounted(() => {
119
- companyStore.fetchEmployees()
120
- companyStore.fetchDepartments()
121
- })
122
- </script>
123
-
124
- <style scoped>
125
- .employee-view h2 {
126
- font-size: 22px;
127
- margin-bottom: 20px;
128
- color: #1a1a1a;
129
- }
130
-
131
- .card {
132
- background: #ffffff;
133
- border: 1px solid #e1e4e8;
134
- border-radius: 8px;
135
- padding: 20px;
136
- margin-bottom: 24px;
137
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
138
- }
139
-
140
- .card h3 {
141
- font-size: 16px;
142
- margin-bottom: 16px;
143
- color: #333333;
144
- }
145
-
146
- .form {
147
- display: flex;
148
- flex-direction: column;
149
- gap: 12px;
150
- max-width: 400px;
151
- }
152
-
153
- .form-group {
154
- display: flex;
155
- flex-direction: column;
156
- gap: 4px;
157
- }
158
-
159
- .form-group label {
160
- font-size: 13px;
161
- font-weight: 600;
162
- color: #444444;
163
- }
164
-
165
- .form-group input,
166
- .form-group select {
167
- padding: 8px 10px;
168
- border: 1px solid #cccccc;
169
- border-radius: 4px;
170
- font-size: 14px;
171
- background-color: #ffffff;
172
- }
173
-
174
- .form-group input:focus,
175
- .form-group select:focus {
176
- outline: none;
177
- border-color: #0066cc;
178
- }
179
-
180
- .btn {
181
- padding: 8px 14px;
182
- border: none;
183
- border-radius: 4px;
184
- cursor: pointer;
185
- font-size: 13px;
186
- font-weight: 600;
187
- }
188
-
189
- .btn-primary {
190
- background-color: #0066cc;
191
- color: #ffffff;
192
- align-self: flex-start;
193
- }
194
-
195
- .btn-primary:hover {
196
- background-color: #0052a3;
197
- }
198
-
199
- .btn-danger {
200
- background-color: #d9383a;
201
- color: #ffffff;
202
- padding: 4px 8px;
203
- font-size: 12px;
204
- }
205
-
206
- .btn-danger:hover {
207
- background-color: #b8282a;
208
- }
209
-
210
- .table-wrapper {
211
- overflow-x: auto;
212
- }
213
-
214
- table {
215
- width: 100%;
216
- border-collapse: collapse;
217
- font-size: 13px;
218
- }
219
-
220
- th, td {
221
- text-align: left;
222
- padding: 8px 10px;
223
- border-bottom: 1px solid #eeeeee;
224
- }
225
-
226
- th {
227
- background-color: #fafbfc;
228
- color: #555555;
229
- font-weight: 600;
230
- }
231
-
232
- .empty {
233
- text-align: center;
234
- color: #888888;
235
- padding: 16px;
236
- }
237
- </style>
1
+ <template>
2
+ <div class="employee-view">
3
+ <h2>Employees Management</h2>
4
+
5
+ <section class="card">
6
+ <h3>Add Employee</h3>
7
+ <form @submit.prevent="handleSubmit" class="form">
8
+ <div class="form-group">
9
+ <label for="emp-name">Full Name</label>
10
+ <input
11
+ id="emp-name"
12
+ v-model="form.name"
13
+ type="text"
14
+ required
15
+ placeholder="e.g. Jane Doe"
16
+ />
17
+ </div>
18
+ <div class="form-group">
19
+ <label for="emp-email">Email Address</label>
20
+ <input
21
+ id="emp-email"
22
+ v-model="form.email"
23
+ type="email"
24
+ required
25
+ placeholder="e.g. jane@example.com"
26
+ />
27
+ </div>
28
+ <div class="form-group">
29
+ <label for="emp-dept">Department</label>
30
+ <select id="emp-dept" v-model="form.departmentId" required>
31
+ <option value="" disabled>Select Department</option>
32
+ <option v-for="dept in companyStore.departments" :key="dept.id" :value="dept.id">
33
+ {{ dept.name }} ({{ dept.code }})
34
+ </option>
35
+ </select>
36
+ </div>
37
+ <div class="form-group">
38
+ <label for="emp-salary">Salary</label>
39
+ <input
40
+ id="emp-salary"
41
+ v-model.number="form.salary"
42
+ type="number"
43
+ min="0"
44
+ step="any"
45
+ required
46
+ placeholder="e.g. 75000"
47
+ />
48
+ </div>
49
+ <button type="submit" class="btn btn-primary">Add Employee</button>
50
+ </form>
51
+ </section>
52
+
53
+ <section class="card table-card">
54
+ <h3>Employee List</h3>
55
+ <div class="table-wrapper">
56
+ <table>
57
+ <thead>
58
+ <tr>
59
+ <th>ID</th>
60
+ <th>Name</th>
61
+ <th>Email</th>
62
+ <th>Department</th>
63
+ <th>Salary</th>
64
+ <th>Action</th>
65
+ </tr>
66
+ </thead>
67
+ <tbody>
68
+ <tr v-if="companyStore.employees.length === 0">
69
+ <td colspan="6" class="empty">No employees found</td>
70
+ </tr>
71
+ <tr v-for="emp in companyStore.employees" :key="emp.id">
72
+ <td>{{ emp.id }}</td>
73
+ <td>{{ emp.name }}</td>
74
+ <td>{{ emp.email }}</td>
75
+ <td>{{ companyStore.getDepartmentName(emp.departmentId) }}</td>
76
+ <td>${{ Number(emp.salary).toLocaleString() }}</td>
77
+ <td>
78
+ <button @click="handlePatchEmployee(emp.id, emp.salary)" class="btn btn-warning">Patch</button>
79
+ <button @click="handleDelete(emp.id)" class="btn btn-danger">Delete</button>
80
+ </td>
81
+ </tr>
82
+ </tbody>
83
+ </table>
84
+ </div>
85
+ </section>
86
+ </div>
87
+ </template>
88
+
89
+ <script setup>
90
+ import { reactive, onMounted } from 'vue'
91
+ import { useCompanyStore } from '../stores/companyStore'
92
+
93
+ const companyStore = useCompanyStore()
94
+
95
+ const form = reactive({
96
+ name: '',
97
+ email: '',
98
+ departmentId: '',
99
+ salary: ''
100
+ })
101
+
102
+ const handleSubmit = async () => {
103
+ await companyStore.addEmployee({
104
+ name: form.name,
105
+ email: form.email,
106
+ departmentId: Number(form.departmentId),
107
+ salary: Number(form.salary)
108
+ })
109
+ form.name = ''
110
+ form.email = ''
111
+ form.departmentId = ''
112
+ form.salary = ''
113
+ }
114
+
115
+ const handleDelete = async (id) => {
116
+ await companyStore.deleteEmployee(id)
117
+ }
118
+
119
+ const handlePatchEmployee = async (id, salary) => {
120
+ const newSalary = prompt('New salary:', salary)
121
+ if (newSalary !== null && newSalary !== '') {
122
+ await companyStore.patchEmployee(id, { salary: Number(newSalary) })
123
+ }
124
+ }
125
+
126
+ onMounted(() => {
127
+ companyStore.fetchEmployees()
128
+ companyStore.fetchDepartments()
129
+ })
130
+ </script>
131
+
132
+ <style scoped>
133
+ .employee-view h2 {
134
+ font-size: 22px;
135
+ margin-bottom: 20px;
136
+ color: #1a1a1a;
137
+ }
138
+
139
+ .card {
140
+ background: #ffffff;
141
+ border: 1px solid #e1e4e8;
142
+ border-radius: 8px;
143
+ padding: 20px;
144
+ margin-bottom: 24px;
145
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
146
+ }
147
+
148
+ .card h3 {
149
+ font-size: 16px;
150
+ margin-bottom: 16px;
151
+ color: #333333;
152
+ }
153
+
154
+ .form {
155
+ display: flex;
156
+ flex-direction: column;
157
+ gap: 12px;
158
+ max-width: 400px;
159
+ }
160
+
161
+ .form-group {
162
+ display: flex;
163
+ flex-direction: column;
164
+ gap: 4px;
165
+ }
166
+
167
+ .form-group label {
168
+ font-size: 13px;
169
+ font-weight: 600;
170
+ color: #444444;
171
+ }
172
+
173
+ .form-group input,
174
+ .form-group select {
175
+ padding: 8px 10px;
176
+ border: 1px solid #cccccc;
177
+ border-radius: 4px;
178
+ font-size: 14px;
179
+ background-color: #ffffff;
180
+ }
181
+
182
+ .form-group input:focus,
183
+ .form-group select:focus {
184
+ outline: none;
185
+ border-color: #0066cc;
186
+ }
187
+
188
+ .btn {
189
+ padding: 8px 14px;
190
+ border: none;
191
+ border-radius: 4px;
192
+ cursor: pointer;
193
+ font-size: 13px;
194
+ font-weight: 600;
195
+ }
196
+
197
+ .btn-primary {
198
+ background-color: #0066cc;
199
+ color: #ffffff;
200
+ align-self: flex-start;
201
+ }
202
+
203
+ .btn-primary:hover {
204
+ background-color: #0052a3;
205
+ }
206
+
207
+ .btn-danger {
208
+ background-color: #d9383a;
209
+ color: #ffffff;
210
+ padding: 4px 8px;
211
+ font-size: 12px;
212
+ }
213
+
214
+ .btn-danger:hover {
215
+ background-color: #b8282a;
216
+ }
217
+
218
+ .btn-warning {
219
+ background-color: #f0ad4e;
220
+ color: #ffffff;
221
+ padding: 4px 8px;
222
+ font-size: 12px;
223
+ margin-right: 6px;
224
+ }
225
+
226
+ .btn-warning:hover {
227
+ background-color: #ec971f;
228
+ }
229
+
230
+ .table-wrapper {
231
+ overflow-x: auto;
232
+ }
233
+
234
+ table {
235
+ width: 100%;
236
+ border-collapse: collapse;
237
+ font-size: 13px;
238
+ }
239
+
240
+ th, td {
241
+ text-align: left;
242
+ padding: 8px 10px;
243
+ border-bottom: 1px solid #eeeeee;
244
+ }
245
+
246
+ th {
247
+ background-color: #fafbfc;
248
+ color: #555555;
249
+ font-weight: 600;
250
+ }
251
+
252
+ .empty {
253
+ text-align: center;
254
+ color: #888888;
255
+ padding: 16px;
256
+ }
257
+ </style>