Show custom header names
This commit is contained in:
parent
9104469871
commit
a2c1b6126c
|
|
@ -465,19 +465,21 @@ abstract class CompanyEntity extends Object
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO make sure to clear everything
|
// TODO make sure to clear everything
|
||||||
CompanyEntity get coreCompany => rebuild((b) => b
|
CompanyEntity get coreCompany => rebuild(
|
||||||
..clients.clear()
|
(b) => b
|
||||||
..products.clear()
|
..clients.clear()
|
||||||
..invoices.clear()
|
..products.clear()
|
||||||
..payments.clear()
|
..invoices.clear()
|
||||||
..quotes.clear()
|
..payments.clear()
|
||||||
..credits.clear()
|
..quotes.clear()
|
||||||
..tasks.clear()
|
..credits.clear()
|
||||||
..projects.clear()
|
..tasks.clear()
|
||||||
..vendors.clear()
|
..projects.clear()
|
||||||
..expenses.clear()
|
..vendors.clear()
|
||||||
//..designs.clear()
|
..expenses.clear()
|
||||||
//..companyGateways.clear()
|
..webhooks.clear()
|
||||||
|
..designs.clear()
|
||||||
|
..companyGateways.clear(),
|
||||||
);
|
);
|
||||||
|
|
||||||
bool isModuleEnabled(EntityType entityType) {
|
bool isModuleEnabled(EntityType entityType) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ 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.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart';
|
import 'package:invoiceninja_flutter/ui/app/tables/app_data_table_source.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/colors.dart';
|
import 'package:invoiceninja_flutter/utils/colors.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
|
|
||||||
class EntityDataTableSource extends AppDataTableSource {
|
class EntityDataTableSource extends AppDataTableSource {
|
||||||
|
|
@ -117,50 +116,3 @@ class EntityDataTableSource extends AppDataTableSource {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DatatableHeader extends StatelessWidget {
|
|
||||||
const DatatableHeader({
|
|
||||||
@required this.entityType,
|
|
||||||
@required this.onClearPressed,
|
|
||||||
@required this.onRefreshPressed,
|
|
||||||
});
|
|
||||||
|
|
||||||
final EntityType entityType;
|
|
||||||
final Function onClearPressed;
|
|
||||||
final Function onRefreshPressed;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final localization = AppLocalization.of(context);
|
|
||||||
/*
|
|
||||||
final state = StoreProvider.of<AppState>(context).state;
|
|
||||||
final listUIState = state.getListState(entityType);
|
|
||||||
Widget message = SizedBox();
|
|
||||||
if (onClearPressed != null && listUIState.filterEntityId != null) {
|
|
||||||
final entity = state.getEntityMap(
|
|
||||||
listUIState.filterEntityType)[listUIState.filterEntityId];
|
|
||||||
message = FilterListTile(
|
|
||||||
onPressed: (context) => viewEntityById(
|
|
||||||
context: context,
|
|
||||||
entityId: listUIState.filterEntityId,
|
|
||||||
entityType: listUIState.filterEntityType,
|
|
||||||
),
|
|
||||||
onClearPressed: onClearPressed,
|
|
||||||
entityType: listUIState.filterEntityType,
|
|
||||||
entity: entity,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return Row(
|
|
||||||
children: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: Text(localization.refresh),
|
|
||||||
onPressed: onRefreshPressed,
|
|
||||||
),
|
|
||||||
SizedBox(width: 20),
|
|
||||||
Expanded(child: SizedBox()),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -247,21 +247,30 @@ class _EntityListState extends State<EntityList> {
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
if (!isInMultiselect) DataColumn(label: SizedBox()),
|
if (!isInMultiselect) DataColumn(label: SizedBox()),
|
||||||
...widget.tableColumns.map((field) => DataColumn(
|
...widget.tableColumns.map((field) {
|
||||||
label: Container(
|
String label =
|
||||||
constraints: BoxConstraints(
|
AppLocalization.of(context).lookup(field);
|
||||||
minWidth: kTableColumnWidthMin,
|
if (field.startsWith('custom')) {
|
||||||
maxWidth: kTableColumnWidthMax,
|
final key = field.replaceFirst(
|
||||||
|
'custom', entityType.snakeCase);
|
||||||
|
label = state.company.getCustomFieldLabel(key);
|
||||||
|
}
|
||||||
|
return DataColumn(
|
||||||
|
label: Container(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minWidth: kTableColumnWidthMin,
|
||||||
|
maxWidth: kTableColumnWidthMax,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
numeric: EntityPresenter.isFieldNumeric(field),
|
||||||
AppLocalization.of(context).lookup(field),
|
onSort: (int columnIndex, bool ascending) {
|
||||||
overflow: TextOverflow.ellipsis,
|
widget.onSortColumn(field);
|
||||||
),
|
});
|
||||||
),
|
}),
|
||||||
numeric: EntityPresenter.isFieldNumeric(field),
|
|
||||||
onSort: (int columnIndex, bool ascending) {
|
|
||||||
widget.onSortColumn(field);
|
|
||||||
})),
|
|
||||||
],
|
],
|
||||||
source: dataTableSource,
|
source: dataTableSource,
|
||||||
sortColumnIndex:
|
sortColumnIndex:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue