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
|
||||
CompanyEntity get coreCompany => rebuild((b) => b
|
||||
..clients.clear()
|
||||
..products.clear()
|
||||
..invoices.clear()
|
||||
..payments.clear()
|
||||
..quotes.clear()
|
||||
..credits.clear()
|
||||
..tasks.clear()
|
||||
..projects.clear()
|
||||
..vendors.clear()
|
||||
..expenses.clear()
|
||||
//..designs.clear()
|
||||
//..companyGateways.clear()
|
||||
CompanyEntity get coreCompany => rebuild(
|
||||
(b) => b
|
||||
..clients.clear()
|
||||
..products.clear()
|
||||
..invoices.clear()
|
||||
..payments.clear()
|
||||
..quotes.clear()
|
||||
..credits.clear()
|
||||
..tasks.clear()
|
||||
..projects.clear()
|
||||
..vendors.clear()
|
||||
..expenses.clear()
|
||||
..webhooks.clear()
|
||||
..designs.clear()
|
||||
..companyGateways.clear(),
|
||||
);
|
||||
|
||||
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_source.dart';
|
||||
import 'package:invoiceninja_flutter/utils/colors.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||
|
||||
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: [
|
||||
if (!isInMultiselect) DataColumn(label: SizedBox()),
|
||||
...widget.tableColumns.map((field) => DataColumn(
|
||||
label: Container(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: kTableColumnWidthMin,
|
||||
maxWidth: kTableColumnWidthMax,
|
||||
...widget.tableColumns.map((field) {
|
||||
String label =
|
||||
AppLocalization.of(context).lookup(field);
|
||||
if (field.startsWith('custom')) {
|
||||
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(
|
||||
AppLocalization.of(context).lookup(field),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
numeric: EntityPresenter.isFieldNumeric(field),
|
||||
onSort: (int columnIndex, bool ascending) {
|
||||
widget.onSortColumn(field);
|
||||
})),
|
||||
numeric: EntityPresenter.isFieldNumeric(field),
|
||||
onSort: (int columnIndex, bool ascending) {
|
||||
widget.onSortColumn(field);
|
||||
});
|
||||
}),
|
||||
],
|
||||
source: dataTableSource,
|
||||
sortColumnIndex:
|
||||
|
|
|
|||
Loading…
Reference in New Issue