Navigation changes
This commit is contained in:
parent
3f689f0f0b
commit
612625e282
|
|
@ -70,14 +70,12 @@ List<String> filteredInvoicesSelector(
|
|||
});
|
||||
});
|
||||
}
|
||||
print('## PAYMENT MAP: $invoicePaymentMap');
|
||||
|
||||
final list = invoiceList.where((invoiceId) {
|
||||
final invoice = invoiceMap[invoiceId];
|
||||
final client =
|
||||
clientMap[invoice.clientId] ?? ClientEntity(id: invoice.clientId);
|
||||
|
||||
print(
|
||||
'## invoiceListState.filterEntityType: ${invoiceListState.filterEntityType}');
|
||||
if (invoiceListState.filterEntityType == EntityType.client) {
|
||||
if (!invoiceListState.entityMatchesFilter(client)) {
|
||||
return false;
|
||||
|
|
@ -88,8 +86,6 @@ List<String> filteredInvoicesSelector(
|
|||
}
|
||||
} else if (invoiceListState.filterEntityType == EntityType.payment) {
|
||||
bool isMatch = false;
|
||||
print('## invoiceListState.filterEntityId : ${invoiceListState.filterEntityId }');
|
||||
print('## paymentIds: ${invoicePaymentMap[invoiceId]}');
|
||||
(invoicePaymentMap[invoiceId] ?? []).forEach((paymentId) {
|
||||
if (invoiceListState.filterEntityId == paymentId) {
|
||||
isMatch = true;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,57 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||
import 'package:invoiceninja_flutter/utils/icons.dart';
|
||||
|
||||
class EntityListTile extends StatelessWidget {
|
||||
const EntityListTile(
|
||||
{this.icon, this.onTap, this.onLongPress, this.title, this.subtitle});
|
||||
const EntityListTile({
|
||||
@required this.entity,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.subtitle,
|
||||
});
|
||||
|
||||
final Function onTap;
|
||||
final Function onLongPress;
|
||||
final String subtitle;
|
||||
final BaseEntity entity;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: EntityStateTitle(entity: entity),
|
||||
subtitle: subtitle != null && subtitle.isNotEmpty
|
||||
? Text(subtitle)
|
||||
: null,
|
||||
leading: Icon(getEntityIcon(entity.entityType), size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EntitiesListTile extends StatelessWidget {
|
||||
const EntitiesListTile({
|
||||
this.icon,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
});
|
||||
|
||||
final Function onTap;
|
||||
final Function onLongPress;
|
||||
|
|
@ -17,17 +66,21 @@ class EntityListTile extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: ListTile(
|
||||
title: Text(title),
|
||||
subtitle:
|
||||
subtitle != null && subtitle.isNotEmpty ? Text(subtitle) : null,
|
||||
leading: Icon(icon, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: Text(title),
|
||||
subtitle: subtitle != null && subtitle.isNotEmpty
|
||||
? Text(subtitle)
|
||||
: null,
|
||||
leading: Icon(icon, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(height: 1),
|
||||
ListDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_filter.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart';
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class _GroupViewState extends State<GroupView> {
|
|||
),
|
||||
),
|
||||
ListDivider(),
|
||||
EntityListTile(
|
||||
EntitiesListTile(
|
||||
icon: getEntityIcon(EntityType.client),
|
||||
title: localization.clients,
|
||||
onTap: () => viewModel.onClientsPressed(context),
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import 'package:invoiceninja_flutter/data/models/quote_model.dart';
|
|||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_list_tile.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/invoice/invoice_item_view.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entity_header.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||
|
|
@ -15,7 +15,6 @@ import 'package:invoiceninja_flutter/ui/invoice/view/invoice_view_vm.dart';
|
|||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/icon_message.dart';
|
||||
import 'package:invoiceninja_flutter/utils/icons.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
||||
class InvoiceOverview extends StatelessWidget {
|
||||
|
|
@ -104,61 +103,37 @@ class InvoiceOverview extends StatelessWidget {
|
|||
value: invoice.customValue2);
|
||||
}
|
||||
|
||||
widgets.addAll([
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: EntityStateTitle(entity: client),
|
||||
leading: Icon(getEntityIcon(EntityType.client), size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: () => viewModel.onClientPressed(context),
|
||||
onLongPress: () => viewModel.onClientPressed(context, true),
|
||||
),
|
||||
),
|
||||
widgets.add(
|
||||
EntityListTile(
|
||||
entity: client,
|
||||
onTap: () => viewModel.onClientPressed(context),
|
||||
onLongPress: () => viewModel.onClientPressed(context, true),
|
||||
),
|
||||
ListDivider(),
|
||||
]);
|
||||
);
|
||||
|
||||
if (payments.isNotEmpty) {
|
||||
if (payments.length == 1) {
|
||||
final payment = payments.first;
|
||||
widgets.addAll([
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: EntityStateTitle(entity: payment),
|
||||
subtitle: Text(
|
||||
formatNumber(payment.amount, context, clientId: client.id) +
|
||||
' • ' +
|
||||
formatDate(payment.date, context)),
|
||||
leading: Icon(FontAwesomeIcons.creditCard, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: () => viewModel.onPaymentPressed(context, payment),
|
||||
onLongPress: () =>
|
||||
viewModel.onPaymentPressed(context, payment, true),
|
||||
),
|
||||
),
|
||||
widgets.add(
|
||||
EntityListTile(
|
||||
entity: payment,
|
||||
onTap: () => viewModel.onPaymentPressed(context, payment),
|
||||
onLongPress: () =>
|
||||
viewModel.onPaymentPressed(context, payment, true),
|
||||
subtitle:
|
||||
formatNumber(payment.amount, context, clientId: client.id) +
|
||||
' • ' +
|
||||
formatDate(payment.date, context),
|
||||
),
|
||||
]);
|
||||
);
|
||||
} else {
|
||||
widgets.addAll([
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: Text(localization.payments),
|
||||
leading: Icon(FontAwesomeIcons.creditCard, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: () => viewModel.onPaymentsPressed(context),
|
||||
),
|
||||
),
|
||||
widgets.add(
|
||||
EntitiesListTile(
|
||||
icon: FontAwesomeIcons.creditCard,
|
||||
title: localization.payments,
|
||||
onTap: () => viewModel.onPaymentsPressed(context),
|
||||
),
|
||||
]);
|
||||
);
|
||||
}
|
||||
|
||||
widgets.addAll([
|
||||
|
|
@ -204,8 +179,8 @@ class InvoiceOverview extends StatelessWidget {
|
|||
return Container(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20, top: 12, right: 20, bottom: 12),
|
||||
padding:
|
||||
const EdgeInsets.only(left: 20, top: 12, right: 20, bottom: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/payment_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/FieldGrid.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/bottom_buttons.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_list_tile.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/icon_message.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entity_header.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||
|
|
@ -70,56 +69,38 @@ class _PaymentViewState extends State<PaymentView> {
|
|||
child: ListView(
|
||||
children: <Widget>[
|
||||
EntityHeader(
|
||||
backgroundColor: PaymentStatusColors.colors[payment.statusId],
|
||||
backgroundColor:
|
||||
PaymentStatusColors.colors[payment.statusId],
|
||||
label: localization.amount,
|
||||
value:
|
||||
formatNumber(payment.amount, context, clientId: client.id),
|
||||
value: formatNumber(payment.amount, context,
|
||||
clientId: client.id),
|
||||
secondLabel: localization.applied,
|
||||
secondValue:
|
||||
formatNumber(payment.applied, context, clientId: client.id),
|
||||
secondValue: formatNumber(payment.applied, context,
|
||||
clientId: client.id),
|
||||
),
|
||||
ListDivider(),
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: EntityStateTitle(entity: client),
|
||||
leading: Icon(FontAwesomeIcons.users, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: () => viewModel.onClientPressed(context),
|
||||
onLongPress: () => viewModel.onClientPressed(context, true),
|
||||
),
|
||||
),
|
||||
EntityListTile(
|
||||
entity: client,
|
||||
onTap: () => viewModel.onClientPressed(context),
|
||||
onLongPress: () =>
|
||||
viewModel.onClientPressed(context, true),
|
||||
),
|
||||
ListDivider(),
|
||||
for (final paymentable in payment.paymentables)
|
||||
Material(
|
||||
color: Theme.of(context).cardColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListTile(
|
||||
title: EntityStateTitle(
|
||||
entity: state.invoiceState.map[paymentable.invoiceId],
|
||||
title:
|
||||
'${localization.invoice} ${state.invoiceState.map[paymentable.invoiceId]?.number ?? ''}',
|
||||
),
|
||||
subtitle: Text(formatNumber(paymentable.amount, context) +
|
||||
' • ' +
|
||||
formatDate(
|
||||
convertTimestampToDateString(paymentable.createdAt),
|
||||
context)),
|
||||
leading: Icon(FontAwesomeIcons.filePdf, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: () => viewModel.onInvoicePressed(
|
||||
context, paymentable.invoiceId),
|
||||
onLongPress: () => viewModel.onInvoicePressed(
|
||||
context, paymentable.invoiceId, true),
|
||||
),
|
||||
),
|
||||
EntityListTile(
|
||||
entity: state.invoiceState.map[paymentable.invoiceId],
|
||||
subtitle: formatNumber(paymentable.amount, context) +
|
||||
' • ' +
|
||||
formatDate(
|
||||
convertTimestampToDateString(
|
||||
paymentable.createdAt),
|
||||
context),
|
||||
onTap: () => viewModel.onInvoicePressed(
|
||||
context, paymentable.invoiceId),
|
||||
onLongPress: () => viewModel.onInvoicePressed(
|
||||
context, paymentable.invoiceId, true),
|
||||
),
|
||||
ListDivider(),
|
||||
payment.privateNotes != null && payment.privateNotes.isNotEmpty
|
||||
payment.privateNotes != null &&
|
||||
payment.privateNotes.isNotEmpty
|
||||
? Column(
|
||||
children: <Widget>[
|
||||
IconMessage(payment.privateNotes),
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|||
import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/payment/payment_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/quote/quote_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_list_tile.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entity_header.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/lists/list_divider.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/view_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/ui/user/view/user_view_vm.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -40,9 +40,7 @@ class UserView extends StatelessWidget {
|
|||
Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
EntityListTile(
|
||||
bottomPadding: 1,
|
||||
icon: getEntityIcon(EntityType.invoice),
|
||||
EntitiesListTile(
|
||||
title: localization.invoices,
|
||||
onTap: () => viewModel.onEntityPressed(context, EntityType.invoice),
|
||||
onLongPress: () =>
|
||||
|
|
@ -51,8 +49,7 @@ class UserView extends StatelessWidget {
|
|||
memoizedInvoiceStatsForUser(user.id, state.invoiceState.map)
|
||||
.present(localization.active, localization.archived),
|
||||
),
|
||||
EntityListTile(
|
||||
bottomPadding: 1,
|
||||
EntitiesListTile(
|
||||
icon: getEntityIcon(EntityType.payment),
|
||||
title: localization.payments,
|
||||
onTap: () => viewModel.onEntityPressed(context, EntityType.payment),
|
||||
|
|
@ -63,8 +60,7 @@ class UserView extends StatelessWidget {
|
|||
.present(localization.active, localization.archived),
|
||||
),
|
||||
company.isModuleEnabled(EntityType.quote)
|
||||
? EntityListTile(
|
||||
bottomPadding: 1,
|
||||
? EntitiesListTile(
|
||||
icon: getEntityIcon(EntityType.quote),
|
||||
title: localization.quotes,
|
||||
onTap: () =>
|
||||
|
|
@ -132,40 +128,3 @@ class UserView extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EntityListTile extends StatelessWidget {
|
||||
const EntityListTile(
|
||||
{this.icon,
|
||||
this.onTap,
|
||||
this.onLongPress,
|
||||
this.title,
|
||||
this.subtitle,
|
||||
this.bottomPadding = 12});
|
||||
|
||||
final Function onTap;
|
||||
final Function onLongPress;
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final double bottomPadding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Material(
|
||||
color: Theme.of(context).canvasColor,
|
||||
child: ListTile(
|
||||
title: Text(title),
|
||||
subtitle: Text(subtitle),
|
||||
leading: Icon(icon, size: 18.0),
|
||||
trailing: Icon(Icons.navigate_next),
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
),
|
||||
),
|
||||
ListDivider(),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue