displayed comma seperated amount on expenses
This commit is contained in:
parent
2013447904
commit
9feb9d1b4b
@ -274,8 +274,7 @@ class ExpenseList extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
MyText.titleLarge("Delete Expense",
|
||||
fontWeight: 600,
|
||||
color:
|
||||
Theme.of(context).colorScheme.onBackground),
|
||||
color: Theme.of(context).colorScheme.onBackground),
|
||||
const SizedBox(height: 12),
|
||||
MyText.bodySmall(
|
||||
"Are you sure you want to delete this draft expense?",
|
||||
@ -392,8 +391,7 @@ class ExpenseList extends StatelessWidget {
|
||||
fontWeight: 600),
|
||||
Row(
|
||||
children: [
|
||||
MyText.bodyMedium(
|
||||
'₹ ${expense.amount.toStringAsFixed(2)}',
|
||||
MyText.bodyMedium('₹ ${expense.formattedAmount}',
|
||||
fontWeight: 600),
|
||||
if (expense.status.name.toLowerCase() == 'draft') ...[
|
||||
const SizedBox(width: 8),
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
/// Parse the entire response
|
||||
ExpenseResponse expenseResponseFromJson(String str) =>
|
||||
@ -112,8 +113,9 @@ class Filter {
|
||||
statusIds: List<String>.from(json["statusIds"] ?? []),
|
||||
createdByIds: List<String>.from(json["createdByIds"] ?? []),
|
||||
paidById: List<String>.from(json["paidById"] ?? []),
|
||||
startDate:
|
||||
json["startDate"] != null ? DateTime.tryParse(json["startDate"]) : null,
|
||||
startDate: json["startDate"] != null
|
||||
? DateTime.tryParse(json["startDate"])
|
||||
: null,
|
||||
endDate:
|
||||
json["endDate"] != null ? DateTime.tryParse(json["endDate"]) : null,
|
||||
);
|
||||
@ -162,6 +164,16 @@ class ExpenseModel {
|
||||
required this.preApproved,
|
||||
});
|
||||
|
||||
/// ✅ Comma-separated amount getter with currency symbol
|
||||
String get formattedAmount {
|
||||
final formatter = NumberFormat.currency(
|
||||
locale: 'en_IN',
|
||||
symbol: '₹ ',
|
||||
decimalDigits: 2,
|
||||
);
|
||||
return formatter.format(amount);
|
||||
}
|
||||
|
||||
factory ExpenseModel.fromJson(Map<String, dynamic> json) => ExpenseModel(
|
||||
id: json["id"] ?? '',
|
||||
project: Project.fromJson(json["project"] ?? {}),
|
||||
@ -171,8 +183,7 @@ class ExpenseModel {
|
||||
createdBy: CreatedBy.fromJson(json["createdBy"] ?? {}),
|
||||
transactionDate:
|
||||
DateTime.tryParse(json["transactionDate"] ?? '') ?? DateTime.now(),
|
||||
createdAt:
|
||||
DateTime.tryParse(json["createdAt"] ?? '') ?? DateTime.now(),
|
||||
createdAt: DateTime.tryParse(json["createdAt"] ?? '') ?? DateTime.now(),
|
||||
supplerName: json["supplerName"] ?? '',
|
||||
amount: (json["amount"] ?? 0).toDouble(),
|
||||
status: Status.fromJson(json["status"] ?? {}),
|
||||
@ -226,8 +237,7 @@ class Project {
|
||||
shortName: json["shortName"] ?? '',
|
||||
projectAddress: json["projectAddress"] ?? '',
|
||||
contactPerson: json["contactPerson"] ?? '',
|
||||
startDate:
|
||||
DateTime.tryParse(json["startDate"] ?? '') ?? DateTime.now(),
|
||||
startDate: DateTime.tryParse(json["startDate"] ?? '') ?? DateTime.now(),
|
||||
endDate: DateTime.tryParse(json["endDate"] ?? '') ?? DateTime.now(),
|
||||
projectStatusId: json["projectStatusId"] ?? '',
|
||||
);
|
||||
@ -390,7 +400,7 @@ class Status {
|
||||
name: json["name"] ?? '',
|
||||
displayName: json["displayName"] ?? '',
|
||||
description: json["description"] ?? '',
|
||||
color: (json["color"] ?? '').replaceAll("'", ''),
|
||||
color: (json["color"] ?? '').replaceAll("'", ''),
|
||||
isSystem: json["isSystem"] ?? false,
|
||||
);
|
||||
|
||||
|
@ -12,6 +12,7 @@ import 'package:marco/helpers/widgets/expense_main_components.dart';
|
||||
import 'package:marco/helpers/utils/permission_constants.dart';
|
||||
import 'package:marco/helpers/widgets/my_refresh_indicator.dart';
|
||||
|
||||
|
||||
class ExpenseMainScreen extends StatefulWidget {
|
||||
const ExpenseMainScreen({super.key});
|
||||
|
||||
@ -105,7 +106,7 @@ class _ExpenseMainScreenState extends State<ExpenseMainScreen> {
|
||||
child: filteredList.isEmpty
|
||||
? ListView(
|
||||
physics:
|
||||
const AlwaysScrollableScrollPhysics(), // important
|
||||
const AlwaysScrollableScrollPhysics(),
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.5,
|
||||
|
Loading…
x
Reference in New Issue
Block a user