Code formatting

This commit is contained in:
Hillel Coren 2020-10-09 16:51:33 +03:00
parent eb0d17015d
commit 59db8b6a50
40 changed files with 152 additions and 106 deletions

View File

@ -50,7 +50,7 @@ class PaymentFields {
static const String refunded = 'refunded'; static const String refunded = 'refunded';
static const String transactionReference = 'transaction_reference'; static const String transactionReference = 'transaction_reference';
static const String date = 'date'; static const String date = 'date';
static const String paymentTypeId = 'payment_type_id'; static const String typeId = 'type_id';
static const String client = 'client'; static const String client = 'client';
static const String clientId = 'client_id'; static const String clientId = 'client_id';
static const String invoiceId = 'invoice_id'; static const String invoiceId = 'invoice_id';
@ -58,7 +58,7 @@ class PaymentFields {
static const String privateNotes = 'private_notes'; static const String privateNotes = 'private_notes';
static const String exchangeRate = 'exchange_rate'; static const String exchangeRate = 'exchange_rate';
static const String exchangeCurrencyId = 'exchange_currency_id'; static const String exchangeCurrencyId = 'exchange_currency_id';
static const String paymentStatus = 'payment_status'; static const String status = 'status';
static const String gateway = 'gateway'; static const String gateway = 'gateway';
static const String customValue1 = 'custom1'; static const String customValue1 = 'custom1';
static const String customValue2 = 'custom2'; static const String customValue2 = 'custom2';
@ -267,7 +267,7 @@ abstract class PaymentEntity extends Object
case EntityFields.archivedAt: case EntityFields.archivedAt:
response = paymentA.archivedAt.compareTo(paymentB.archivedAt); response = paymentA.archivedAt.compareTo(paymentB.archivedAt);
break; break;
case PaymentFields.paymentStatus: case PaymentFields.status:
response = paymentA.statusId.compareTo(paymentB.statusId); response = paymentA.statusId.compareTo(paymentB.statusId);
break; break;
case PaymentFields.customValue1: case PaymentFields.customValue1:

View File

@ -195,5 +195,7 @@ class AuthRepository {
String get _tokenName => kIsWeb String get _tokenName => kIsWeb
? 'web_client' ? 'web_client'
: Platform.isAndroid ? 'android_client' : 'ios_client'; : Platform.isAndroid
? 'android_client'
: 'ios_client';
} }

View File

@ -81,8 +81,7 @@ class PaymentRepository {
} }
Future<PaymentEntity> refundPayment( Future<PaymentEntity> refundPayment(
Credentials credentials, Credentials credentials, PaymentEntity payment) async {
PaymentEntity payment) async {
final data = serializers.serializeWith(PaymentEntity.serializer, payment); final data = serializers.serializeWith(PaymentEntity.serializer, payment);
dynamic response; dynamic response;

View File

@ -19,20 +19,19 @@ class RecurringInvoiceRepository {
final dynamic response = await webClient.get( final dynamic response = await webClient.get(
'${credentials.url}/recurring_invoices/$entityId', credentials.token); '${credentials.url}/recurring_invoices/$entityId', credentials.token);
final InvoiceItemResponse recurringInvoiceResponse = serializers final InvoiceItemResponse recurringInvoiceResponse =
.deserializeWith(InvoiceItemResponse.serializer, response); serializers.deserializeWith(InvoiceItemResponse.serializer, response);
return recurringInvoiceResponse.data; return recurringInvoiceResponse.data;
} }
Future<BuiltList<InvoiceEntity>> loadList( Future<BuiltList<InvoiceEntity>> loadList(Credentials credentials) async {
Credentials credentials) async {
final String url = credentials.url + '/recurring_invoices?'; final String url = credentials.url + '/recurring_invoices?';
final dynamic response = await webClient.get(url, credentials.token); final dynamic response = await webClient.get(url, credentials.token);
final InvoiceListResponse recurringInvoiceResponse = serializers final InvoiceListResponse recurringInvoiceResponse =
.deserializeWith(InvoiceListResponse.serializer, response); serializers.deserializeWith(InvoiceListResponse.serializer, response);
return recurringInvoiceResponse.data; return recurringInvoiceResponse.data;
} }
@ -43,16 +42,16 @@ class RecurringInvoiceRepository {
final dynamic response = await webClient.post(url, credentials.token, final dynamic response = await webClient.post(url, credentials.token,
data: json.encode({'ids': ids, 'action': action.toApiParam()})); data: json.encode({'ids': ids, 'action': action.toApiParam()}));
final InvoiceListResponse recurringInvoiceResponse = serializers final InvoiceListResponse recurringInvoiceResponse =
.deserializeWith(InvoiceListResponse.serializer, response); serializers.deserializeWith(InvoiceListResponse.serializer, response);
return recurringInvoiceResponse.data.toList(); return recurringInvoiceResponse.data.toList();
} }
Future<InvoiceEntity> saveData( Future<InvoiceEntity> saveData(
Credentials credentials, InvoiceEntity recurringInvoice) async { Credentials credentials, InvoiceEntity recurringInvoice) async {
final data = serializers.serializeWith( final data =
InvoiceEntity.serializer, recurringInvoice); serializers.serializeWith(InvoiceEntity.serializer, recurringInvoice);
dynamic response; dynamic response;
if (recurringInvoice.isNew) { if (recurringInvoice.isNew) {
@ -66,8 +65,8 @@ class RecurringInvoiceRepository {
await webClient.put(url, credentials.token, data: json.encode(data)); await webClient.put(url, credentials.token, data: json.encode(data));
} }
final InvoiceItemResponse recurringInvoiceResponse = serializers final InvoiceItemResponse recurringInvoiceResponse =
.deserializeWith(InvoiceItemResponse.serializer, response); serializers.deserializeWith(InvoiceItemResponse.serializer, response);
return recurringInvoiceResponse.data; return recurringInvoiceResponse.data;
} }

View File

@ -70,7 +70,9 @@ class SettingsRepository {
String path, EntityType type) async { String path, EntityType type) async {
final route = type == EntityType.company final route = type == EntityType.company
? 'companies' ? 'companies'
: type == EntityType.group ? 'group_settings' : 'clients'; : type == EntityType.group
? 'group_settings'
: 'clients';
final url = '${credentials.url}/$route/$entityId'; final url = '${credentials.url}/$route/$entityId';
final dynamic response = await webClient.post(url, credentials.token, final dynamic response = await webClient.post(url, credentials.token,

View File

@ -56,10 +56,12 @@ final selectedIdReducer = combineReducers<String>([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.client ? '' : selectedId), action.entityType == EntityType.client ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.client ? action.entityId : selectedId), : action.entityType == EntityType.client
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<ClientEntity>([ final editingReducer = combineReducers<ClientEntity>([

View File

@ -152,7 +152,9 @@ abstract class SettingsUIState extends Object
user: user ?? UserEntity(), user: user ?? UserEntity(),
entityType: client != null entityType: client != null
? EntityType.client ? EntityType.client
: group != null ? EntityType.group : EntityType.company, : group != null
? EntityType.group
: EntityType.company,
origClient: origClient ?? ClientEntity(), origClient: origClient ?? ClientEntity(),
origGroup: origGroup ?? GroupEntity(), origGroup: origGroup ?? GroupEntity(),
origCompany: origCompany ?? CompanyEntity(), origCompany: origCompany ?? CompanyEntity(),

View File

@ -28,8 +28,8 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ArchiveCompanyGatewaySuccess>( TypedReducer<String, ArchiveCompanyGatewaySuccess>(
(selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => TypedReducer<String, FilterByEntity>(
action.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.companyGateway : action.entityType == EntityType.companyGateway
? action.entityId ? action.entityId

View File

@ -44,10 +44,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.credit ? '' : selectedId), action.entityType == EntityType.credit ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.credit ? action.entityId : selectedId), : action.entityType == EntityType.credit
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<InvoiceEntity>([ final editingReducer = combineReducers<InvoiceEntity>([

View File

@ -28,10 +28,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.group ? '' : selectedId), action.entityType == EntityType.group ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.group ? action.entityId : selectedId), : action.entityType == EntityType.group
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<GroupEntity>([ final editingReducer = combineReducers<GroupEntity>([

View File

@ -46,10 +46,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.invoice ? '' : selectedId), action.entityType == EntityType.invoice ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.invoice ? action.entityId : selectedId), : action.entityType == EntityType.invoice
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<InvoiceEntity>([ final editingReducer = combineReducers<InvoiceEntity>([

View File

@ -56,8 +56,7 @@ abstract class InvoiceUIState extends Object
implements Built<InvoiceUIState, InvoiceUIStateBuilder> { implements Built<InvoiceUIState, InvoiceUIStateBuilder> {
factory InvoiceUIState() { factory InvoiceUIState() {
return _$InvoiceUIState._( return _$InvoiceUIState._(
listUIState: listUIState: ListUIState(InvoiceFields.number, sortAscending: false),
ListUIState(InvoiceFields.number, sortAscending: false),
editing: InvoiceEntity(), editing: InvoiceEntity(),
selectedId: '', selectedId: '',
); );

View File

@ -26,10 +26,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.payment ? '' : selectedId), action.entityType == EntityType.payment ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.payment ? action.entityId : selectedId), : action.entityType == EntityType.payment
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<PaymentEntity>([ final editingReducer = combineReducers<PaymentEntity>([

View File

@ -26,7 +26,9 @@ InvoiceItemEntity convertProductToInvoiceItem({
..cost = cost ..cost = cost
..quantity = company.enableProductQuantity ..quantity = company.enableProductQuantity
? product.quantity ? product.quantity
: company.defaultQuantity ? 1 : null : company.defaultQuantity
? 1
: null
..customValue1 = product.customValue1 ..customValue1 = product.customValue1
..customValue2 = product.customValue2 ..customValue2 = product.customValue2
..taxName1 = product.taxName1 ..taxName1 = product.taxName1

View File

@ -44,10 +44,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.quote ? '' : selectedId), action.entityType == EntityType.quote ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.quote ? action.entityId : selectedId), : action.entityType == EntityType.quote
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<InvoiceEntity>([ final editingReducer = combineReducers<InvoiceEntity>([

View File

@ -80,7 +80,6 @@ List<String> filteredRecurringInvoicesSelector(
return false; return false;
} }
return true; return true;
}).toList(); }).toList();
list.sort((recurringInvoiceAId, recurringInvoiceBId) { list.sort((recurringInvoiceAId, recurringInvoiceBId) {
@ -142,10 +141,8 @@ EntityStats recurringInvoiceStatsForUser(
return EntityStats(countActive: countActive, countArchived: countArchived); return EntityStats(countActive: countActive, countArchived: countArchived);
} }
bool hasRecurringInvoiceChanges(InvoiceEntity recurringInvoice, bool hasRecurringInvoiceChanges(InvoiceEntity recurringInvoice,
BuiltMap<String, InvoiceEntity> recurringInvoiceMap) => BuiltMap<String, InvoiceEntity> recurringInvoiceMap) =>
recurringInvoice.isNew recurringInvoice.isNew
? recurringInvoice.isChanged ? recurringInvoice.isChanged
: recurringInvoice != recurringInvoiceMap[recurringInvoice.id]; : recurringInvoice != recurringInvoiceMap[recurringInvoice.id];

View File

@ -26,10 +26,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, DeleteTokensSuccess>((selectedId, action) => ''), TypedReducer<String, DeleteTokensSuccess>((selectedId, action) => ''),
TypedReducer<String, ArchiveTokensSuccess>((selectedId, action) => ''), TypedReducer<String, ArchiveTokensSuccess>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.token ? action.entityId : selectedId), : action.entityType == EntityType.token
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<TokenEntity>([ final editingReducer = combineReducers<TokenEntity>([

View File

@ -90,7 +90,9 @@ Reducer<bool> historyVisibleReducer = combineReducers([
TypedReducer<bool, UpdateUserPreferences>((value, action) { TypedReducer<bool, UpdateUserPreferences>((value, action) {
return action.historyMode == AppSidebarMode.visible return action.historyMode == AppSidebarMode.visible
? true ? true
: action.historyMode == AppSidebarMode.float ? false : value; : action.historyMode == AppSidebarMode.float
? false
: value;
}), }),
]); ]);

View File

@ -191,7 +191,9 @@ Reducer<SettingsUIState> settingsUIReducer = combineReducers([
..isChanged = false ..isChanged = false
..entityType = action.client != null ..entityType = action.client != null
? EntityType.client ? EntityType.client
: action.group != null ? EntityType.group : state.entityType); : action.group != null
? EntityType.group
: state.entityType);
}), }),
TypedReducer<SettingsUIState, UpdateCompany>((state, action) { TypedReducer<SettingsUIState, UpdateCompany>((state, action) {
return state.rebuild((b) => b return state.rebuild((b) => b

View File

@ -29,10 +29,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, ClearEntitySelection>((selectedId, action) => TypedReducer<String, ClearEntitySelection>((selectedId, action) =>
action.entityType == EntityType.user ? '' : selectedId), action.entityType == EntityType.user ? '' : selectedId),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.user ? action.entityId : selectedId), : action.entityType == EntityType.user
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<UserEntity>([ final editingReducer = combineReducers<UserEntity>([

View File

@ -26,10 +26,12 @@ Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, DeleteWebhooksSuccess>((selectedId, action) => ''), TypedReducer<String, DeleteWebhooksSuccess>((selectedId, action) => ''),
TypedReducer<String, ArchiveWebhooksSuccess>((selectedId, action) => ''), TypedReducer<String, ArchiveWebhooksSuccess>((selectedId, action) => ''),
TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String, ClearEntityFilter>((selectedId, action) => ''),
TypedReducer<String, FilterByEntity>((selectedId, action) => action TypedReducer<String, FilterByEntity>(
.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
: action.entityType == EntityType.webhook ? action.entityId : selectedId), : action.entityType == EntityType.webhook
? action.entityId
: selectedId),
]); ]);
final editingReducer = combineReducers<WebhookEntity>([ final editingReducer = combineReducers<WebhookEntity>([

View File

@ -199,7 +199,9 @@ class _NotificationSelector extends StatelessWidget {
child: IconText( child: IconText(
text: showNoneAsCustom text: showNoneAsCustom
? localization.custom ? localization.custom
: hasMultipleUsers ? localization.none : localization.disabled, : hasMultipleUsers
? localization.none
: localization.disabled,
icon: showNoneAsCustom icon: showNoneAsCustom
? Icons.arrow_drop_down_circle ? Icons.arrow_drop_down_circle
: Icons.do_not_disturb_alt, : Icons.do_not_disturb_alt,

View File

@ -129,7 +129,8 @@ class _ListFilterState extends State<ListFilter> {
onPressed: () { onPressed: () {
_filterController.text = ''; _filterController.text = '';
_focusNode.unfocus( _focusNode.unfocus(
disposition: UnfocusDisposition.previouslyFocusedChild); disposition:
UnfocusDisposition.previouslyFocusedChild);
widget.onFilterChanged(null); widget.onFilterChanged(null);
}, },
) )

View File

@ -46,7 +46,9 @@ class EntityPresenter {
case EntityFields.state: case EntityFields.state:
return Text(entity.isActive return Text(entity.isActive
? localization.active ? localization.active
: entity.isArchived ? localization.archived : localization.deleted); : entity.isArchived
? localization.archived
: localization.deleted);
case EntityFields.createdBy: case EntityFields.createdBy:
return Text( return Text(
state.userState.map[entity.createdUserId]?.listDisplayName ?? ''); state.userState.map[entity.createdUserId]?.listDisplayName ?? '');

View File

@ -123,7 +123,9 @@ class SettingsViewer extends StatelessWidget {
: null, : null,
localization.militaryTime: settings.enableMilitaryTime == true localization.militaryTime: settings.enableMilitaryTime == true
? localization.enabled ? localization.enabled
: settings.enableMilitaryTime == false ? localization.disabled : null, : settings.enableMilitaryTime == false
? localization.disabled
: null,
localization.language: settings.hasLanguage localization.language: settings.hasLanguage
? staticState.languageMap[settings.languageId]?.name ? staticState.languageMap[settings.languageId]?.name
: null, : null,
@ -132,16 +134,24 @@ class SettingsViewer extends StatelessWidget {
: null, : null,
localization.sendReminders: settings.sendReminders == true localization.sendReminders: settings.sendReminders == true
? localization.enabled ? localization.enabled
: settings.sendReminders == false ? localization.disabled : null, : settings.sendReminders == false
? localization.disabled
: null,
localization.clientPortal: settings.enablePortal == true localization.clientPortal: settings.enablePortal == true
? localization.enabled ? localization.enabled
: settings.enablePortal == false ? localization.disabled : null, : settings.enablePortal == false
? localization.disabled
: null,
localization.clientPortalTasks: settings.enablePortal == true localization.clientPortalTasks: settings.enablePortal == true
? localization.enabled ? localization.enabled
: settings.enablePortal == false ? localization.disabled : null, : settings.enablePortal == false
? localization.disabled
: null,
localization.clientPortalDashboard: settings.enablePortal == true localization.clientPortalDashboard: settings.enablePortal == true
? localization.enabled ? localization.enabled
: settings.enablePortal == false ? localization.disabled : null, : settings.enablePortal == false
? localization.disabled
: null,
localization.paymentType: settings.hasDefaultPaymentTypeId localization.paymentType: settings.hasDefaultPaymentTypeId
? staticState.paymentTypeMap[settings.defaultPaymentTypeId]?.name ? staticState.paymentTypeMap[settings.defaultPaymentTypeId]?.name
: null, : null,

View File

@ -10,11 +10,11 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
class InvoicePresenter extends EntityPresenter { class InvoicePresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
InvoiceFields.status,
InvoiceFields.number, InvoiceFields.number,
InvoiceFields.client, InvoiceFields.client,
InvoiceFields.amount, InvoiceFields.amount,
InvoiceFields.balance, InvoiceFields.balance,
InvoiceFields.status,
InvoiceFields.date, InvoiceFields.date,
InvoiceFields.dueDate, InvoiceFields.dueDate,
]; ];

View File

@ -9,13 +9,13 @@ import 'package:invoiceninja_flutter/utils/formatting.dart';
class PaymentPresenter extends EntityPresenter { class PaymentPresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
PaymentFields.status,
PaymentFields.number, PaymentFields.number,
PaymentFields.client, PaymentFields.client,
PaymentFields.amount, PaymentFields.amount,
PaymentFields.invoiceNumber, PaymentFields.invoiceNumber,
PaymentFields.date, PaymentFields.date,
PaymentFields.transactionReference, PaymentFields.transactionReference,
PaymentFields.paymentStatus,
]; ];
} }
@ -62,7 +62,7 @@ class PaymentPresenter extends EntityPresenter {
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Text(formatNumber(payment.amount, context, child: Text(formatNumber(payment.amount, context,
clientId: payment.clientId))); clientId: payment.clientId)));
case PaymentFields.paymentStatus: case PaymentFields.status:
return EntityStatusChip(entity: payment); return EntityStatusChip(entity: payment);
case PaymentFields.customValue1: case PaymentFields.customValue1:
return Text(payment.customValue1); return Text(payment.customValue1);

View File

@ -59,7 +59,7 @@ class _PaymentViewState extends State<PaymentView> {
if ((payment.typeId ?? '').isNotEmpty) { if ((payment.typeId ?? '').isNotEmpty) {
final paymentType = state.staticState.paymentTypeMap[payment.typeId]; final paymentType = state.staticState.paymentTypeMap[payment.typeId];
if (paymentType != null) { if (paymentType != null) {
fields[PaymentFields.paymentTypeId] = paymentType.name; fields[PaymentFields.typeId] = paymentType.name;
} }
} }
if (payment.transactionReference.isNotEmpty) { if (payment.transactionReference.isNotEmpty) {

View File

@ -103,8 +103,7 @@ class _ProductEditState extends State<ProductEdit> {
..customValue1 = _custom1Controller.text.trim() ..customValue1 = _custom1Controller.text.trim()
..customValue2 = _custom2Controller.text.trim() ..customValue2 = _custom2Controller.text.trim()
..customValue3 = _custom3Controller.text.trim() ..customValue3 = _custom3Controller.text.trim()
..customValue4 = _custom4Controller.text.trim() ..customValue4 = _custom4Controller.text.trim());
);
if (product != widget.viewModel.product) { if (product != widget.viewModel.product) {
widget.viewModel.onChanged(product); widget.viewModel.onChanged(product);
} }

View File

@ -82,8 +82,7 @@ class QuoteEditDetailsVM extends EntityEditDetailsVM {
clientList: state.clientState.list, clientList: state.clientState.list,
onClientChanged: (context, quote, client) { onClientChanged: (context, quote, client) {
if (client != null) { if (client != null) {
final exchangeRate = getExchangeRate( final exchangeRate = getExchangeRate(state.staticState.currencyMap,
state.staticState.currencyMap,
fromCurrencyId: company.currencyId, fromCurrencyId: company.currencyId,
toCurrencyId: client.currencyId); toCurrencyId: client.currencyId);
store.dispatch(UpdateQuote( store.dispatch(UpdateQuote(

View File

@ -11,10 +11,10 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
class QuotePresenter extends EntityPresenter { class QuotePresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
QuoteFields.status,
QuoteFields.number, QuoteFields.number,
QuoteFields.client, QuoteFields.client,
QuoteFields.amount, QuoteFields.amount,
QuoteFields.status,
QuoteFields.date, QuoteFields.date,
QuoteFields.validUntil, QuoteFields.validUntil,
]; ];

View File

@ -84,8 +84,7 @@ class RecurringInvoiceEditDetailsVM extends EntityEditDetailsVM {
clientList: state.clientState.list, clientList: state.clientState.list,
onClientChanged: (context, invoice, client) { onClientChanged: (context, invoice, client) {
if (client != null) { if (client != null) {
final exchangeRate = getExchangeRate( final exchangeRate = getExchangeRate(state.staticState.currencyMap,
state.staticState.currencyMap,
fromCurrencyId: company.currencyId, fromCurrencyId: company.currencyId,
toCurrencyId: client.currencyId); toCurrencyId: client.currencyId);
store.dispatch(UpdateRecurringInvoice( store.dispatch(UpdateRecurringInvoice(

View File

@ -44,7 +44,8 @@ class RecurringInvoiceEditNotesVM extends EntityEditNotesVM {
return RecurringInvoiceEditNotesVM( return RecurringInvoiceEditNotesVM(
company: state.company, company: state.company,
invoice: quote, invoice: quote,
onChanged: (InvoiceEntity quote) => store.dispatch(UpdateRecurringInvoice(quote)), onChanged: (InvoiceEntity quote) =>
store.dispatch(UpdateRecurringInvoice(quote)),
); );
} }
} }

View File

@ -96,7 +96,8 @@ class RecurringInvoiceEditVM extends EntityEditVM {
}, },
onItemsAdded: (items, clientId) { onItemsAdded: (items, clientId) {
if (items.length == 1) { if (items.length == 1) {
store.dispatch(EditRecurringInvoiceItem(recurringInvoice.lineItems.length)); store.dispatch(
EditRecurringInvoiceItem(recurringInvoice.lineItems.length));
} }
store.dispatch(AddRecurringInvoiceItems(items)); store.dispatch(AddRecurringInvoiceItems(items));
}, },

View File

@ -12,10 +12,10 @@ import 'package:invoiceninja_flutter/utils/localization.dart';
class RecurringInvoicePresenter extends EntityPresenter { class RecurringInvoicePresenter extends EntityPresenter {
static List<String> getDefaultTableFields(UserCompanyEntity userCompany) { static List<String> getDefaultTableFields(UserCompanyEntity userCompany) {
return [ return [
RecurringInvoiceFields.status,
RecurringInvoiceFields.invoiceNumber, RecurringInvoiceFields.invoiceNumber,
RecurringInvoiceFields.client, RecurringInvoiceFields.client,
RecurringInvoiceFields.amount, RecurringInvoiceFields.amount,
RecurringInvoiceFields.status,
RecurringInvoiceFields.remainingCycles, RecurringInvoiceFields.remainingCycles,
RecurringInvoiceFields.nextSendDate, RecurringInvoiceFields.nextSendDate,
RecurringInvoiceFields.frequency, RecurringInvoiceFields.frequency,

View File

@ -65,17 +65,13 @@ class RecurringInvoiceScreen extends StatelessWidget {
store.dispatch(StartRecurringInvoiceMultiselect()); store.dispatch(StartRecurringInvoiceMultiselect());
} }
}, },
customValues1: company.getCustomFieldValues( customValues1: company.getCustomFieldValues(CustomFieldType.invoice1,
CustomFieldType.invoice1,
excludeBlank: true), excludeBlank: true),
customValues2: company.getCustomFieldValues( customValues2: company.getCustomFieldValues(CustomFieldType.invoice2,
CustomFieldType.invoice2,
excludeBlank: true), excludeBlank: true),
customValues3: company.getCustomFieldValues( customValues3: company.getCustomFieldValues(CustomFieldType.invoice3,
CustomFieldType.invoice3,
excludeBlank: true), excludeBlank: true),
customValues4: company.getCustomFieldValues( customValues4: company.getCustomFieldValues(CustomFieldType.invoice4,
CustomFieldType.invoice4,
excludeBlank: true), excludeBlank: true),
onSelectedCustom1: (value) => onSelectedCustom1: (value) =>
store.dispatch(FilterRecurringInvoicesByCustom1(value)), store.dispatch(FilterRecurringInvoicesByCustom1(value)),

View File

@ -134,7 +134,9 @@ class TaskListItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
color: task.isInvoiced color: task.isInvoiced
? Colors.green ? Colors.green
: task.isRunning ? Colors.blue : Colors.grey, : task.isRunning
? Colors.blue
: Colors.grey,
)), )),
], ],
), ),

View File

@ -92,7 +92,9 @@ class _TaskViewState extends State<TaskView> {
entity: project, entity: project,
statusColor: task.isInvoiced statusColor: task.isInvoiced
? Colors.green ? Colors.green
: task.isRunning ? Colors.blue : null, : task.isRunning
? Colors.blue
: null,
label: localization.duration, label: localization.duration,
value: formatDuration(task.calculateDuration), value: formatDuration(task.calculateDuration),
secondLabel: localization.amount, secondLabel: localization.amount,

View File

@ -292,8 +292,12 @@ String formatDate(String value, BuildContext context,
String format; String format;
if (!showDate) { if (!showDate) {
format = showSeconds format = showSeconds
? company.settings.enableMilitaryTime ? 'H:mm:ss' : 'h:mm:ss a' ? company.settings.enableMilitaryTime
: company.settings.enableMilitaryTime ? 'H:mm' : 'h:mm a'; ? 'H:mm:ss'
: 'h:mm:ss a'
: company.settings.enableMilitaryTime
? 'H:mm'
: 'h:mm a';
} else { } else {
final dateFormats = state.staticState.dateFormatMap; final dateFormats = state.staticState.dateFormatMap;
final dateFormatId = (company.settings.dateFormatId ?? '').isNotEmpty final dateFormatId = (company.settings.dateFormatId ?? '').isNotEmpty
@ -302,8 +306,12 @@ String formatDate(String value, BuildContext context,
format = dateFormats[dateFormatId].format; format = dateFormats[dateFormatId].format;
format += ' ' + format += ' ' +
(showSeconds (showSeconds
? company.settings.enableMilitaryTime ? 'H:mm:ss' : 'h:mm:ss a' ? company.settings.enableMilitaryTime
: company.settings.enableMilitaryTime ? 'H:mm' : 'h:mm a'); ? 'H:mm:ss'
: 'h:mm:ss a'
: company.settings.enableMilitaryTime
? 'H:mm'
: 'h:mm a');
} }
final formatter = DateFormat(format, localeSelector(state)); final formatter = DateFormat(format, localeSelector(state));
final parsed = DateTime.tryParse(value); final parsed = DateTime.tryParse(value);