Vendors
This commit is contained in:
parent
bea6a132a8
commit
4d75afed39
|
|
@ -152,9 +152,14 @@ abstract class VendorEntity extends Object
|
||||||
@BuiltValueField(wireName: 'vendor_contacts')
|
@BuiltValueField(wireName: 'vendor_contacts')
|
||||||
BuiltList<VendorContactEntity> get vendorContacts;
|
BuiltList<VendorContactEntity> get vendorContacts;
|
||||||
|
|
||||||
List<EntityAction> getEntityActions({UserEntity user, ClientEntity client}) {
|
List<EntityAction> getEntityActions(
|
||||||
|
{UserEntity user, ClientEntity client, bool includeEdit = false}) {
|
||||||
final actions = <EntityAction>[];
|
final actions = <EntityAction>[];
|
||||||
|
|
||||||
|
if (includeEdit && user.canEditEntity(this)) {
|
||||||
|
actions.add(EntityAction.edit);
|
||||||
|
}
|
||||||
|
|
||||||
return actions..addAll(getBaseActions(user: user));
|
return actions..addAll(getBaseActions(user: user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,18 @@ class AppLocalization {
|
||||||
|
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'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_shipping': 'Copy Shipping',
|
||||||
'copy_billing': 'Copy Billing',
|
'copy_billing': 'Copy Billing',
|
||||||
'design': 'Design',
|
'design': 'Design',
|
||||||
|
|
@ -11673,6 +11685,8 @@ class AppLocalization {
|
||||||
|
|
||||||
String get products => _localizedValues[locale.toString()]['products'];
|
String get products => _localizedValues[locale.toString()]['products'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String get newProduct => _localizedValues[locale.toString()]['new_product'];
|
String get newProduct => _localizedValues[locale.toString()]['new_product'];
|
||||||
|
|
||||||
String get createdProduct =>
|
String get createdProduct =>
|
||||||
|
|
@ -11690,6 +11704,45 @@ class AppLocalization {
|
||||||
String get restoredProduct =>
|
String get restoredProduct =>
|
||||||
_localizedValues[locale.toString()]['restored_product'];
|
_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 productKey => _localizedValues[locale.toString()]['product_key'];
|
||||||
|
|
||||||
String get notes => _localizedValues[locale.toString()]['notes'];
|
String get notes => _localizedValues[locale.toString()]['notes'];
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,11 @@ List<int> dropdownStubsSelector(BuiltMap<int, StubEntity> stubMap,
|
||||||
BuiltList<int> stubList, int clientId) {
|
BuiltList<int> stubList, int clientId) {
|
||||||
final list = stubList.where((stubId) {
|
final list = stubList.where((stubId) {
|
||||||
final stub = stubMap[stubId];
|
final stub = stubMap[stubId];
|
||||||
|
/*
|
||||||
if (clientId != null && clientId > 0 && stub.clientId != clientId) {
|
if (clientId != null && clientId > 0 && stub.clientId != clientId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return stub.isActive;
|
return stub.isActive;
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
|
@ -38,10 +40,12 @@ List<int> filteredStubsSelector(BuiltMap<int, StubEntity> stubMap,
|
||||||
if (!stub.matchesStates(stubListState.stateFilters)) {
|
if (!stub.matchesStates(stubListState.stateFilters)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (stubListState.filterEntityId != null &&
|
if (stubListState.filterEntityId != null &&
|
||||||
stub.clientId != stubListState.filterEntityId) {
|
stub.clientId != stubListState.filterEntityId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if (stubListState.custom1Filters.isNotEmpty &&
|
if (stubListState.custom1Filters.isNotEmpty &&
|
||||||
!stubListState.custom1Filters.contains(stub.customValue1)) {
|
!stubListState.custom1Filters.contains(stub.customValue1)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.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/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';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
|
|
||||||
class StubEdit extends StatefulWidget {
|
class StubEdit extends StatefulWidget {
|
||||||
|
|
@ -77,8 +77,7 @@ class _StubEditState extends State<StubEdit> {
|
||||||
? localization.newStub
|
? localization.newStub
|
||||||
: localization.editStub),
|
: localization.editStub),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
return Builder(builder: (BuildContext context) {
|
ActionIconButton(
|
||||||
RefreshIconButton(
|
|
||||||
icon: Icons.cloud_upload,
|
icon: Icons.cloud_upload,
|
||||||
tooltip: localization.save,
|
tooltip: localization.save,
|
||||||
isVisible: !stub.isDeleted,
|
isVisible: !stub.isDeleted,
|
||||||
|
|
@ -90,8 +89,7 @@ class _StubEditState extends State<StubEdit> {
|
||||||
}
|
}
|
||||||
viewModel.onSavePressed(context);
|
viewModel.onSavePressed(context);
|
||||||
},
|
},
|
||||||
);
|
),
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Form(
|
body: Form(
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,6 @@ class StubEditVM {
|
||||||
final Function onBackPressed;
|
final Function onBackPressed;
|
||||||
final bool isLoading;
|
final bool isLoading;
|
||||||
final bool isSaving;
|
final bool isSaving;
|
||||||
final TaskEntity origStub;
|
final StubEntity origStub;
|
||||||
final AppState state;
|
final AppState state;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,16 @@ class StubList extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final listState = viewModel.listState;
|
final listState = viewModel.listState;
|
||||||
|
|
||||||
|
/*
|
||||||
final filteredClientId = listState.filterEntityId;
|
final filteredClientId = listState.filterEntityId;
|
||||||
final filteredClient =
|
final filteredClient =
|
||||||
filteredClientId != null ? viewModel.clientMap[filteredClientId] : null;
|
filteredClientId != null ? viewModel.clientMap[filteredClientId] : null;
|
||||||
|
*/
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
/*
|
||||||
filteredClient != null
|
filteredClient != null
|
||||||
? Material(
|
? Material(
|
||||||
color: Colors.orangeAccent,
|
color: Colors.orangeAccent,
|
||||||
|
|
@ -148,7 +152,7 @@ class StubList extends StatelessWidget {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),*/
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class StubListItem extends StatelessWidget {
|
||||||
final filterMatch = filter != null && filter.isNotEmpty
|
final filterMatch = filter != null && filter.isNotEmpty
|
||||||
? stub.matchesFilterValue(filter)
|
? stub.matchesFilterValue(filter)
|
||||||
: null;
|
: null;
|
||||||
final subtitle = filterMatch ?? stub.notes;
|
final subtitle = filterMatch ?? '${stub.id}';
|
||||||
|
|
||||||
return DismissibleEntity(
|
return DismissibleEntity(
|
||||||
user: user,
|
user: user,
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ class StubScreen extends StatelessWidget {
|
||||||
onSelectedCustom2: (value) =>
|
onSelectedCustom2: (value) =>
|
||||||
store.dispatch(FilterStubsByCustom2(value)),
|
store.dispatch(FilterStubsByCustom2(value)),
|
||||||
sortFields: [
|
sortFields: [
|
||||||
StubFields.stubKey,
|
|
||||||
StubFields.cost,
|
|
||||||
StubFields.updatedAt,
|
StubFields.updatedAt,
|
||||||
],
|
],
|
||||||
onSelectedState: (EntityState state, value) {
|
onSelectedState: (EntityState state, value) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue