added wallet functionality
This commit is contained in:
67
lib/screens/accounts/models/account_model.dart
Normal file
67
lib/screens/accounts/models/account_model.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'account_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class CurrencyModel {
|
||||
final String id;
|
||||
final String? createdAt;
|
||||
final String name;
|
||||
final String symbol;
|
||||
final String code;
|
||||
final double rate;
|
||||
final bool defaultCurrency;
|
||||
|
||||
CurrencyModel({
|
||||
required this.id,
|
||||
this.createdAt,
|
||||
required this.name,
|
||||
required this.symbol,
|
||||
required this.code,
|
||||
required this.rate,
|
||||
required this.defaultCurrency,
|
||||
});
|
||||
|
||||
factory CurrencyModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$CurrencyModelFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$CurrencyModelToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class AccountModel {
|
||||
final String name;
|
||||
final String description;
|
||||
final String accountNumber;
|
||||
final String alternateAccountNumber;
|
||||
final String type;
|
||||
final String category;
|
||||
final String ledger;
|
||||
final double balance;
|
||||
final String partyType;
|
||||
final String party;
|
||||
final CurrencyModel currency;
|
||||
final String customerStringId;
|
||||
final String companyStringId;
|
||||
|
||||
AccountModel({
|
||||
required this.name,
|
||||
required this.description,
|
||||
required this.accountNumber,
|
||||
required this.alternateAccountNumber,
|
||||
required this.type,
|
||||
required this.category,
|
||||
required this.ledger,
|
||||
required this.balance,
|
||||
required this.partyType,
|
||||
required this.party,
|
||||
required this.currency,
|
||||
required this.customerStringId,
|
||||
required this.companyStringId,
|
||||
});
|
||||
|
||||
factory AccountModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$AccountModelFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$AccountModelToJson(this);
|
||||
}
|
||||
62
lib/screens/accounts/models/account_model.g.dart
Normal file
62
lib/screens/accounts/models/account_model.g.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'account_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
CurrencyModel _$CurrencyModelFromJson(Map<String, dynamic> json) =>
|
||||
CurrencyModel(
|
||||
id: json['id'] as String,
|
||||
createdAt: json['createdAt'] as String?,
|
||||
name: json['name'] as String,
|
||||
symbol: json['symbol'] as String,
|
||||
code: json['code'] as String,
|
||||
rate: (json['rate'] as num).toDouble(),
|
||||
defaultCurrency: json['defaultCurrency'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CurrencyModelToJson(CurrencyModel instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'createdAt': instance.createdAt,
|
||||
'name': instance.name,
|
||||
'symbol': instance.symbol,
|
||||
'code': instance.code,
|
||||
'rate': instance.rate,
|
||||
'defaultCurrency': instance.defaultCurrency,
|
||||
};
|
||||
|
||||
AccountModel _$AccountModelFromJson(Map<String, dynamic> json) => AccountModel(
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String,
|
||||
accountNumber: json['accountNumber'] as String,
|
||||
alternateAccountNumber: json['alternateAccountNumber'] as String,
|
||||
type: json['type'] as String,
|
||||
category: json['category'] as String,
|
||||
ledger: json['ledger'] as String,
|
||||
balance: (json['balance'] as num).toDouble(),
|
||||
partyType: json['partyType'] as String,
|
||||
party: json['party'] as String,
|
||||
currency: CurrencyModel.fromJson(json['currency'] as Map<String, dynamic>),
|
||||
customerStringId: json['customerStringId'] as String,
|
||||
companyStringId: json['companyStringId'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$AccountModelToJson(AccountModel instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'accountNumber': instance.accountNumber,
|
||||
'alternateAccountNumber': instance.alternateAccountNumber,
|
||||
'type': instance.type,
|
||||
'category': instance.category,
|
||||
'ledger': instance.ledger,
|
||||
'balance': instance.balance,
|
||||
'partyType': instance.partyType,
|
||||
'party': instance.party,
|
||||
'currency': instance.currency,
|
||||
'customerStringId': instance.customerStringId,
|
||||
'companyStringId': instance.companyStringId,
|
||||
};
|
||||
63
lib/screens/accounts/models/statement_model.dart
Normal file
63
lib/screens/accounts/models/statement_model.dart
Normal file
@@ -0,0 +1,63 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'statement_model.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class TransactionModel {
|
||||
final String name;
|
||||
final String narration;
|
||||
final String party;
|
||||
final String company;
|
||||
final String postingDate;
|
||||
final double amount;
|
||||
final String account;
|
||||
final String accountName;
|
||||
final String currency;
|
||||
final String type;
|
||||
final double balance;
|
||||
|
||||
TransactionModel({
|
||||
required this.name,
|
||||
required this.narration,
|
||||
required this.party,
|
||||
required this.company,
|
||||
required this.postingDate,
|
||||
required this.amount,
|
||||
required this.account,
|
||||
required this.accountName,
|
||||
required this.currency,
|
||||
required this.type,
|
||||
required this.balance,
|
||||
});
|
||||
|
||||
factory TransactionModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$TransactionModelFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$TransactionModelToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class StatementModel {
|
||||
final int startBalance;
|
||||
final double endBalance;
|
||||
final List<TransactionModel> transactions;
|
||||
final String accountName;
|
||||
final String accountNumber;
|
||||
final String startDate;
|
||||
final String endDate;
|
||||
|
||||
StatementModel({
|
||||
required this.startBalance,
|
||||
required this.endBalance,
|
||||
required this.transactions,
|
||||
required this.accountName,
|
||||
required this.accountNumber,
|
||||
required this.startDate,
|
||||
required this.endDate,
|
||||
});
|
||||
|
||||
factory StatementModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$StatementModelFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$StatementModelToJson(this);
|
||||
}
|
||||
61
lib/screens/accounts/models/statement_model.g.dart
Normal file
61
lib/screens/accounts/models/statement_model.g.dart
Normal file
@@ -0,0 +1,61 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'statement_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
TransactionModel _$TransactionModelFromJson(Map<String, dynamic> json) =>
|
||||
TransactionModel(
|
||||
name: json['name'] as String,
|
||||
narration: json['narration'] as String,
|
||||
party: json['party'] as String,
|
||||
company: json['company'] as String,
|
||||
postingDate: json['postingDate'] as String,
|
||||
amount: (json['amount'] as num).toDouble(),
|
||||
account: json['account'] as String,
|
||||
accountName: json['accountName'] as String,
|
||||
currency: json['currency'] as String,
|
||||
type: json['type'] as String,
|
||||
balance: (json['balance'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$TransactionModelToJson(TransactionModel instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'narration': instance.narration,
|
||||
'party': instance.party,
|
||||
'company': instance.company,
|
||||
'postingDate': instance.postingDate,
|
||||
'amount': instance.amount,
|
||||
'account': instance.account,
|
||||
'accountName': instance.accountName,
|
||||
'currency': instance.currency,
|
||||
'type': instance.type,
|
||||
'balance': instance.balance,
|
||||
};
|
||||
|
||||
StatementModel _$StatementModelFromJson(Map<String, dynamic> json) =>
|
||||
StatementModel(
|
||||
startBalance: (json['startBalance'] as num).toInt(),
|
||||
endBalance: (json['endBalance'] as num).toDouble(),
|
||||
transactions: (json['transactions'] as List<dynamic>)
|
||||
.map((e) => TransactionModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
accountName: json['accountName'] as String,
|
||||
accountNumber: json['accountNumber'] as String,
|
||||
startDate: json['startDate'] as String,
|
||||
endDate: json['endDate'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$StatementModelToJson(StatementModel instance) =>
|
||||
<String, dynamic>{
|
||||
'startBalance': instance.startBalance,
|
||||
'endBalance': instance.endBalance,
|
||||
'transactions': instance.transactions,
|
||||
'accountName': instance.accountName,
|
||||
'accountNumber': instance.accountNumber,
|
||||
'startDate': instance.startDate,
|
||||
'endDate': instance.endDate,
|
||||
};
|
||||
Reference in New Issue
Block a user