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
|
@@ -2,61 +2,56 @@ import { defineStore } from 'pinia'
|
|
|
2
2
|
|
|
3
3
|
export const useMemoryStore = defineStore('memory', {
|
|
4
4
|
state: () => ({
|
|
5
|
-
symbols: ['
|
|
5
|
+
symbols: ['A', 'B', 'C', 'D', 'E', 'F'],
|
|
6
6
|
cards: [],
|
|
7
|
-
|
|
7
|
+
selectedIndices: [],
|
|
8
8
|
moves: 0,
|
|
9
|
-
|
|
10
|
-
isLocked: false
|
|
9
|
+
matchedCount: 0
|
|
11
10
|
}),
|
|
12
11
|
getters: {
|
|
13
|
-
|
|
12
|
+
isGameWon: (state) => state.matchedCount === state.symbols.length
|
|
14
13
|
},
|
|
15
14
|
actions: {
|
|
16
15
|
initGame() {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.flippedCards = []
|
|
16
|
+
const deck = [...this.symbols, ...this.symbols]
|
|
17
|
+
.sort(() => Math.random() - 0.5)
|
|
18
|
+
.map((sym, id) => ({
|
|
19
|
+
id,
|
|
20
|
+
symbol: sym,
|
|
21
|
+
flipped: false,
|
|
22
|
+
matched: false
|
|
23
|
+
}))
|
|
24
|
+
this.cards = deck
|
|
25
|
+
this.selectedIndices = []
|
|
28
26
|
this.moves = 0
|
|
29
|
-
this.
|
|
30
|
-
this.isLocked = false
|
|
27
|
+
this.matchedCount = 0
|
|
31
28
|
},
|
|
29
|
+
flipCard(index) {
|
|
30
|
+
const card = this.cards[index]
|
|
31
|
+
if (card.flipped || card.matched || this.selectedIndices.length === 2) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
card.isFlipped = true
|
|
37
|
-
this.flippedCards.push(card)
|
|
35
|
+
card.flipped = true
|
|
36
|
+
this.selectedIndices.push(index)
|
|
38
37
|
|
|
39
|
-
if (this.
|
|
38
|
+
if (this.selectedIndices.length === 2) {
|
|
40
39
|
this.moves++
|
|
41
40
|
this.checkMatch()
|
|
42
41
|
}
|
|
43
42
|
},
|
|
44
|
-
|
|
45
43
|
checkMatch() {
|
|
46
|
-
const [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.flippedCards = []
|
|
44
|
+
const [first, second] = this.selectedIndices
|
|
45
|
+
if (this.cards[first].symbol === this.cards[second].symbol) {
|
|
46
|
+
this.cards[first].matched = true
|
|
47
|
+
this.cards[second].matched = true
|
|
48
|
+
this.matchedCount++
|
|
49
|
+
this.selectedIndices = []
|
|
53
50
|
} else {
|
|
54
|
-
this.isLocked = true
|
|
55
51
|
setTimeout(() => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.
|
|
59
|
-
this.isLocked = false
|
|
52
|
+
this.cards[first].flipped = false
|
|
53
|
+
this.cards[second].flipped = false
|
|
54
|
+
this.selectedIndices = []
|
|
60
55
|
}, 800)
|
|
61
56
|
}
|
|
62
57
|
}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
2
|
+
import NavBar from './components/NavBar.vue'
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<template>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</nav>
|
|
6
|
+
<div class="app-shell">
|
|
7
|
+
<NavBar />
|
|
8
|
+
<main class="main-body">
|
|
9
|
+
<router-view />
|
|
10
|
+
</main>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<style>
|
|
15
|
+
* { box-sizing: border-box; }
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
19
|
+
background-color: #f8fafc;
|
|
20
|
+
color: #334155;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
<style scoped>
|
|
25
|
+
.app-shell {
|
|
26
|
+
max-width: 800px;
|
|
27
|
+
margin: 30px auto;
|
|
28
|
+
padding: 0 16px;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<div class="about-card">
|
|
6
|
+
<h3>Routing Overview</h3>
|
|
7
|
+
<p>This module demonstrates declarative nested route views using <code>vue-router</code>. Items can be navigated, viewed by ID, edited, and patched.</p>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<style scoped>
|
|
12
|
+
.about-card {
|
|
13
|
+
background: #f8fafc;
|
|
14
|
+
border: 1px dashed #cbd5e1;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
padding: 14px 16px;
|
|
17
|
+
margin-top: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.about-card h3 {
|
|
21
|
+
font-size: 14px;
|
|
22
|
+
margin-bottom: 4px;
|
|
23
|
+
color: #334155;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.about-card p {
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
color: #64748b;
|
|
29
|
+
margin: 0;
|
|
30
|
+
line-height: 1.5;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
code {
|
|
34
|
+
background: #e2e8f0;
|
|
35
|
+
padding: 2px 4px;
|
|
36
|
+
border-radius: 3px;
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
totalItems: { type: Number, default: 0 },
|
|
4
|
+
totalValue: { type: Number, default: 0 }
|
|
5
|
+
})
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<div class="hero-card">
|
|
10
|
+
<div class="hero-text">
|
|
11
|
+
<h2>Item Inventory Manager</h2>
|
|
12
|
+
<p>Clean Vue 3 Client Routing Architecture with Child Views</p>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="hero-stats">
|
|
15
|
+
<div class="stat">
|
|
16
|
+
<span class="label">Total Items</span>
|
|
17
|
+
<strong>{{ totalItems }}</strong>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="stat">
|
|
20
|
+
<span class="label">Total Inventory Value</span>
|
|
21
|
+
<strong>${{ Number(totalValue).toFixed(2) }}</strong>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style scoped>
|
|
28
|
+
.hero-card {
|
|
29
|
+
background: #ffffff;
|
|
30
|
+
border: 1px solid #e2e8f0;
|
|
31
|
+
border-radius: 8px;
|
|
32
|
+
padding: 20px;
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
margin-bottom: 20px;
|
|
37
|
+
flex-wrap: wrap;
|
|
38
|
+
gap: 16px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.hero-text h2 {
|
|
42
|
+
font-size: 20px;
|
|
43
|
+
color: #0f172a;
|
|
44
|
+
margin-bottom: 4px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.hero-text p {
|
|
48
|
+
color: #64748b;
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.hero-stats {
|
|
54
|
+
display: flex;
|
|
55
|
+
gap: 20px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.stat {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
gap: 2px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.label {
|
|
65
|
+
font-size: 11px;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
color: #64748b;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.stat strong {
|
|
72
|
+
font-size: 20px;
|
|
73
|
+
color: #0284c7;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
</script>
|
|
3
|
+
|
|
4
|
+
<template>
|
|
5
|
+
<header class="navbar">
|
|
6
|
+
<div class="brand">
|
|
7
|
+
<h2>Vue Router App</h2>
|
|
8
|
+
</div>
|
|
9
|
+
<nav class="nav-links">
|
|
10
|
+
<router-link to="/items" class="nav-link" exact-active-class="active">All Items</router-link>
|
|
11
|
+
<router-link to="/items/add" class="nav-link" active-class="active">Add New Item</router-link>
|
|
12
|
+
</nav>
|
|
13
|
+
</header>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<style scoped>
|
|
17
|
+
.navbar {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
align-items: center;
|
|
21
|
+
background: #1e293b;
|
|
22
|
+
color: #fff;
|
|
23
|
+
padding: 12px 20px;
|
|
24
|
+
border-radius: 8px;
|
|
25
|
+
margin-bottom: 20px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.brand h2 {
|
|
29
|
+
font-size: 18px;
|
|
30
|
+
margin: 0;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.nav-links {
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 12px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.nav-link {
|
|
39
|
+
color: #cbd5e1;
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
padding: 6px 12px;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
font-size: 14px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.nav-link:hover {
|
|
47
|
+
background: #334155;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.nav-link.active {
|
|
51
|
+
background: #0284c7;
|
|
52
|
+
color: #fff;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { items } from '../data/items'
|
|
4
|
+
import HomeHero from '../components/HomeHero.vue'
|
|
5
|
+
import AboutCard from '../components/AboutCard.vue'
|
|
6
|
+
|
|
7
|
+
const totalItems = computed(() => items.value.length)
|
|
8
|
+
const totalValue = computed(() =>
|
|
9
|
+
items.value.reduce((sum, item) => sum + Number(item.price || 0), 0)
|
|
10
|
+
)
|
|
11
|
+
</script>
|
|
12
|
+
|
|
1
13
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<router-
|
|
5
|
-
<
|
|
6
|
-
</
|
|
7
|
-
<br>
|
|
8
|
-
<hr>
|
|
9
|
-
<br>
|
|
10
|
-
<router-view></router-view>
|
|
14
|
+
<div>
|
|
15
|
+
<HomeHero :total-items="totalItems" :total-value="totalValue" />
|
|
16
|
+
<router-view />
|
|
17
|
+
<AboutCard />
|
|
18
|
+
</div>
|
|
11
19
|
</template>
|
|
@@ -5,25 +5,113 @@ import { items } from '../data/items'
|
|
|
5
5
|
function deleteItem(id) {
|
|
6
6
|
items.value = items.value.filter(item => item.id !== id)
|
|
7
7
|
}
|
|
8
|
+
|
|
9
|
+
function patchItem(item) {
|
|
10
|
+
const newPrice = prompt('Enter new price for ' + item.name + ':', item.price)
|
|
11
|
+
if (newPrice !== null && !isNaN(Number(newPrice))) {
|
|
12
|
+
item.price = Number(newPrice)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
</script>
|
|
9
16
|
|
|
10
17
|
<template>
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
<div class="list-card">
|
|
19
|
+
<div class="card-header">
|
|
20
|
+
<h3>Items List</h3>
|
|
21
|
+
<RouterLink to="/items/add" class="btn btn-primary">Add New Item</RouterLink>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<table class="items-table">
|
|
25
|
+
<thead>
|
|
26
|
+
<tr>
|
|
27
|
+
<th>Name</th>
|
|
28
|
+
<th>Description</th>
|
|
29
|
+
<th>Price</th>
|
|
30
|
+
<th>Actions</th>
|
|
31
|
+
</tr>
|
|
32
|
+
</thead>
|
|
33
|
+
<tbody>
|
|
34
|
+
<tr v-if="items.length === 0">
|
|
35
|
+
<td colspan="4" class="empty">No items available.</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr v-for="item in items" :key="item.id">
|
|
38
|
+
<td><strong>{{ item.name }}</strong></td>
|
|
39
|
+
<td>{{ item.description }}</td>
|
|
40
|
+
<td>${{ Number(item.price).toFixed(2) }}</td>
|
|
41
|
+
<td class="action-cell">
|
|
42
|
+
<RouterLink :to="'/items/' + item.id" class="btn btn-sm btn-info">View</RouterLink>
|
|
43
|
+
<button type="button" class="btn btn-sm btn-patch" @click="patchItem(item)">Patch</button>
|
|
44
|
+
<button type="button" class="btn btn-sm btn-danger" @click="deleteItem(item.id)">Delete</button>
|
|
45
|
+
</td>
|
|
46
|
+
</tr>
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
49
|
+
</div>
|
|
29
50
|
</template>
|
|
51
|
+
|
|
52
|
+
<style scoped>
|
|
53
|
+
.list-card {
|
|
54
|
+
background: #ffffff;
|
|
55
|
+
border: 1px solid #e2e8f0;
|
|
56
|
+
border-radius: 8px;
|
|
57
|
+
padding: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.card-header {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
align-items: center;
|
|
64
|
+
margin-bottom: 16px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.card-header h3 {
|
|
68
|
+
font-size: 18px;
|
|
69
|
+
margin: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.items-table {
|
|
73
|
+
width: 100%;
|
|
74
|
+
border-collapse: collapse;
|
|
75
|
+
font-size: 14px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
th, td {
|
|
79
|
+
padding: 10px;
|
|
80
|
+
border-bottom: 1px solid #f1f5f9;
|
|
81
|
+
text-align: left;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
th {
|
|
85
|
+
background: #f8fafc;
|
|
86
|
+
color: #475569;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.action-cell {
|
|
90
|
+
display: flex;
|
|
91
|
+
gap: 6px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.btn {
|
|
95
|
+
padding: 6px 12px;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
font-size: 12px;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
border: 1px solid transparent;
|
|
100
|
+
text-decoration: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.btn-sm {
|
|
104
|
+
padding: 4px 8px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.btn-primary { background: #0284c7; color: #fff; }
|
|
108
|
+
.btn-info { background: #e0f2fe; color: #0369a1; }
|
|
109
|
+
.btn-patch { background: #8250df; color: #fff; }
|
|
110
|
+
.btn-danger { background: #cf222e; color: #fff; }
|
|
111
|
+
|
|
112
|
+
.empty {
|
|
113
|
+
text-align: center;
|
|
114
|
+
color: #94a3b8;
|
|
115
|
+
padding: 20px;
|
|
116
|
+
}
|
|
117
|
+
</style>
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import
|
|
2
|
+
import NavBar from './components/NavBar.vue'
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<template>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
</nav>
|
|
6
|
+
<div class="app-shell">
|
|
7
|
+
<NavBar />
|
|
8
|
+
<main class="main-body">
|
|
9
|
+
<router-view />
|
|
10
|
+
</main>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
<style>
|
|
15
|
+
* { box-sizing: border-box; }
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
19
|
+
background-color: #f8fafc;
|
|
20
|
+
color: #334155;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
<style scoped>
|
|
25
|
+
.app-shell {
|
|
26
|
+
max-width: 800px;
|
|
27
|
+
margin: 30px auto;
|
|
28
|
+
padding: 0 16px;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { reactive, watch } from 'vue'
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
show: { type: Boolean, default: false },
|
|
6
|
+
isEdit: { type: Boolean, default: false },
|
|
7
|
+
itemData: { type: Object, default: null }
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const emit = defineEmits(['close', 'submit'])
|
|
11
|
+
|
|
12
|
+
const form = reactive({
|
|
13
|
+
id: '',
|
|
14
|
+
name: '',
|
|
15
|
+
description: '',
|
|
16
|
+
price: 0
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
watch(
|
|
20
|
+
() => props.itemData,
|
|
21
|
+
(val) => {
|
|
22
|
+
if (val) {
|
|
23
|
+
form.id = val.id
|
|
24
|
+
form.name = val.name
|
|
25
|
+
form.description = val.description
|
|
26
|
+
form.price = Number(val.price)
|
|
27
|
+
} else {
|
|
28
|
+
form.id = ''
|
|
29
|
+
form.name = ''
|
|
30
|
+
form.description = ''
|
|
31
|
+
form.price = 0
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{ immediate: true }
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
function handleSubmit() {
|
|
38
|
+
if (!form.name.trim()) return
|
|
39
|
+
emit('submit', {
|
|
40
|
+
id: form.id || String(Date.now()),
|
|
41
|
+
name: form.name.trim(),
|
|
42
|
+
description: form.description.trim(),
|
|
43
|
+
price: Number(form.price)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<div v-if="show" class="modal-overlay" @click.self="emit('close')">
|
|
50
|
+
<div class="modal-card">
|
|
51
|
+
<div class="modal-header">
|
|
52
|
+
<h3>{{ isEdit ? 'Edit Item' : 'Add New Item' }}</h3>
|
|
53
|
+
<button type="button" class="btn-close" @click="emit('close')">x</button>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<form @submit.prevent="handleSubmit" class="modal-form">
|
|
57
|
+
<div class="form-group">
|
|
58
|
+
<label for="r-name">Name</label>
|
|
59
|
+
<input id="r-name" v-model="form.name" required placeholder="Item Name" />
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<div class="form-group">
|
|
63
|
+
<label for="r-desc">Description</label>
|
|
64
|
+
<input id="r-desc" v-model="form.description" required placeholder="Item Description" />
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
<div class="form-group">
|
|
68
|
+
<label for="r-price">Price ($)</label>
|
|
69
|
+
<input id="r-price" v-model.number="form.price" type="number" step="any" min="0" required />
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="modal-actions">
|
|
73
|
+
<button type="button" class="btn btn-secondary" @click="emit('close')">Cancel</button>
|
|
74
|
+
<button type="submit" class="btn btn-primary">{{ isEdit ? 'Save Changes' : 'Create' }}</button>
|
|
75
|
+
</div>
|
|
76
|
+
</form>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<style scoped>
|
|
82
|
+
.modal-overlay {
|
|
83
|
+
position: fixed;
|
|
84
|
+
inset: 0;
|
|
85
|
+
background: rgba(0, 0, 0, 0.4);
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
z-index: 1000;
|
|
90
|
+
padding: 16px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.modal-card {
|
|
94
|
+
background: #ffffff;
|
|
95
|
+
border-radius: 8px;
|
|
96
|
+
width: 100%;
|
|
97
|
+
max-width: 440px;
|
|
98
|
+
box-shadow: 0 8px 24px rgba(0,0,0,0.15);
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.modal-header {
|
|
103
|
+
padding: 16px 20px;
|
|
104
|
+
border-bottom: 1px solid #e1e4e8;
|
|
105
|
+
display: flex;
|
|
106
|
+
justify-content: space-between;
|
|
107
|
+
align-items: center;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.modal-header h3 {
|
|
111
|
+
font-size: 16px;
|
|
112
|
+
margin: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.btn-close {
|
|
116
|
+
background: none;
|
|
117
|
+
border: none;
|
|
118
|
+
font-size: 16px;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.modal-form {
|
|
123
|
+
padding: 20px;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 12px;
|
|
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
|
+
}
|
|
139
|
+
|
|
140
|
+
.form-group input {
|
|
141
|
+
padding: 8px 12px;
|
|
142
|
+
border: 1px solid #cbd5e1;
|
|
143
|
+
border-radius: 6px;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.modal-actions {
|
|
147
|
+
display: flex;
|
|
148
|
+
justify-content: flex-end;
|
|
149
|
+
gap: 10px;
|
|
150
|
+
margin-top: 8px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.btn {
|
|
154
|
+
padding: 8px 14px;
|
|
155
|
+
border-radius: 6px;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
border: 1px solid transparent;
|
|
158
|
+
font-size: 13px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.btn-primary { background: #0284c7; color: #fff; }
|
|
162
|
+
.btn-secondary { background: #f1f5f9; color: #475569; }
|
|
163
|
+
</style>
|