Skip to content

Commit

Permalink
Merge pull request #169 from moneymanagerex/view-1-account
Browse files Browse the repository at this point in the history
refine Account Views
  • Loading branch information
georgeef authored Oct 23, 2024
2 parents eee1506 + dafdd79 commit 67a3155
Show file tree
Hide file tree
Showing 13 changed files with 678 additions and 513 deletions.
28 changes: 16 additions & 12 deletions MMEX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
9243531D2CC5201C0052E4BC /* ManageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9243531C2CC5201C0052E4BC /* ManageViewModel.swift */; };
9243531F2CC5A8B70052E4BC /* RepositoryLoadList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9243531E2CC5A8B70052E4BC /* RepositoryLoadList.swift */; };
924353212CC6EFA70052E4BC /* RepositoryLoadAux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924353202CC6EFA70052E4BC /* RepositoryLoadAux.swift */; };
924353252CC8928F0052E4BC /* AccountUpdateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 924353242CC8928F0052E4BC /* AccountUpdateView.swift */; };
929EF65F2C9FF2DE0051A3E6 /* AssetData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF65E2C9FF2DE0051A3E6 /* AssetData.swift */; };
929EF6612C9FF2FD0051A3E6 /* StockData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6602C9FF2FD0051A3E6 /* StockData.swift */; };
929EF6632C9FF3ED0051A3E6 /* AssetRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */; };
Expand Down Expand Up @@ -111,16 +112,16 @@
A3C1423A2C89754C00D3CEC0 /* SQLite in Frameworks */ = {isa = PBXBuildFile; productRef = A3C142392C89754C00D3CEC0 /* SQLite */; };
A3C1423E2C89760600D3CEC0 /* AccountListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C1423D2C89760600D3CEC0 /* AccountListView.swift */; };
A3C142442C89C8FA00D3CEC0 /* AccountData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142432C89C8FA00D3CEC0 /* AccountData.swift */; };
A3C142472C89CB4200D3CEC0 /* AccountDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142462C89CB4200D3CEC0 /* AccountDetailView.swift */; };
A3C142472C89CB4200D3CEC0 /* AccountReadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142462C89CB4200D3CEC0 /* AccountReadView.swift */; };
A3C1424C2C8AB52600D3CEC0 /* CurrencyData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C1424B2C8AB52600D3CEC0 /* CurrencyData.swift */; };
A3C1424E2C8B335900D3CEC0 /* PayeeData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C1424D2C8B335900D3CEC0 /* PayeeData.swift */; };
A3C142502C8B366400D3CEC0 /* PayeeListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C1424F2C8B366400D3CEC0 /* PayeeListView.swift */; };
A3C142522C8B37E700D3CEC0 /* PayeeDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142512C8B37E700D3CEC0 /* PayeeDetailView.swift */; };
A3C142542C8B381400D3CEC0 /* PayeeEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142532C8B381400D3CEC0 /* PayeeEditView.swift */; };
A3C1425F2C8DE70300D3CEC0 /* EnvironmentManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C1425E2C8DE70300D3CEC0 /* EnvironmentManager.swift */; };
A3C142612C8E9DBF00D3CEC0 /* PayeeAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142602C8E9DBF00D3CEC0 /* PayeeAddView.swift */; };
A3C142632C8ED8C000D3CEC0 /* AccountAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142622C8ED8C000D3CEC0 /* AccountAddView.swift */; };
A3C142652C8ED8EA00D3CEC0 /* AccountEditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142642C8ED8EA00D3CEC0 /* AccountEditView.swift */; };
A3C142632C8ED8C000D3CEC0 /* AccountCreateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142622C8ED8C000D3CEC0 /* AccountCreateView.swift */; };
A3C142652C8ED8EA00D3CEC0 /* AccountEditForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142642C8ED8EA00D3CEC0 /* AccountEditForm.swift */; };
A3C142672C8F2AF500D3CEC0 /* TransactionData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142662C8F2AF500D3CEC0 /* TransactionData.swift */; };
A3C142922C8FE11700D3CEC0 /* AccountRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142912C8FE11700D3CEC0 /* AccountRepository.swift */; };
A3C142942C8FE13E00D3CEC0 /* PayeeRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3C142932C8FE13E00D3CEC0 /* PayeeRepository.swift */; };
Expand Down Expand Up @@ -195,6 +196,7 @@
9243531C2CC5201C0052E4BC /* ManageViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManageViewModel.swift; sourceTree = "<group>"; };
9243531E2CC5A8B70052E4BC /* RepositoryLoadList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryLoadList.swift; sourceTree = "<group>"; };
924353202CC6EFA70052E4BC /* RepositoryLoadAux.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RepositoryLoadAux.swift; sourceTree = "<group>"; };
924353242CC8928F0052E4BC /* AccountUpdateView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountUpdateView.swift; sourceTree = "<group>"; };
929EF65E2C9FF2DE0051A3E6 /* AssetData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetData.swift; sourceTree = "<group>"; };
929EF6602C9FF2FD0051A3E6 /* StockData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StockData.swift; sourceTree = "<group>"; };
929EF6622C9FF3ED0051A3E6 /* AssetRepository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -242,16 +244,16 @@
A3C1423D2C89760600D3CEC0 /* AccountListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountListView.swift; sourceTree = "<group>"; };
A3C142412C897BE600D3CEC0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A3C142432C89C8FA00D3CEC0 /* AccountData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountData.swift; sourceTree = "<group>"; };
A3C142462C89CB4200D3CEC0 /* AccountDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountDetailView.swift; sourceTree = "<group>"; };
A3C142462C89CB4200D3CEC0 /* AccountReadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountReadView.swift; sourceTree = "<group>"; };
A3C1424B2C8AB52600D3CEC0 /* CurrencyData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyData.swift; sourceTree = "<group>"; };
A3C1424D2C8B335900D3CEC0 /* PayeeData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeData.swift; sourceTree = "<group>"; };
A3C1424F2C8B366400D3CEC0 /* PayeeListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeListView.swift; sourceTree = "<group>"; };
A3C142512C8B37E700D3CEC0 /* PayeeDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeDetailView.swift; sourceTree = "<group>"; };
A3C142532C8B381400D3CEC0 /* PayeeEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeEditView.swift; sourceTree = "<group>"; };
A3C1425E2C8DE70300D3CEC0 /* EnvironmentManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnvironmentManager.swift; sourceTree = "<group>"; };
A3C142602C8E9DBF00D3CEC0 /* PayeeAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeAddView.swift; sourceTree = "<group>"; };
A3C142622C8ED8C000D3CEC0 /* AccountAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountAddView.swift; sourceTree = "<group>"; };
A3C142642C8ED8EA00D3CEC0 /* AccountEditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountEditView.swift; sourceTree = "<group>"; };
A3C142622C8ED8C000D3CEC0 /* AccountCreateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCreateView.swift; sourceTree = "<group>"; };
A3C142642C8ED8EA00D3CEC0 /* AccountEditForm.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountEditForm.swift; sourceTree = "<group>"; };
A3C142662C8F2AF500D3CEC0 /* TransactionData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionData.swift; sourceTree = "<group>"; };
A3C142912C8FE11700D3CEC0 /* AccountRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountRepository.swift; sourceTree = "<group>"; };
A3C142932C8FE13E00D3CEC0 /* PayeeRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayeeRepository.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -413,9 +415,10 @@
isa = PBXGroup;
children = (
A3C1423D2C89760600D3CEC0 /* AccountListView.swift */,
A3C142462C89CB4200D3CEC0 /* AccountDetailView.swift */,
A3C142622C8ED8C000D3CEC0 /* AccountAddView.swift */,
A3C142642C8ED8EA00D3CEC0 /* AccountEditView.swift */,
A3C142622C8ED8C000D3CEC0 /* AccountCreateView.swift */,
A3C142462C89CB4200D3CEC0 /* AccountReadView.swift */,
924353242CC8928F0052E4BC /* AccountUpdateView.swift */,
A3C142642C8ED8EA00D3CEC0 /* AccountEditForm.swift */,
);
path = Account;
sourceTree = "<group>";
Expand Down Expand Up @@ -752,7 +755,7 @@
A3C142AA2C90721800D3CEC0 /* CheckingView.swift in Sources */,
A3C142A62C90417700D3CEC0 /* EnterView.swift in Sources */,
920824262CA5082D00388AB2 /* TransactionShareRepository.swift in Sources */,
A3C142472C89CB4200D3CEC0 /* AccountDetailView.swift in Sources */,
A3C142472C89CB4200D3CEC0 /* AccountReadView.swift in Sources */,
A3C1429A2C8FF77D00D3CEC0 /* TransactionDetailView.swift in Sources */,
924352E22CABD00C0052E4BC /* Cache.swift in Sources */,
924352F02CB061F10052E4BC /* FieldTheme.swift in Sources */,
Expand All @@ -777,6 +780,7 @@
A37E7D942C9B217500B4ECFC /* InfotableData.swift in Sources */,
924353192CC51FA00052E4BC /* PayeeViewModel.swift in Sources */,
9243530F2CC516B70052E4BC /* RepositoryLoadMain.swift in Sources */,
924353252CC8928F0052E4BC /* AccountUpdateView.swift in Sources */,
924353102CC516B70052E4BC /* RepositoryLoadProtocol.swift in Sources */,
9208242E2CA617FB00388AB2 /* FieldContentRepository.swift in Sources */,
9208241E2CA4E1C500388AB2 /* TransactionLinkRepository.swift in Sources */,
Expand All @@ -803,8 +807,8 @@
A3363EE32C9323A5004696C7 /* CategoryEditView.swift in Sources */,
920824102CA4C5CD00388AB2 /* BudgetYearRepository.swift in Sources */,
920824202CA4E5C200388AB2 /* TagLinkData.swift in Sources */,
A3C142652C8ED8EA00D3CEC0 /* AccountEditView.swift in Sources */,
A3C142632C8ED8C000D3CEC0 /* AccountAddView.swift in Sources */,
A3C142652C8ED8EA00D3CEC0 /* AccountEditForm.swift in Sources */,
A3C142632C8ED8C000D3CEC0 /* AccountCreateView.swift in Sources */,
929EF6712CA3676B0051A3E6 /* MMEXDocument.swift in Sources */,
929EF6692CA034770051A3E6 /* Repository.swift in Sources */,
9208241C2CA4DFFC00388AB2 /* TransactionLinkData.swift in Sources */,
Expand Down
3 changes: 3 additions & 0 deletions MMEX/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,9 @@
}
}
}
},
"Error" : {

},
"expenses" : {
"localizations" : {
Expand Down
86 changes: 0 additions & 86 deletions MMEX/View/Account/AccountAddView.swift

This file was deleted.

70 changes: 70 additions & 0 deletions MMEX/View/Account/AccountCreateView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// AccountCreateView.swift
// MMEX
//
// Created by Lisheng Guan on 2024/9/9.
//

import SwiftUI

struct AccountCreateView: View {
@EnvironmentObject var env: EnvironmentManager
@State var vm: RepositoryViewModel
@State var data: AccountData
@Binding var newData: AccountData?
@Binding var isPresented: Bool

@State private var alertIsPresented = false
@State private var alertMessage: String?

var body: some View {
NavigationStack {
Form {
AccountEditForm(
vm: vm,
data: $data,
edit: true
)
}
.textSelection(.enabled)
.toolbar {
ToolbarItem(placement: .cancellationAction) {
Button("Dismiss") {
isPresented = false
}
}
ToolbarItem(placement: .confirmationAction) {
Button("Add") {
if let createError = vm.createAccount(&data) {
alertMessage = createError
alertIsPresented = true
} else {
newData = data
isPresented = false
}
}
}
}
.alert(isPresented: $alertIsPresented) {
Alert(
title: Text("Error"),
message: Text(alertMessage!),
dismissButton: .default(Text("OK"))
)
}
}
}
}

/*
#Preview {
AccountCreateView(
allCurrencyName: .constant(CurrencyData.sampleDataName),
newAccount: .constant(AccountData()),
isPresentingAddView: .constant(true)
) { newAccount in
// Handle saving in preview
log.info("New account: \(newAccount.name)")
}
}
*/
Loading

0 comments on commit 67a3155

Please sign in to comment.