Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Dec 6, 2021
2 parents 08e6373 + 9100eed commit 13f4d32
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
14 changes: 11 additions & 3 deletions lib/redux/dashboard/dashboard_sidebar_selectors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -276,15 +276,23 @@ List<ExpenseEntity> _recentExpenses({
expenseMap.forEach((index, expense) {
final client =
clientMap[expense.clientId] ?? ClientEntity(id: expense.clientId);
if (expense.isNotActive || client.isNotActive) {
if (client.isNotActive || expense.isNotActive || expense.isInvoiced) {
// do noting
} else {
expenses.add(expense);
}
});

expenses.sort((expenseA, expenseB) =>
(expenseA.date ?? '').compareTo(expenseB.date ?? ''));
expenses.sort((expenseA, expenseB) {
final expenseAdate = expenseA.date ?? '';
final expenseBdate = expenseB.date ?? '';

if (expenseAdate == expenseBdate) {
return expenseB.number.compareTo(expenseA.number);
} else {
return expenseBdate.compareTo(expenseAdate);
}
});

return expenses;
}
16 changes: 10 additions & 6 deletions lib/ui/invoice/edit/invoice_edit_items_desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,11 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
formatNumberType: FormatNumberType.inputMoney,
clientId: invoice.clientId),
onChanged: (value) => _onChanged(
lineItems[index]
.rebuild((b) => b..cost = parseDouble(value)),
index),
lineItems[index]
.rebuild((b) => b..cost = parseDouble(value)),
index,
debounce: false,
),
keyboardType: TextInputType.numberWithOptions(
decimal: true, signed: true),
onSavePressed: widget.entityViewModel.onSavePressed,
Expand All @@ -817,9 +819,11 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
formatNumberType: FormatNumberType.inputAmount,
clientId: invoice.clientId),
onChanged: (value) => _onChanged(
lineItems[index].rebuild(
(b) => b..quantity = parseDouble(value)),
index),
lineItems[index].rebuild(
(b) => b..quantity = parseDouble(value)),
index,
debounce: false,
),
keyboardType: TextInputType.numberWithOptions(
decimal: true, signed: true),
onSavePressed: widget.entityViewModel.onSavePressed,
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/payment/edit/payment_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class _PaymentEditState extends State<PaymentEdit> {
if (currency != null) {
final client = state.clientState.get(payment.clientId);
exchangeRate = getExchangeRate(state.staticState.currencyMap,
fromCurrencyId: currency.id, toCurrencyId: client.currencyId);
fromCurrencyId: client.currencyId, toCurrencyId: currency.id);
}

_exchangeRateController.removeListener(_onChanged);
Expand Down
6 changes: 4 additions & 2 deletions lib/ui/payment/view/payment_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class _PaymentViewState extends State<PaymentView> {
EntityListTile(
isFilter: widget.isFilter,
entity: state.invoiceState.map[paymentable.invoiceId],
subtitle: formatNumber(paymentable.amount, context) +
subtitle: formatNumber(paymentable.amount, context,
clientId: payment.clientId) +
' • ' +
formatDate(
convertTimestampToDateString(
Expand All @@ -123,7 +124,8 @@ class _PaymentViewState extends State<PaymentView> {
EntityListTile(
isFilter: widget.isFilter,
entity: state.creditState.map[paymentable.creditId],
subtitle: formatNumber(paymentable.amount, context) +
subtitle: formatNumber(paymentable.amount, context,
clientId: payment.clientId) +
' • ' +
formatDate(
convertTimestampToDateString(
Expand Down

0 comments on commit 13f4d32

Please sign in to comment.