Add contacts table column
This commit is contained in:
parent
3b1a6c7caf
commit
0dff3c4899
|
|
@ -69,6 +69,7 @@ class ClientFields {
|
|||
static const String updatedAt = 'updated_at';
|
||||
static const String archivedAt = 'archived_at';
|
||||
static const String isDeleted = 'is_deleted';
|
||||
static const String contacts = 'contacts';
|
||||
static const String contactName = 'contact_name';
|
||||
static const String contactEmail = 'contact_email';
|
||||
static const String contactPhone = 'contact_phone';
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ class VendorFields {
|
|||
static const String archivedAt = 'archived_at';
|
||||
static const String isDeleted = 'is_deleted';
|
||||
static const String documents = 'documents';
|
||||
static const String contacts = 'contacts';
|
||||
}
|
||||
|
||||
abstract class VendorEntity extends Object
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
|
|
@ -43,6 +44,7 @@ class ClientPresenter extends EntityPresenter {
|
|||
ClientFields.documents,
|
||||
ClientFields.group,
|
||||
ClientFields.contactPhone,
|
||||
ClientFields.contacts,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -122,6 +124,17 @@ class ClientPresenter extends EntityPresenter {
|
|||
return Text('${client.documents.length}');
|
||||
case ClientFields.group:
|
||||
return Text(state.groupState.get(client.groupId).name);
|
||||
case ClientFields.contacts:
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: kTableColumnWidthMax),
|
||||
child: Flexible(
|
||||
child: Text(
|
||||
client.contacts.map((contact) => contact.fullName).join(', '),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return super.getField(field: field, context: context);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/presenters/entity_presenter.dart';
|
||||
|
|
@ -36,6 +37,7 @@ class VendorPresenter extends EntityPresenter {
|
|||
VendorFields.updatedAt,
|
||||
VendorFields.archivedAt,
|
||||
VendorFields.documents,
|
||||
VendorFields.contacts,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +87,17 @@ class VendorPresenter extends EntityPresenter {
|
|||
return Text(presentCustomField(context, vendor.customValue4));
|
||||
case VendorFields.documents:
|
||||
return Text('${vendor.documents.length}');
|
||||
case VendorFields.contacts:
|
||||
return ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: kTableColumnWidthMax),
|
||||
child: Flexible(
|
||||
child: Text(
|
||||
vendor.contacts.map((contact) => contact.fullName).join(', '),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return super.getField(field: field, context: context);
|
||||
|
|
|
|||
Loading…
Reference in New Issue