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.
Files changed (207) hide show
  1. package/bin/index.js +472 -631
  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,207 @@
1
+ <script setup>
2
+ import { reactive, watch } from 'vue'
3
+
4
+ const props = defineProps({
5
+ show: {
6
+ type: Boolean,
7
+ default: false
8
+ },
9
+ type: {
10
+ type: String,
11
+ default: 'department'
12
+ },
13
+ departments: {
14
+ type: Array,
15
+ default: () => []
16
+ }
17
+ })
18
+
19
+ const emit = defineEmits(['close', 'submit'])
20
+
21
+ const deptForm = reactive({ name: '', code: '' })
22
+ const empForm = reactive({ name: '', email: '', departmentId: '', salary: '' })
23
+
24
+ watch(
25
+ () => props.show,
26
+ (val) => {
27
+ if (val) {
28
+ deptForm.name = ''
29
+ deptForm.code = ''
30
+ empForm.name = ''
31
+ empForm.email = ''
32
+ empForm.departmentId = ''
33
+ empForm.salary = ''
34
+ }
35
+ }
36
+ )
37
+
38
+ function submitDept() {
39
+ if (!deptForm.name || !deptForm.code) return
40
+ emit('submit', {
41
+ type: 'department',
42
+ data: { name: deptForm.name, code: deptForm.code }
43
+ })
44
+ }
45
+
46
+ function submitEmp() {
47
+ if (!empForm.name || !empForm.email || !empForm.departmentId) return
48
+ emit('submit', {
49
+ type: 'employee',
50
+ data: {
51
+ name: empForm.name,
52
+ email: empForm.email,
53
+ departmentId: Number(empForm.departmentId),
54
+ salary: Number(empForm.salary) || 0
55
+ }
56
+ })
57
+ }
58
+ </script>
59
+
60
+ <template>
61
+ <div v-if="show" class="modal-overlay" @click.self="emit('close')">
62
+ <div class="modal-card">
63
+ <div class="modal-header">
64
+ <h3>{{ type === 'department' ? 'Add Department' : 'Add Employee' }}</h3>
65
+ <button type="button" class="btn-close" @click="emit('close')">x</button>
66
+ </div>
67
+
68
+ <div class="modal-body">
69
+ <form v-if="type === 'department'" @submit.prevent="submitDept" class="form">
70
+ <div class="form-group">
71
+ <label for="dept-name">Department Name</label>
72
+ <input id="dept-name" v-model="deptForm.name" required placeholder="e.g. Engineering" />
73
+ </div>
74
+ <div class="form-group">
75
+ <label for="dept-code">Department Code</label>
76
+ <input id="dept-code" v-model="deptForm.code" required placeholder="e.g. ENG" />
77
+ </div>
78
+ <div class="modal-actions">
79
+ <button type="button" class="btn btn-secondary" @click="emit('close')">Cancel</button>
80
+ <button type="submit" class="btn btn-primary">Add Department</button>
81
+ </div>
82
+ </form>
83
+
84
+ <form v-else @submit.prevent="submitEmp" class="form">
85
+ <div class="form-group">
86
+ <label for="emp-name">Full Name</label>
87
+ <input id="emp-name" v-model="empForm.name" required placeholder="e.g. Jane Doe" />
88
+ </div>
89
+ <div class="form-group">
90
+ <label for="emp-email">Email Address</label>
91
+ <input id="emp-email" v-model="empForm.email" type="email" required placeholder="e.g. jane@example.com" />
92
+ </div>
93
+ <div class="form-group">
94
+ <label for="emp-dept">Department</label>
95
+ <select id="emp-dept" v-model="empForm.departmentId" required>
96
+ <option value="" disabled>Select Department</option>
97
+ <option v-for="dept in departments" :key="dept.id" :value="dept.id">
98
+ {{ dept.name }} ({{ dept.code }})
99
+ </option>
100
+ </select>
101
+ </div>
102
+ <div class="form-group">
103
+ <label for="emp-salary">Salary ($)</label>
104
+ <input id="emp-salary" v-model.number="empForm.salary" type="number" min="0" required placeholder="75000" />
105
+ </div>
106
+ <div class="modal-actions">
107
+ <button type="button" class="btn btn-secondary" @click="emit('close')">Cancel</button>
108
+ <button type="submit" class="btn btn-primary">Add Employee</button>
109
+ </div>
110
+ </form>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ </template>
115
+
116
+ <style scoped>
117
+ .modal-overlay {
118
+ position: fixed;
119
+ inset: 0;
120
+ background-color: rgba(0, 0, 0, 0.4);
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ z-index: 1000;
125
+ padding: 16px;
126
+ }
127
+
128
+ .modal-card {
129
+ background: #ffffff;
130
+ border-radius: 8px;
131
+ width: 100%;
132
+ max-width: 440px;
133
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
134
+ overflow: hidden;
135
+ }
136
+
137
+ .modal-header {
138
+ padding: 16px 20px;
139
+ border-bottom: 1px solid #e1e4e8;
140
+ display: flex;
141
+ justify-content: space-between;
142
+ align-items: center;
143
+ }
144
+
145
+ .modal-header h3 {
146
+ font-size: 16px;
147
+ margin: 0;
148
+ color: #24292f;
149
+ }
150
+
151
+ .btn-close {
152
+ background: none;
153
+ border: none;
154
+ font-size: 16px;
155
+ cursor: pointer;
156
+ color: #57606a;
157
+ }
158
+
159
+ .modal-body {
160
+ padding: 20px;
161
+ }
162
+
163
+ .form {
164
+ display: flex;
165
+ flex-direction: column;
166
+ gap: 12px;
167
+ }
168
+
169
+ .form-group {
170
+ display: flex;
171
+ flex-direction: column;
172
+ gap: 4px;
173
+ }
174
+
175
+ .form-group label {
176
+ font-size: 13px;
177
+ font-weight: 600;
178
+ color: #444444;
179
+ }
180
+
181
+ .form-group input,
182
+ .form-group select {
183
+ padding: 8px 12px;
184
+ border: 1px solid #d0d7de;
185
+ border-radius: 6px;
186
+ font-size: 14px;
187
+ }
188
+
189
+ .modal-actions {
190
+ display: flex;
191
+ justify-content: flex-end;
192
+ gap: 10px;
193
+ margin-top: 10px;
194
+ }
195
+
196
+ .btn {
197
+ padding: 8px 16px;
198
+ border-radius: 6px;
199
+ font-size: 13px;
200
+ font-weight: 500;
201
+ cursor: pointer;
202
+ border: 1px solid transparent;
203
+ }
204
+
205
+ .btn-primary { background: #1f883d; color: #fff; }
206
+ .btn-secondary { background: #f6f8fa; border-color: #d0d7de; color: #24292f; }
207
+ </style>
@@ -0,0 +1,64 @@
1
+ <script setup>
2
+ defineProps({
3
+ totalDepartments: {
4
+ type: Number,
5
+ default: 0
6
+ },
7
+ totalEmployees: {
8
+ type: Number,
9
+ default: 0
10
+ },
11
+ totalPayroll: {
12
+ type: Number,
13
+ default: 0
14
+ }
15
+ })
16
+ </script>
17
+
18
+ <template>
19
+ <div class="stats-grid">
20
+ <div class="stat-card">
21
+ <h3>Total Departments</h3>
22
+ <p class="stat-value">{{ totalDepartments }}</p>
23
+ </div>
24
+ <div class="stat-card">
25
+ <h3>Total Employees</h3>
26
+ <p class="stat-value">{{ totalEmployees }}</p>
27
+ </div>
28
+ <div class="stat-card">
29
+ <h3>Total Payroll</h3>
30
+ <p class="stat-value">${{ Number(totalPayroll).toLocaleString() }}</p>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <style scoped>
36
+ .stats-grid {
37
+ display: grid;
38
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
39
+ gap: 16px;
40
+ margin-bottom: 24px;
41
+ }
42
+
43
+ .stat-card {
44
+ background: #ffffff;
45
+ border: 1px solid #e1e4e8;
46
+ border-radius: 8px;
47
+ padding: 16px;
48
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
49
+ }
50
+
51
+ .stat-card h3 {
52
+ font-size: 13px;
53
+ text-transform: uppercase;
54
+ color: #666666;
55
+ margin-bottom: 6px;
56
+ letter-spacing: 0.5px;
57
+ }
58
+
59
+ .stat-value {
60
+ font-size: 24px;
61
+ font-weight: 700;
62
+ color: #0969da;
63
+ }
64
+ </style>
@@ -0,0 +1,195 @@
1
+ <script setup>
2
+ defineProps({
3
+ departments: {
4
+ type: Array,
5
+ default: () => []
6
+ },
7
+ employees: {
8
+ type: Array,
9
+ default: () => []
10
+ }
11
+ })
12
+
13
+ const emit = defineEmits([
14
+ 'create-department',
15
+ 'create-employee',
16
+ 'patch-department',
17
+ 'delete-department',
18
+ 'patch-employee',
19
+ 'delete-employee'
20
+ ])
21
+
22
+ function getDepartmentName(deptId, deptList) {
23
+ const dept = deptList.find(d => d.id === deptId)
24
+ return dept ? dept.name : (deptId ? 'Dept #' + deptId : 'N/A')
25
+ }
26
+ </script>
27
+
28
+ <template>
29
+ <div class="main-grid">
30
+ <section class="card">
31
+ <div class="card-header">
32
+ <h2>Departments</h2>
33
+ <button type="button" class="btn btn-sm btn-primary" @click="emit('create-department')">Add Department</button>
34
+ </div>
35
+
36
+ <div class="table-wrapper">
37
+ <table>
38
+ <thead>
39
+ <tr>
40
+ <th>ID</th>
41
+ <th>Name</th>
42
+ <th>Code</th>
43
+ <th>Action</th>
44
+ </tr>
45
+ </thead>
46
+ <tbody>
47
+ <tr v-if="departments.length === 0">
48
+ <td colspan="4" class="empty">No departments found</td>
49
+ </tr>
50
+ <tr v-for="dept in departments" :key="dept.id">
51
+ <td>{{ dept.id }}</td>
52
+ <td>{{ dept.name }}</td>
53
+ <td><code>{{ dept.code }}</code></td>
54
+ <td class="action-cell">
55
+ <button type="button" @click="emit('patch-department', dept)" class="btn btn-sm btn-patch">Patch</button>
56
+ <button type="button" @click="emit('delete-department', dept.id)" class="btn btn-sm btn-danger">Delete</button>
57
+ </td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+ </div>
62
+ </section>
63
+
64
+ <section class="card">
65
+ <div class="card-header">
66
+ <h2>Employees</h2>
67
+ <button type="button" class="btn btn-sm btn-primary" @click="emit('create-employee')">Add Employee</button>
68
+ </div>
69
+
70
+ <div class="table-wrapper">
71
+ <table>
72
+ <thead>
73
+ <tr>
74
+ <th>ID</th>
75
+ <th>Name</th>
76
+ <th>Email</th>
77
+ <th>Dept</th>
78
+ <th>Salary</th>
79
+ <th>Action</th>
80
+ </tr>
81
+ </thead>
82
+ <tbody>
83
+ <tr v-if="employees.length === 0">
84
+ <td colspan="6" class="empty">No employees found</td>
85
+ </tr>
86
+ <tr v-for="emp in employees" :key="emp.id">
87
+ <td>{{ emp.id }}</td>
88
+ <td>{{ emp.name }}</td>
89
+ <td>{{ emp.email }}</td>
90
+ <td>{{ getDepartmentName(emp.departmentId, departments) }}</td>
91
+ <td>${{ Number(emp.salary).toLocaleString() }}</td>
92
+ <td class="action-cell">
93
+ <button type="button" @click="emit('patch-employee', emp)" class="btn btn-sm btn-patch">Patch</button>
94
+ <button type="button" @click="emit('delete-employee', emp.id)" class="btn btn-sm btn-danger">Delete</button>
95
+ </td>
96
+ </tr>
97
+ </tbody>
98
+ </table>
99
+ </div>
100
+ </section>
101
+ </div>
102
+ </template>
103
+
104
+ <style scoped>
105
+ .main-grid {
106
+ display: grid;
107
+ grid-template-columns: 1fr;
108
+ gap: 24px;
109
+ }
110
+
111
+ @media (min-width: 900px) {
112
+ .main-grid {
113
+ grid-template-columns: 1fr 1fr;
114
+ }
115
+ }
116
+
117
+ .card {
118
+ background: #ffffff;
119
+ border: 1px solid #e1e4e8;
120
+ border-radius: 8px;
121
+ padding: 20px;
122
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
123
+ }
124
+
125
+ .card-header {
126
+ display: flex;
127
+ justify-content: space-between;
128
+ align-items: center;
129
+ border-bottom: 1px solid #eaecef;
130
+ padding-bottom: 10px;
131
+ margin-bottom: 16px;
132
+ }
133
+
134
+ .card-header h2 {
135
+ font-size: 18px;
136
+ color: #24292f;
137
+ margin: 0;
138
+ }
139
+
140
+ .table-wrapper {
141
+ overflow-x: auto;
142
+ }
143
+
144
+ table {
145
+ width: 100%;
146
+ border-collapse: collapse;
147
+ font-size: 13px;
148
+ }
149
+
150
+ th, td {
151
+ padding: 8px 10px;
152
+ border-bottom: 1px solid #e1e4e8;
153
+ text-align: left;
154
+ }
155
+
156
+ th {
157
+ background-color: #f6f8fa;
158
+ font-weight: 600;
159
+ color: #57606a;
160
+ }
161
+
162
+ code {
163
+ background: #eff1f3;
164
+ padding: 2px 5px;
165
+ border-radius: 4px;
166
+ }
167
+
168
+ .action-cell {
169
+ display: flex;
170
+ gap: 6px;
171
+ }
172
+
173
+ .empty {
174
+ text-align: center;
175
+ color: #8c959f;
176
+ padding: 20px;
177
+ }
178
+
179
+ .btn {
180
+ padding: 6px 12px;
181
+ border-radius: 6px;
182
+ cursor: pointer;
183
+ border: 1px solid transparent;
184
+ font-weight: 500;
185
+ }
186
+
187
+ .btn-sm {
188
+ padding: 4px 8px;
189
+ font-size: 12px;
190
+ }
191
+
192
+ .btn-primary { background: #1f883d; color: #fff; }
193
+ .btn-patch { background: #8250df; color: #fff; }
194
+ .btn-danger { background: #cf222e; color: #fff; }
195
+ </style>
@@ -1,90 +1,41 @@
1
- <script setup>
2
- </script>
3
-
4
- <template>
5
- <div class="app-layout">
6
- <header class="app-header">
7
- <div class="brand">
8
- <h1>Company Portal</h1>
9
- </div>
10
- <nav class="nav-links">
11
- <router-link to="/" class="nav-item">Dashboard</router-link>
12
- <router-link to="/departments" class="nav-item">Departments</router-link>
13
- <router-link to="/employees" class="nav-item">Employees</router-link>
14
- <router-link to="/add-employee" class="nav-item">Add Employee</router-link>
15
- </nav>
16
- </header>
17
-
18
- <main class="main-content">
19
- <router-view />
20
- </main>
21
- </div>
22
- </template>
23
-
24
- <style>
25
- * {
26
- box-sizing: border-box;
27
- }
28
-
29
- body {
30
- margin: 0;
31
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
32
- background-color: #f4f6f8;
33
- color: #333333;
34
- }
35
- </style>
36
-
37
- <style scoped>
38
- .app-layout {
39
- min-height: 100vh;
40
- display: flex;
41
- flex-direction: column;
42
- }
43
-
44
- .app-header {
45
- background-color: #2c3e50;
46
- color: #ffffff;
47
- padding: 0 24px;
48
- display: flex;
49
- justify-content: space-between;
50
- align-items: center;
51
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
52
- }
53
-
54
- .brand h1 {
55
- font-size: 20px;
56
- margin: 16px 0;
57
- }
58
-
59
- .nav-links {
60
- display: flex;
61
- gap: 8px;
62
- }
63
-
64
- .nav-item {
65
- color: #ecf0f1;
66
- text-decoration: none;
67
- padding: 8px 14px;
68
- border-radius: 4px;
69
- font-size: 14px;
70
- font-weight: 500;
71
- transition: background-color 0.2s;
72
- }
73
-
74
- .nav-item:hover {
75
- background-color: #34495e;
76
- }
77
-
78
- .nav-item.router-link-exact-active {
79
- background-color: #1abc9c;
80
- color: #ffffff;
81
- }
82
-
83
- .main-content {
84
- flex: 1;
85
- max-width: 1000px;
86
- width: 100%;
87
- margin: 24px auto;
88
- padding: 0 20px;
89
- }
90
- </style>
1
+ <script setup>
2
+ import NavBar from './components/NavBar.vue'
3
+ </script>
4
+
5
+ <template>
6
+ <div class="app-layout">
7
+ <NavBar />
8
+ <main class="main-content">
9
+ <router-view />
10
+ </main>
11
+ </div>
12
+ </template>
13
+
14
+ <style>
15
+ * {
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ body {
20
+ margin: 0;
21
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
22
+ background-color: #f4f6f8;
23
+ color: #333333;
24
+ }
25
+ </style>
26
+
27
+ <style scoped>
28
+ .app-layout {
29
+ min-height: 100vh;
30
+ display: flex;
31
+ flex-direction: column;
32
+ }
33
+
34
+ .main-content {
35
+ flex: 1;
36
+ max-width: 1000px;
37
+ width: 100%;
38
+ margin: 24px auto;
39
+ padding: 0 20px;
40
+ }
41
+ </style>