wad-lab 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +477 -627
- 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
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
show: {
|
|
6
|
+
type: Boolean,
|
|
7
|
+
default: false
|
|
8
|
+
},
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'Patch Record'
|
|
12
|
+
},
|
|
13
|
+
fieldLabel: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: 'New Value'
|
|
16
|
+
},
|
|
17
|
+
initialValue: {
|
|
18
|
+
type: [String, Number],
|
|
19
|
+
default: ''
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const emit = defineEmits(['close', 'submit'])
|
|
24
|
+
|
|
25
|
+
const val = ref('')
|
|
26
|
+
|
|
27
|
+
watch(
|
|
28
|
+
() => props.show,
|
|
29
|
+
(open) => {
|
|
30
|
+
if (open) val.value = props.initialValue
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
function handleSubmit() {
|
|
35
|
+
emit('submit', val.value)
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<div v-if="show" class="modal-overlay" @click.self="emit('close')">
|
|
41
|
+
<div class="modal-card">
|
|
42
|
+
<div class="modal-header">
|
|
43
|
+
<h3>{{ title }}</h3>
|
|
44
|
+
<button type="button" class="btn-close" @click="emit('close')">x</button>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<form @submit.prevent="handleSubmit" class="modal-form">
|
|
48
|
+
<div class="form-group">
|
|
49
|
+
<label>{{ fieldLabel }}</label>
|
|
50
|
+
<input v-model="val" required />
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="modal-actions">
|
|
54
|
+
<button type="button" class="btn btn-secondary" @click="emit('close')">Cancel</button>
|
|
55
|
+
<button type="submit" class="btn btn-primary">Apply Patch</button>
|
|
56
|
+
</div>
|
|
57
|
+
</form>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<style scoped>
|
|
63
|
+
.modal-overlay {
|
|
64
|
+
position: fixed;
|
|
65
|
+
inset: 0;
|
|
66
|
+
background: rgba(0, 0, 0, 0.4);
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
justify-content: center;
|
|
70
|
+
z-index: 1000;
|
|
71
|
+
padding: 16px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.modal-card {
|
|
75
|
+
background: #ffffff;
|
|
76
|
+
border-radius: 8px;
|
|
77
|
+
width: 100%;
|
|
78
|
+
max-width: 400px;
|
|
79
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.modal-header {
|
|
84
|
+
padding: 16px 20px;
|
|
85
|
+
border-bottom: 1px solid #e1e4e8;
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: space-between;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.modal-header h3 {
|
|
92
|
+
font-size: 15px;
|
|
93
|
+
margin: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.btn-close {
|
|
97
|
+
background: none;
|
|
98
|
+
border: none;
|
|
99
|
+
font-size: 16px;
|
|
100
|
+
cursor: pointer;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.modal-form {
|
|
104
|
+
padding: 20px;
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: 12px;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.form-group {
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
gap: 4px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.form-group label {
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.form-group input {
|
|
122
|
+
padding: 8px 12px;
|
|
123
|
+
border: 1px solid #d0d7de;
|
|
124
|
+
border-radius: 6px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.modal-actions {
|
|
128
|
+
display: flex;
|
|
129
|
+
justify-content: flex-end;
|
|
130
|
+
gap: 10px;
|
|
131
|
+
margin-top: 8px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.btn {
|
|
135
|
+
padding: 8px 14px;
|
|
136
|
+
border-radius: 6px;
|
|
137
|
+
cursor: pointer;
|
|
138
|
+
border: 1px solid transparent;
|
|
139
|
+
font-size: 13px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.btn-primary { background: #8250df; color: #fff; }
|
|
143
|
+
.btn-secondary { background: #f6f8fa; border-color: #d0d7de; color: #24292f; }
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
columns: {
|
|
4
|
+
type: Array,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
items: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
loading: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const emit = defineEmits(['patch', 'delete'])
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div class="table-container">
|
|
22
|
+
<div v-if="loading" class="loading-state">Loading table data...</div>
|
|
23
|
+
<table v-else class="data-table">
|
|
24
|
+
<thead>
|
|
25
|
+
<tr>
|
|
26
|
+
<th v-for="col in columns" :key="col.key">{{ col.label }}</th>
|
|
27
|
+
<th>Actions</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
<tr v-if="items.length === 0">
|
|
32
|
+
<td :colspan="columns.length + 1" class="empty">No records found.</td>
|
|
33
|
+
</tr>
|
|
34
|
+
<tr v-for="row in items" :key="row.id">
|
|
35
|
+
<td v-for="col in columns" :key="col.key">
|
|
36
|
+
{{ col.format ? col.format(row[col.key], row) : row[col.key] }}
|
|
37
|
+
</td>
|
|
38
|
+
<td class="action-cell">
|
|
39
|
+
<button type="button" class="btn btn-sm btn-patch" @click="emit('patch', row)">Patch</button>
|
|
40
|
+
<button type="button" class="btn btn-sm btn-danger" @click="emit('delete', row.id)">Delete</button>
|
|
41
|
+
</td>
|
|
42
|
+
</tr>
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<style scoped>
|
|
49
|
+
.table-container {
|
|
50
|
+
overflow-x: auto;
|
|
51
|
+
background: #ffffff;
|
|
52
|
+
border: 1px solid #e1e4e8;
|
|
53
|
+
border-radius: 8px;
|
|
54
|
+
padding: 16px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.data-table {
|
|
58
|
+
width: 100%;
|
|
59
|
+
border-collapse: collapse;
|
|
60
|
+
font-size: 14px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
th, td {
|
|
64
|
+
padding: 10px 12px;
|
|
65
|
+
border-bottom: 1px solid #e1e4e8;
|
|
66
|
+
text-align: left;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
th {
|
|
70
|
+
background-color: #f8fafc;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
color: #475569;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.action-cell {
|
|
76
|
+
display: flex;
|
|
77
|
+
gap: 6px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.empty {
|
|
81
|
+
text-align: center;
|
|
82
|
+
color: #94a3b8;
|
|
83
|
+
padding: 24px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.loading-state {
|
|
87
|
+
padding: 16px;
|
|
88
|
+
text-align: center;
|
|
89
|
+
color: #64748b;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.btn {
|
|
93
|
+
padding: 4px 8px;
|
|
94
|
+
border-radius: 4px;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
border: 1px solid transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.btn-patch { background: #8250df; color: #fff; }
|
|
101
|
+
.btn-danger { background: #cf222e; color: #fff; }
|
|
102
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<header class="app-header">
|
|
6
|
+
<div class="brand">
|
|
7
|
+
<h1>Company Portal (Pinia)</h1>
|
|
8
|
+
</div>
|
|
9
|
+
<nav class="nav-links">
|
|
10
|
+
<router-link to="/" class="nav-item">Dashboard</router-link>
|
|
11
|
+
<router-link to="/departments" class="nav-item">Departments</router-link>
|
|
12
|
+
<router-link to="/employees" class="nav-item">Employees</router-link>
|
|
13
|
+
</nav>
|
|
14
|
+
</header>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<style scoped>
|
|
18
|
+
.app-header {
|
|
19
|
+
background-color: #1e293b;
|
|
20
|
+
color: #ffffff;
|
|
21
|
+
padding: 0 24px;
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.brand h1 {
|
|
28
|
+
font-size: 18px;
|
|
29
|
+
margin: 16px 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.nav-links {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: 10px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.nav-item {
|
|
38
|
+
color: #cbd5e1;
|
|
39
|
+
text-decoration: none;
|
|
40
|
+
padding: 8px 12px;
|
|
41
|
+
border-radius: 4px;
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.nav-item:hover {
|
|
46
|
+
background-color: #334155;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.nav-item.router-link-exact-active {
|
|
50
|
+
background-color: #0284c7;
|
|
51
|
+
color: #ffffff;
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -1,229 +1,107 @@
|
|
|
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
|
-
background: #ffffff;
|
|
109
|
-
border: 1px solid #e1e4e8;
|
|
110
|
-
border-radius: 8px;
|
|
111
|
-
padding: 20px;
|
|
112
|
-
margin-bottom: 24px;
|
|
113
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.card h3 {
|
|
117
|
-
font-size: 16px;
|
|
118
|
-
margin-bottom: 16px;
|
|
119
|
-
color: #333333;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.form {
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
gap: 12px;
|
|
126
|
-
max-width: 400px;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.form-group {
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-direction: column;
|
|
132
|
-
gap: 4px;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.form-group label {
|
|
136
|
-
font-size: 13px;
|
|
137
|
-
font-weight: 600;
|
|
138
|
-
color: #444444;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.form-group input {
|
|
142
|
-
padding: 8px 10px;
|
|
143
|
-
border: 1px solid #cccccc;
|
|
144
|
-
border-radius: 4px;
|
|
145
|
-
font-size: 14px;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.form-group input:focus {
|
|
149
|
-
outline: none;
|
|
150
|
-
border-color: #0066cc;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.btn {
|
|
154
|
-
padding: 8px 14px;
|
|
155
|
-
border: none;
|
|
156
|
-
border-radius: 4px;
|
|
157
|
-
cursor: pointer;
|
|
158
|
-
font-size: 13px;
|
|
159
|
-
font-weight: 600;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.btn-primary {
|
|
163
|
-
background-color: #0066cc;
|
|
164
|
-
color: #ffffff;
|
|
165
|
-
align-self: flex-start;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.btn-primary:hover {
|
|
169
|
-
background-color: #0052a3;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.btn-danger {
|
|
173
|
-
background-color: #d9383a;
|
|
174
|
-
color: #ffffff;
|
|
175
|
-
padding: 4px 8px;
|
|
176
|
-
font-size: 12px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.btn-danger:hover {
|
|
180
|
-
background-color: #b8282a;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.btn-warning {
|
|
184
|
-
background-color: #f0ad4e;
|
|
185
|
-
color: #ffffff;
|
|
186
|
-
padding: 4px 8px;
|
|
187
|
-
font-size: 12px;
|
|
188
|
-
margin-right: 6px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
.btn-warning:hover {
|
|
192
|
-
background-color: #ec971f;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.table-wrapper {
|
|
196
|
-
overflow-x: auto;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
table {
|
|
200
|
-
width: 100%;
|
|
201
|
-
border-collapse: collapse;
|
|
202
|
-
font-size: 13px;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
th, td {
|
|
206
|
-
text-align: left;
|
|
207
|
-
padding: 8px 10px;
|
|
208
|
-
border-bottom: 1px solid #eeeeee;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
th {
|
|
212
|
-
background-color: #fafbfc;
|
|
213
|
-
color: #555555;
|
|
214
|
-
font-weight: 600;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
code {
|
|
218
|
-
background: #f0f0f0;
|
|
219
|
-
padding: 2px 4px;
|
|
220
|
-
border-radius: 3px;
|
|
221
|
-
font-size: 12px;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.empty {
|
|
225
|
-
text-align: center;
|
|
226
|
-
color: #888888;
|
|
227
|
-
padding: 16px;
|
|
228
|
-
}
|
|
229
|
-
</style>
|
|
1
|
+
<script setup>
|
|
2
|
+
import { ref, onMounted } from 'vue'
|
|
3
|
+
import { useCompanyStore } from '../stores/companyStore'
|
|
4
|
+
import ItemTable from '../components/ItemTable.vue'
|
|
5
|
+
import ItemFormModal from '../components/ItemFormModal.vue'
|
|
6
|
+
import ItemPatchModal from '../components/ItemPatchModal.vue'
|
|
7
|
+
|
|
8
|
+
const store = useCompanyStore()
|
|
9
|
+
const isFormModalOpen = ref(false)
|
|
10
|
+
const isPatchModalOpen = ref(false)
|
|
11
|
+
const selectedDept = ref(null)
|
|
12
|
+
|
|
13
|
+
const columns = [
|
|
14
|
+
{ key: 'id', label: 'ID' },
|
|
15
|
+
{ key: 'name', label: 'Department Name' },
|
|
16
|
+
{ key: 'code', label: 'Code' }
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
const formFields = [
|
|
20
|
+
{ key: 'name', label: 'Department Name', required: true, placeholder: 'e.g. Sales' },
|
|
21
|
+
{ key: 'code', label: 'Department Code', required: true, placeholder: 'e.g. SLS' }
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
async function handleCreate(data) {
|
|
25
|
+
await store.createDepartment(data)
|
|
26
|
+
isFormModalOpen.value = false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function handleOpenPatch(dept) {
|
|
30
|
+
selectedDept.value = dept
|
|
31
|
+
isPatchModalOpen.value = true
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function handleApplyPatch(newCode) {
|
|
35
|
+
if (selectedDept.value && newCode) {
|
|
36
|
+
await store.patchDepartment(selectedDept.value.id, { code: newCode })
|
|
37
|
+
}
|
|
38
|
+
isPatchModalOpen.value = false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function handleDelete(id) {
|
|
42
|
+
if (confirm('Delete this department?')) {
|
|
43
|
+
await store.deleteDepartment(id)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
store.fetchDepartments()
|
|
49
|
+
})
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div class="view-container">
|
|
54
|
+
<div class="view-header">
|
|
55
|
+
<h2>Department Management (Pinia)</h2>
|
|
56
|
+
<button type="button" class="btn btn-primary" @click="isFormModalOpen = true">Add Department</button>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<ItemTable
|
|
60
|
+
:columns="columns"
|
|
61
|
+
:items="store.departments"
|
|
62
|
+
:loading="store.loading"
|
|
63
|
+
@patch="handleOpenPatch"
|
|
64
|
+
@delete="handleDelete"
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
<ItemFormModal
|
|
68
|
+
:show="isFormModalOpen"
|
|
69
|
+
title="Create Department"
|
|
70
|
+
:fields="formFields"
|
|
71
|
+
@close="isFormModalOpen = false"
|
|
72
|
+
@submit="handleCreate"
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
<ItemPatchModal
|
|
76
|
+
:show="isPatchModalOpen"
|
|
77
|
+
title="Patch Department Code"
|
|
78
|
+
field-label="New Department Code"
|
|
79
|
+
:initial-value="selectedDept ? selectedDept.code : ''"
|
|
80
|
+
@close="isPatchModalOpen = false"
|
|
81
|
+
@submit="handleApplyPatch"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<style scoped>
|
|
87
|
+
.view-container {
|
|
88
|
+
display: flex;
|
|
89
|
+
flex-direction: column;
|
|
90
|
+
gap: 16px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.view-header {
|
|
94
|
+
display: flex;
|
|
95
|
+
justify-content: space-between;
|
|
96
|
+
align-items: center;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.btn-primary {
|
|
100
|
+
background: #0284c7;
|
|
101
|
+
color: #fff;
|
|
102
|
+
border: none;
|
|
103
|
+
padding: 8px 14px;
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
cursor: pointer;
|
|
106
|
+
}
|
|
107
|
+
</style>
|