This commit is contained in:
Hillel Coren 2019-05-29 18:08:52 +03:00
parent bea6a132a8
commit 4d75afed39
8 changed files with 73 additions and 11 deletions

View File

@ -152,9 +152,14 @@ abstract class VendorEntity extends Object
@BuiltValueField(wireName: 'vendor_contacts')
BuiltList<VendorContactEntity> get vendorContacts;
List<EntityAction> getEntityActions({UserEntity user, ClientEntity client}) {
List<EntityAction> getEntityActions(
{UserEntity user, ClientEntity client, bool includeEdit = false}) {
final actions = <EntityAction>[];
if (includeEdit && user.canEditEntity(this)) {
actions.add(EntityAction.edit);
}
return actions..addAll(getBaseActions(user: user));
}

View File

@ -20,6 +20,18 @@ class AppLocalization {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
'new_vendor': 'New Vendor',
'created_vendor': 'Successfully created vendor',
'updated_vendor': 'Successfully updated vendor',
'archived_vendor': 'Successfully archived vendor',
'deleted_vendor': 'Successfully deleted vendor',
'restored_vendor': 'Successfully restored vendor',
'new_expense': 'New Expense',
'created_expense': 'Successfully created expense',
'updated_expense': 'Successfully updated expense',
'archived_expense': 'Successfully archived expense',
'deleted_expense': 'Successfully deleted expense',
'restored_expense': 'Successfully restored expense',
'copy_shipping': 'Copy Shipping',
'copy_billing': 'Copy Billing',
'design': 'Design',
@ -11673,6 +11685,8 @@ class AppLocalization {
String get products => _localizedValues[locale.toString()]['products'];
String get newProduct => _localizedValues[locale.toString()]['new_product'];
String get createdProduct =>
@ -11690,6 +11704,45 @@ class AppLocalization {
String get restoredProduct =>
_localizedValues[locale.toString()]['restored_product'];
String get newVendor => _localizedValues[locale.toString()]['new_vendor'];
String get createdVendor =>
_localizedValues[locale.toString()]['created_vendor'];
String get updatedVendor =>
_localizedValues[locale.toString()]['updated_vendor'];
String get archivedVendor =>
_localizedValues[locale.toString()]['archived_vendor'];
String get deletedVendor =>
_localizedValues[locale.toString()]['deleted_vendor'];
String get restoredVendor =>
_localizedValues[locale.toString()]['restored_vendor'];
String get newExpense => _localizedValues[locale.toString()]['new_expense'];
String get createdExpense =>
_localizedValues[locale.toString()]['created_expense'];
String get updatedExpense =>
_localizedValues[locale.toString()]['updated_expense'];
String get archivedExpense =>
_localizedValues[locale.toString()]['archived_expense'];
String get deletedExpense =>
_localizedValues[locale.toString()]['deleted_expense'];
String get restoredExpense =>
_localizedValues[locale.toString()]['restored_expense'];
String get productKey => _localizedValues[locale.toString()]['product_key'];
String get notes => _localizedValues[locale.toString()]['notes'];

View File

@ -12,9 +12,11 @@ List<int> dropdownStubsSelector(BuiltMap<int, StubEntity> stubMap,
BuiltList<int> stubList, int clientId) {
final list = stubList.where((stubId) {
final stub = stubMap[stubId];
/*
if (clientId != null && clientId > 0 && stub.clientId != clientId) {
return false;
}
*/
return stub.isActive;
}).toList();
@ -38,10 +40,12 @@ List<int> filteredStubsSelector(BuiltMap<int, StubEntity> stubMap,
if (!stub.matchesStates(stubListState.stateFilters)) {
return false;
}
/*
if (stubListState.filterEntityId != null &&
stub.clientId != stubListState.filterEntityId) {
return false;
}
*/
if (stubListState.custom1Filters.isNotEmpty &&
!stubListState.custom1Filters.contains(stub.customValue1)) {
return false;

View File

@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
import 'package:invoiceninja_flutter/ui/stub/edit/stub_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/app/buttons/refresh_icon_button.dart';
import 'package:invoiceninja_flutter/ui/app/buttons/action_icon_button.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
class StubEdit extends StatefulWidget {
@ -77,8 +77,7 @@ class _StubEditState extends State<StubEdit> {
? localization.newStub
: localization.editStub),
actions: <Widget>[
return Builder(builder: (BuildContext context) {
RefreshIconButton(
ActionIconButton(
icon: Icons.cloud_upload,
tooltip: localization.save,
isVisible: !stub.isDeleted,
@ -90,8 +89,7 @@ class _StubEditState extends State<StubEdit> {
}
viewModel.onSavePressed(context);
},
);
}),
),
],
),
body: Form(

View File

@ -94,6 +94,6 @@ class StubEditVM {
final Function onBackPressed;
final bool isLoading;
final bool isSaving;
final TaskEntity origStub;
final StubEntity origStub;
final AppState state;
}

View File

@ -56,12 +56,16 @@ class StubList extends StatelessWidget {
Widget build(BuildContext context) {
final localization = AppLocalization.of(context);
final listState = viewModel.listState;
/*
final filteredClientId = listState.filterEntityId;
final filteredClient =
filteredClientId != null ? viewModel.clientMap[filteredClientId] : null;
*/
return Column(
children: <Widget>[
/*
filteredClient != null
? Material(
color: Colors.orangeAccent,
@ -148,7 +152,7 @@ class StubList extends StatelessWidget {
},
),
),
),
),*/
],
);
}

View File

@ -32,7 +32,7 @@ class StubListItem extends StatelessWidget {
final filterMatch = filter != null && filter.isNotEmpty
? stub.matchesFilterValue(filter)
: null;
final subtitle = filterMatch ?? stub.notes;
final subtitle = filterMatch ?? '${stub.id}';
return DismissibleEntity(
user: user,

View File

@ -57,8 +57,6 @@ class StubScreen extends StatelessWidget {
onSelectedCustom2: (value) =>
store.dispatch(FilterStubsByCustom2(value)),
sortFields: [
StubFields.stubKey,
StubFields.cost,
StubFields.updatedAt,
],
onSelectedState: (EntityState state, value) {