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
|
@@ -7,14 +7,14 @@ export const useBankStore = defineStore('bank', {
|
|
|
7
7
|
accountType: 'Savings Account',
|
|
8
8
|
balance: 5000,
|
|
9
9
|
transactions: [
|
|
10
|
-
{ id: 1, type: 'DEPOSIT', amount: 5000, balanceAfter: 5000, date: new Date().toLocaleDateString() }
|
|
10
|
+
{ id: 1, type: 'DEPOSIT', amount: 5000, balanceAfter: 5000, note: 'Initial deposit', date: new Date().toLocaleDateString() }
|
|
11
11
|
]
|
|
12
12
|
}),
|
|
13
13
|
getters: {
|
|
14
14
|
transactionCount: (state) => state.transactions.length
|
|
15
15
|
},
|
|
16
16
|
actions: {
|
|
17
|
-
deposit(amount) {
|
|
17
|
+
deposit(amount, note = '') {
|
|
18
18
|
const val = parseFloat(amount)
|
|
19
19
|
if (isNaN(val) || val <= 0) return { success: false, message: 'Invalid deposit amount' }
|
|
20
20
|
|
|
@@ -24,12 +24,13 @@ export const useBankStore = defineStore('bank', {
|
|
|
24
24
|
type: 'DEPOSIT',
|
|
25
25
|
amount: val,
|
|
26
26
|
balanceAfter: this.balance,
|
|
27
|
+
note: note || 'Deposit',
|
|
27
28
|
date: new Date().toLocaleDateString()
|
|
28
29
|
})
|
|
29
30
|
return { success: true, message: 'Deposit successful!' }
|
|
30
31
|
},
|
|
31
32
|
|
|
32
|
-
withdraw(amount) {
|
|
33
|
+
withdraw(amount, note = '') {
|
|
33
34
|
const val = parseFloat(amount)
|
|
34
35
|
if (isNaN(val) || val <= 0) return { success: false, message: 'Invalid withdrawal amount' }
|
|
35
36
|
if (val > this.balance) return { success: false, message: 'Insufficient balance!' }
|
|
@@ -40,9 +41,21 @@ export const useBankStore = defineStore('bank', {
|
|
|
40
41
|
type: 'WITHDRAWAL',
|
|
41
42
|
amount: val,
|
|
42
43
|
balanceAfter: this.balance,
|
|
44
|
+
note: note || 'Withdrawal',
|
|
43
45
|
date: new Date().toLocaleDateString()
|
|
44
46
|
})
|
|
45
47
|
return { success: true, message: 'Withdrawal successful!' }
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
patchTransaction(id, partial) {
|
|
51
|
+
const item = this.transactions.find(t => t.id === id)
|
|
52
|
+
if (item) {
|
|
53
|
+
Object.assign(item, partial)
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
deleteTransaction(id) {
|
|
58
|
+
this.transactions = this.transactions.filter(t => t.id !== id)
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
})
|
|
@@ -1,88 +1,40 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { useBankStore } from '../stores/bankStore'
|
|
3
|
+
import AccountOverview from '../components/AccountOverview.vue'
|
|
4
|
+
import TransactionTable from '../components/TransactionTable.vue'
|
|
3
5
|
|
|
4
6
|
const bank = useBankStore()
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<template>
|
|
8
|
-
<div class="dashboard-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<span>Available Balance</span>
|
|
24
|
-
<h3 class="balance-val">${{ bank.balance.toFixed(2) }}</h3>
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
<div class="quick-actions">
|
|
28
|
-
<router-link to="/transaction" class="btn btn-primary">Deposit / Withdraw</router-link>
|
|
29
|
-
<router-link to="/statement" class="btn btn-secondary">View Statement ({{ bank.transactionCount }})</router-link>
|
|
10
|
+
<div class="dashboard-grid">
|
|
11
|
+
<AccountOverview
|
|
12
|
+
:account-holder="bank.accountHolder"
|
|
13
|
+
:account-number="bank.accountNumber"
|
|
14
|
+
:account-type="bank.accountType"
|
|
15
|
+
:balance="bank.balance"
|
|
16
|
+
/>
|
|
17
|
+
|
|
18
|
+
<div class="recent-tx">
|
|
19
|
+
<h3>Recent Transactions</h3>
|
|
20
|
+
<TransactionTable
|
|
21
|
+
:transactions="bank.transactions.slice(0, 5)"
|
|
22
|
+
@patch="({ id, note }) => bank.patchTransaction(id, { note })"
|
|
23
|
+
@delete="(id) => bank.deleteTransaction(id)"
|
|
24
|
+
/>
|
|
30
25
|
</div>
|
|
31
26
|
</div>
|
|
32
27
|
</template>
|
|
33
28
|
|
|
34
29
|
<style scoped>
|
|
35
|
-
.dashboard-
|
|
36
|
-
border: 1px solid #ddd;
|
|
37
|
-
border-radius: 8px;
|
|
38
|
-
padding: 20px;
|
|
39
|
-
background-color: #fafafa;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.info-row {
|
|
43
|
-
display: flex;
|
|
44
|
-
justify-content: space-between;
|
|
45
|
-
padding: 8px 0;
|
|
46
|
-
border-bottom: 1px solid #eee;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.balance-box {
|
|
50
|
-
margin: 20px 0;
|
|
51
|
-
padding: 15px;
|
|
52
|
-
background-color: #e8f8f5;
|
|
53
|
-
border: 1px solid #a3e4d7;
|
|
54
|
-
border-radius: 6px;
|
|
55
|
-
text-align: center;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.balance-val {
|
|
59
|
-
color: #16a085;
|
|
60
|
-
font-size: 28px;
|
|
61
|
-
margin: 5px 0 0 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.quick-actions {
|
|
30
|
+
.dashboard-grid {
|
|
65
31
|
display: flex;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.btn {
|
|
71
|
-
flex: 1;
|
|
72
|
-
text-align: center;
|
|
73
|
-
padding: 10px;
|
|
74
|
-
border-radius: 4px;
|
|
75
|
-
text-decoration: none;
|
|
76
|
-
font-weight: bold;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.btn-primary {
|
|
80
|
-
background-color: #2980b9;
|
|
81
|
-
color: white;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: 20px;
|
|
82
34
|
}
|
|
83
35
|
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
36
|
+
.recent-tx h3 {
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
margin-bottom: 10px;
|
|
87
39
|
}
|
|
88
40
|
</style>
|
|
@@ -1,171 +1,24 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { computed } from 'vue'
|
|
3
2
|
import { useBankStore } from '../stores/bankStore'
|
|
3
|
+
import TransactionTable from '../components/TransactionTable.vue'
|
|
4
4
|
|
|
5
5
|
const bank = useBankStore()
|
|
6
|
-
|
|
7
|
-
const totalDeposits = computed(() => {
|
|
8
|
-
return bank.transactions
|
|
9
|
-
.filter(tx => tx.type === 'DEPOSIT')
|
|
10
|
-
.reduce((sum, tx) => sum + tx.amount, 0)
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const totalWithdrawals = computed(() => {
|
|
14
|
-
return bank.transactions
|
|
15
|
-
.filter(tx => tx.type === 'WITHDRAWAL')
|
|
16
|
-
.reduce((sum, tx) => sum + tx.amount, 0)
|
|
17
|
-
})
|
|
18
6
|
</script>
|
|
19
7
|
|
|
20
8
|
<template>
|
|
21
|
-
<div class="statement-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<div class="summary-box deposits">
|
|
29
|
-
<span>Total Deposits</span>
|
|
30
|
-
<strong>${{ totalDeposits.toFixed(2) }}</strong>
|
|
31
|
-
</div>
|
|
32
|
-
<div class="summary-box withdrawals">
|
|
33
|
-
<span>Total Withdrawals</span>
|
|
34
|
-
<strong>${{ totalWithdrawals.toFixed(2) }}</strong>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="summary-box balance">
|
|
37
|
-
<span>Current Balance</span>
|
|
38
|
-
<strong>${{ bank.balance.toFixed(2) }}</strong>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="table-container">
|
|
43
|
-
<table class="statement-table" v-if="bank.transactions.length">
|
|
44
|
-
<thead>
|
|
45
|
-
<tr>
|
|
46
|
-
<th>Date</th>
|
|
47
|
-
<th>Type</th>
|
|
48
|
-
<th>Amount</th>
|
|
49
|
-
<th>Balance After</th>
|
|
50
|
-
</tr>
|
|
51
|
-
</thead>
|
|
52
|
-
<tbody>
|
|
53
|
-
<tr v-for="tx in bank.transactions" :key="tx.id">
|
|
54
|
-
<td>{{ tx.date }}</td>
|
|
55
|
-
<td :class="tx.type === 'DEPOSIT' ? 'type-deposit' : 'type-withdrawal'">{{ tx.type }}</td>
|
|
56
|
-
<td>${{ tx.amount.toFixed(2) }}</td>
|
|
57
|
-
<td>${{ tx.balanceAfter.toFixed(2) }}</td>
|
|
58
|
-
</tr>
|
|
59
|
-
</tbody>
|
|
60
|
-
</table>
|
|
61
|
-
<p v-else class="empty-state">No transactions recorded yet.</p>
|
|
62
|
-
</div>
|
|
9
|
+
<div class="statement-view">
|
|
10
|
+
<h2>Account Statement</h2>
|
|
11
|
+
<TransactionTable
|
|
12
|
+
:transactions="bank.transactions"
|
|
13
|
+
@patch="({ id, note }) => bank.patchTransaction(id, { note })"
|
|
14
|
+
@delete="(id) => bank.deleteTransaction(id)"
|
|
15
|
+
/>
|
|
63
16
|
</div>
|
|
64
17
|
</template>
|
|
65
18
|
|
|
66
19
|
<style scoped>
|
|
67
|
-
.statement-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
padding: 20px;
|
|
71
|
-
background-color: #fafafa;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.header-row {
|
|
75
|
-
display: flex;
|
|
76
|
-
justify-content: space-between;
|
|
77
|
-
align-items: center;
|
|
78
|
-
margin-bottom: 20px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.summary-cards {
|
|
82
|
-
display: grid;
|
|
83
|
-
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
|
|
84
|
-
gap: 12px;
|
|
85
|
-
margin-bottom: 20px;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.summary-box {
|
|
89
|
-
padding: 12px;
|
|
90
|
-
border-radius: 6px;
|
|
91
|
-
display: flex;
|
|
92
|
-
flex-direction: column;
|
|
93
|
-
gap: 4px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.summary-box.deposits {
|
|
97
|
-
background-color: #e8f8f5;
|
|
98
|
-
border: 1px solid #a3e4d7;
|
|
99
|
-
color: #16a085;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.summary-box.withdrawals {
|
|
103
|
-
background-color: #fdebd0;
|
|
104
|
-
border: 1px solid #f8c471;
|
|
105
|
-
color: #d35400;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.summary-box.balance {
|
|
109
|
-
background-color: #ebf5fb;
|
|
110
|
-
border: 1px solid #aed6f1;
|
|
111
|
-
color: #2980b9;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.summary-box span {
|
|
115
|
-
font-size: 13px;
|
|
116
|
-
color: #555;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.summary-box strong {
|
|
120
|
-
font-size: 18px;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.table-container {
|
|
124
|
-
overflow-x: auto;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.statement-table {
|
|
128
|
-
width: 100%;
|
|
129
|
-
border-collapse: collapse;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.statement-table th,
|
|
133
|
-
.statement-table td {
|
|
134
|
-
padding: 10px;
|
|
135
|
-
text-align: left;
|
|
136
|
-
border-bottom: 1px solid #eee;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.statement-table th {
|
|
140
|
-
background-color: #f2f2f2;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
.type-deposit {
|
|
144
|
-
color: #27ae60;
|
|
145
|
-
font-weight: bold;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.type-withdrawal {
|
|
149
|
-
color: #c0392b;
|
|
150
|
-
font-weight: bold;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.btn {
|
|
154
|
-
padding: 8px 14px;
|
|
155
|
-
border-radius: 4px;
|
|
156
|
-
text-decoration: none;
|
|
157
|
-
font-weight: bold;
|
|
158
|
-
font-size: 14px;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.btn-back {
|
|
162
|
-
background-color: #7f8c8d;
|
|
163
|
-
color: white;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.empty-state {
|
|
167
|
-
text-align: center;
|
|
168
|
-
color: #777;
|
|
169
|
-
padding: 20px;
|
|
20
|
+
.statement-view h2 {
|
|
21
|
+
font-size: 20px;
|
|
22
|
+
margin-bottom: 16px;
|
|
170
23
|
}
|
|
171
24
|
</style>
|
|
@@ -1,144 +1,46 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref } from 'vue'
|
|
3
|
-
import { useRouter } from 'vue-router'
|
|
4
3
|
import { useBankStore } from '../stores/bankStore'
|
|
4
|
+
import TransactionForm from '../components/TransactionForm.vue'
|
|
5
5
|
|
|
6
6
|
const bank = useBankStore()
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const txType = ref('DEPOSIT')
|
|
10
|
-
const amount = ref('')
|
|
11
|
-
const feedback = ref({ text: '', isError: false })
|
|
12
|
-
|
|
13
|
-
function handleSubmit() {
|
|
14
|
-
feedback.value = { text: '', isError: false }
|
|
7
|
+
const statusMessage = ref('')
|
|
15
8
|
|
|
9
|
+
function handleTransaction({ type, amount, note }) {
|
|
16
10
|
let res
|
|
17
|
-
if (
|
|
18
|
-
res = bank.deposit(amount
|
|
11
|
+
if (type === 'DEPOSIT') {
|
|
12
|
+
res = bank.deposit(amount, note)
|
|
19
13
|
} else {
|
|
20
|
-
res = bank.withdraw(amount
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (res.success) {
|
|
24
|
-
feedback.value = { text: res.message, isError: false }
|
|
25
|
-
amount.value = ''
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
router.push('/statement')
|
|
28
|
-
}, 1000)
|
|
29
|
-
} else {
|
|
30
|
-
feedback.value = { text: res.message, isError: true }
|
|
14
|
+
res = bank.withdraw(amount, note)
|
|
31
15
|
}
|
|
16
|
+
statusMessage.value = res.message
|
|
32
17
|
}
|
|
33
18
|
</script>
|
|
34
19
|
|
|
35
20
|
<template>
|
|
36
|
-
<div class="tx-
|
|
37
|
-
<h2>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
<div v-if="feedback.text" :class="['alert', feedback.isError ? 'alert-danger' : 'alert-success']">
|
|
41
|
-
{{ feedback.text }}
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<form @submit.prevent="handleSubmit" class="tx-form">
|
|
45
|
-
<div class="form-group">
|
|
46
|
-
<label>Transaction Type:</label>
|
|
47
|
-
<div class="radio-row">
|
|
48
|
-
<label>
|
|
49
|
-
<input type="radio" value="DEPOSIT" v-model="txType" /> Deposit
|
|
50
|
-
</label>
|
|
51
|
-
<label>
|
|
52
|
-
<input type="radio" value="WITHDRAWAL" v-model="txType" /> Withdrawal
|
|
53
|
-
</label>
|
|
54
|
-
</div>
|
|
55
|
-
</div>
|
|
56
|
-
|
|
57
|
-
<div class="form-group">
|
|
58
|
-
<label for="amt">Amount ($):</label>
|
|
59
|
-
<input id="amt" type="number" step="0.01" min="1" v-model="amount" placeholder="e.g. 250.00" required />
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
<div class="btn-row">
|
|
63
|
-
<button type="submit" class="btn btn-submit">Confirm {{ txType }}</button>
|
|
64
|
-
<router-link to="/" class="btn btn-back">Cancel</router-link>
|
|
65
|
-
</div>
|
|
66
|
-
</form>
|
|
21
|
+
<div class="tx-view">
|
|
22
|
+
<h2>Record New Transaction</h2>
|
|
23
|
+
<div v-if="statusMessage" class="status-box">{{ statusMessage }}</div>
|
|
24
|
+
<TransactionForm @submit-transaction="handleTransaction" />
|
|
67
25
|
</div>
|
|
68
26
|
</template>
|
|
69
27
|
|
|
70
28
|
<style scoped>
|
|
71
|
-
.tx-
|
|
72
|
-
|
|
73
|
-
border-radius: 8px;
|
|
74
|
-
padding: 20px;
|
|
75
|
-
background-color: #fafafa;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.alert {
|
|
79
|
-
padding: 10px;
|
|
80
|
-
border-radius: 4px;
|
|
81
|
-
margin-bottom: 15px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.alert-success {
|
|
85
|
-
background-color: #d4edda;
|
|
86
|
-
color: #155724;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.alert-danger {
|
|
90
|
-
background-color: #f8d7da;
|
|
91
|
-
color: #721c24;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.tx-form {
|
|
95
|
-
display: flex;
|
|
96
|
-
flex-direction: column;
|
|
97
|
-
gap: 15px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
.form-group {
|
|
101
|
-
display: flex;
|
|
102
|
-
flex-direction: column;
|
|
103
|
-
gap: 5px;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.radio-row {
|
|
107
|
-
display: flex;
|
|
108
|
-
gap: 20px;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
input[type="number"] {
|
|
112
|
-
padding: 8px;
|
|
113
|
-
font-size: 16px;
|
|
114
|
-
border: 1px solid #ccc;
|
|
115
|
-
border-radius: 4px;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.btn-row {
|
|
119
|
-
display: flex;
|
|
120
|
-
gap: 10px;
|
|
121
|
-
margin-top: 10px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.btn {
|
|
125
|
-
padding: 10px 16px;
|
|
126
|
-
border: none;
|
|
127
|
-
border-radius: 4px;
|
|
128
|
-
cursor: pointer;
|
|
129
|
-
text-decoration: none;
|
|
130
|
-
font-weight: bold;
|
|
29
|
+
.tx-view {
|
|
30
|
+
max-width: 480px;
|
|
131
31
|
}
|
|
132
32
|
|
|
133
|
-
.
|
|
134
|
-
|
|
135
|
-
|
|
33
|
+
.tx-view h2 {
|
|
34
|
+
font-size: 20px;
|
|
35
|
+
margin-bottom: 16px;
|
|
136
36
|
}
|
|
137
37
|
|
|
138
|
-
.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
38
|
+
.status-box {
|
|
39
|
+
padding: 10px 14px;
|
|
40
|
+
background: #f0fdf4;
|
|
41
|
+
color: #166534;
|
|
42
|
+
border-radius: 6px;
|
|
43
|
+
margin-bottom: 16px;
|
|
44
|
+
border: 1px solid #bbf7d0;
|
|
143
45
|
}
|
|
144
46
|
</style>
|