Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Joshua Dwire 2021-02-16 18:27:02 -05:00
commit a74cf2656e
253 changed files with 3596 additions and 1324 deletions

View File

@ -18,15 +18,18 @@ jobs:
- uses: subosito/flutter-action@v1
with:
channel: 'dev' # TODO change to beta/stable
#flutter-version: '1.22.0-12.0.pre'
#flutter-version: '1.24.0-7.0.pre'
#channel: 'dev'
flutter-version: '1.26.0-17.2.pre'
- run: flutter doctor -v
- run: flutter pub get
- run: |
cp lib/.env.dart.example lib/.env.dart
cp android/app/build.gradle.prod android/app/build.gradle
sed -i 's/secret/${{secrets.api_secret}}/g' lib/.env.dart
sed -i 's/dns/${{secrets.app_sentry}}/g' lib/.env.dart
- run: |
echo "const FLUTTER_VERSION = const <String, String>" > lib/flutter_version.dart
flutter --version --machine >> lib/flutter_version.dart
echo ";" >> lib/flutter_version.dart
- run: flutter upgrade
- run: flutter config --enable-web
- run: flutter build web --web-renderer html --release

View File

@ -1,80 +1,115 @@
import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/utils/colors.dart';
import 'constants.dart';
Color kColorBlue = convertHexStringToColor('#0275d8');
Color kColorTeal = convertHexStringToColor('#5bc0de');
Color kColorGreen = convertHexStringToColor('#5cb85c');
Color kColorYellow = convertHexStringToColor('#f0ad4e');
Color kColorRed = convertHexStringToColor('#d9534f');
Color kColorGray = convertHexStringToColor('#6C757D');
Color kColorDarkGray = convertHexStringToColor('#343A40');
import 'data/models/static/color_theme_model.dart';
class InvoiceStatusColors {
static var colors = {
kInvoiceStatusDraft: kColorDarkGray,
kInvoiceStatusSent: kColorTeal,
kInvoiceStatusPartial: kColorBlue,
kInvoiceStatusPaid: kColorGreen,
kInvoiceStatusPastDue: kColorRed,
kInvoiceStatusCancelled: kColorGray,
kInvoiceStatusReversed: kColorGray,
};
InvoiceStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kInvoiceStatusDraft: _colorTheme.colorDarkGray,
kInvoiceStatusSent: _colorTheme.colorInfo,
kInvoiceStatusPartial: _colorTheme.colorPrimary,
kInvoiceStatusPaid: _colorTheme.colorSuccess,
kInvoiceStatusPastDue: _colorTheme.colorDanger,
kInvoiceStatusCancelled: _colorTheme.colorLightGray,
kInvoiceStatusReversed: _colorTheme.colorLightGray,
};
}
}
class RecurringInvoiceStatusColors {
static var colors = {
kRecurringInvoiceStatusDraft: kColorDarkGray,
kRecurringInvoiceStatusActive: kColorGreen,
kRecurringInvoiceStatusPaused: kColorGray,
kRecurringInvoiceStatusCompleted: kColorGreen,
kRecurringInvoiceStatusPending: kColorGray,
};
RecurringInvoiceStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kRecurringInvoiceStatusDraft: _colorTheme.colorDarkGray,
kRecurringInvoiceStatusActive: _colorTheme.colorSuccess,
kRecurringInvoiceStatusPaused: _colorTheme.colorLightGray,
kRecurringInvoiceStatusCompleted: _colorTheme.colorSuccess,
kRecurringInvoiceStatusPending: _colorTheme.colorLightGray,
};
}
}
class CreditStatusColors {
static var colors = {
kCreditStatusDraft: kColorDarkGray,
kCreditStatusSent: kColorTeal,
kCreditStatusPartial: kColorBlue,
kCreditStatusApplied: kColorGreen,
};
CreditStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kCreditStatusDraft: _colorTheme.colorDarkGray,
kCreditStatusSent: _colorTheme.colorInfo,
kCreditStatusPartial: _colorTheme.colorPrimary,
kCreditStatusApplied: _colorTheme.colorSuccess,
};
}
}
class QuoteStatusColors {
static var colors = {
kQuoteStatusDraft: kColorDarkGray,
kQuoteStatusSent: kColorTeal,
kQuoteStatusApproved: kColorBlue,
kQuoteStatusConverted: kColorGreen,
kQuoteStatusExpired: kColorRed,
};
QuoteStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kQuoteStatusDraft: _colorTheme.colorDarkGray,
kQuoteStatusSent: _colorTheme.colorInfo,
kQuoteStatusApproved: _colorTheme.colorPrimary,
kQuoteStatusConverted: _colorTheme.colorSuccess,
kQuoteStatusExpired: _colorTheme.colorDanger,
};
}
}
class PaymentStatusColors {
static var colors = {
kPaymentStatusPending: kColorDarkGray,
kPaymentStatusCancelled: kColorGray,
kPaymentStatusFailed: kColorRed,
kPaymentStatusCompleted: kColorGreen,
kPaymentStatusPartiallyRefunded: kColorBlue,
kPaymentStatusRefunded: kColorGray,
kPaymentStatusUnapplied: kColorDarkGray,
};
PaymentStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kPaymentStatusPending: _colorTheme.colorDarkGray,
kPaymentStatusCancelled: _colorTheme.colorLightGray,
kPaymentStatusFailed: _colorTheme.colorDanger,
kPaymentStatusCompleted: _colorTheme.colorSuccess,
kPaymentStatusPartiallyRefunded: _colorTheme.colorPrimary,
kPaymentStatusRefunded: _colorTheme.colorLightGray,
kPaymentStatusUnapplied: _colorTheme.colorDarkGray,
kPaymentStatusPartiallyUnapplied: _colorTheme.colorDarkGray,
};
}
}
class ExpenseStatusColors {
static var colors = {
kExpenseStatusLogged: kColorDarkGray,
kExpenseStatusPending: kColorBlue,
kExpenseStatusInvoiced: kColorGreen,
};
ExpenseStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kExpenseStatusLogged: _colorTheme.colorDarkGray,
kExpenseStatusPending: _colorTheme.colorPrimary,
kExpenseStatusInvoiced: _colorTheme.colorSuccess,
};
}
}
class TaskStatusColors {
static var colors = {
kTaskStatusLogged: kColorDarkGray,
kTaskStatusRunning: kColorBlue,
kTaskStatusInvoiced: kColorGreen,
};
TaskStatusColors(this._colorTheme);
final ColorTheme _colorTheme;
Map<String, Color> get colors {
return {
kTaskStatusLogged: _colorTheme.colorDarkGray,
kTaskStatusRunning: _colorTheme.colorPrimary,
kTaskStatusInvoiced: _colorTheme.colorSuccess,
};
}
}

View File

@ -6,14 +6,12 @@ class Constants {
}
// TODO remove version once #46609 is fixed
const String kClientVersion = '5.0.41';
const String kClientVersion = '5.0.42';
const String kMinServerVersion = '5.0.4';
const String kAppName = 'Invoice Ninja';
const String kSiteUrl = 'https://invoiceninja.com';
//const String kAppProductionUrl = 'https://invoicing.co';
const String kAppProductionUrl =
'https://staging.invoicing.co'; // TODO remove staging
const String kAppProductionUrl = 'https://invoicing.co';
const String kAppStagingUrl = 'https://staging.invoicing.co';
const String kAppDemoUrl = 'https://demo.invoiceninja.com';
const String kWhiteLabelUrl =
@ -118,6 +116,9 @@ const String kPlanPro = 'pro';
const String kPlanEnterprise = 'enterprise';
const String kPlanWhiteLabel = 'white_label';
const String kColorThemeLight = 'light';
const String kColorThemeDark = 'dark';
const double kGutterWidth = 16;
const double kLighterOpacity = .6;
@ -402,6 +403,7 @@ const String kPermissionCreateAll = 'create_all';
const String kPermissionViewAll = 'view_all';
const String kPermissionEditAll = 'edit_all';
const String kPaymentStatusPartiallyUnapplied = '-2';
const String kPaymentStatusUnapplied = '-1';
const String kPaymentStatusPending = '1';
const String kPaymentStatusCancelled = '2';
@ -411,6 +413,7 @@ const String kPaymentStatusPartiallyRefunded = '5';
const String kPaymentStatusRefunded = '6';
const kPaymentStatuses = {
kPaymentStatusPartiallyUnapplied: 'partially_unapplied',
kPaymentStatusUnapplied: 'unapplied',
kPaymentStatusPending: 'pending',
kPaymentStatusCancelled: 'cancelled',
@ -438,7 +441,7 @@ const String kDefaultDarkSelectedColor = '#253750';
const String kDefaultDarkBorderColor = '#393A3C';
const String kDefaultLightSelectedColorMenu = '#f2faff';
const String kDefaultLightSelectedColor = '#e5f5ff';
const String kDefaultLightBorderColor = '#E7EBEE';
const String kDefaultLightBorderColor = '#dfdfdf';
const String kReportGroupDay = 'day';
const String kReportGroupMonth = 'month';

View File

@ -963,6 +963,10 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'reply_to_email')
String get replyToEmail;
@nullable
@BuiltValueField(wireName: 'reply_to_name')
String get replyToName;
@nullable
@BuiltValueField(wireName: 'bcc_email')
String get bccEmail;

File diff suppressed because one or more lines are too long

View File

@ -137,12 +137,24 @@ abstract class InvoiceEntity extends Object
terms: '',
footer: '',
designId: '',
taxName1: company?.settings?.defaultTaxName1 ?? '',
taxRate1: company?.settings?.defaultTaxRate1 ?? 0.0,
taxName2: company?.settings?.defaultTaxName2 ?? '',
taxRate2: company?.settings?.defaultTaxRate2 ?? 0.0,
taxName3: company?.settings?.defaultTaxName3 ?? '',
taxRate3: company?.settings?.defaultTaxRate3 ?? 0.0,
taxName1: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxName1 ?? ''
: '',
taxRate1: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxRate1 ?? 0.0
: 0,
taxName2: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxName2 ?? ''
: '',
taxRate2: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxRate2 ?? 0.0
: 0,
taxName3: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxName3 ?? ''
: '',
taxRate3: (company?.numberOfInvoiceTaxRates ?? 0) >= 1
? company?.settings?.defaultTaxRate3 ?? 0.0
: 0,
isAmountDiscount: false,
partial: 0.0,
partialDueDate: '',
@ -208,6 +220,7 @@ abstract class InvoiceEntity extends Object
..balance = 0
..amount = 0
..paidToDate = 0
..remainingCycles = -1
..invoiceId = ''
..number = ''
..date = convertDateTimeToSqlDate()
@ -1036,10 +1049,10 @@ class ProductItemFields {
static const String quantity = 'quantity';
static const String lineTotal = 'line_total';
static const String discount = 'discount';
static const String custom1 = 'custom1';
static const String custom2 = 'custom2';
static const String custom3 = 'custom3';
static const String custom4 = 'custom4';
static const String custom1 = 'product1';
static const String custom2 = 'product2';
static const String custom3 = 'product3';
static const String custom4 = 'product4';
}
class TaskItemFields {
@ -1050,10 +1063,10 @@ class TaskItemFields {
static const String hours = 'hours';
static const String lineTotal = 'line_total';
static const String discount = 'discount';
static const String custom1 = 'custom1';
static const String custom2 = 'custom2';
static const String custom3 = 'custom3';
static const String custom4 = 'custom4';
static const String custom1 = 'task1';
static const String custom2 = 'task2';
static const String custom3 = 'task3';
static const String custom4 = 'task4';
}
abstract class InvoiceItemEntity

View File

@ -85,6 +85,7 @@ class EntityAction extends EnumClass {
static const EntityAction copy = _$copy;
static const EntityAction invoiceTask = _$invoiceTask;
static const EntityAction invoiceExpense = _$invoiceExpense;
static const EntityAction invoiceProject = _$invoiceProject;
@override
String toString() {

View File

@ -54,6 +54,7 @@ const EntityAction _$cancel = const EntityAction._('cancel');
const EntityAction _$copy = const EntityAction._('copy');
const EntityAction _$invoiceTask = const EntityAction._('invoiceTask');
const EntityAction _$invoiceExpense = const EntityAction._('invoiceExpense');
const EntityAction _$invoiceProject = const EntityAction._('invoiceProject');
EntityAction _$valueOf(String name) {
switch (name) {
@ -145,6 +146,8 @@ EntityAction _$valueOf(String name) {
return _$invoiceTask;
case 'invoiceExpense':
return _$invoiceExpense;
case 'invoiceProject':
return _$invoiceProject;
default:
throw new ArgumentError(name);
}
@ -196,6 +199,7 @@ final BuiltSet<EntityAction> _$values =
_$copy,
_$invoiceTask,
_$invoiceExpense,
_$invoiceProject,
]);
Serializer<EntityAction> _$entityActionSerializer =

View File

@ -215,7 +215,9 @@ abstract class PaymentEntity extends Object
String get calculatedStatusId {
if (applied < amount) {
return kPaymentStatusUnapplied;
return applied == 0
? kPaymentStatusUnapplied
: kPaymentStatusPartiallyUnapplied;
}
return statusId;

View File

@ -171,16 +171,7 @@ abstract class ProjectEntity extends Object
if (isActive && client?.isActive == true) {
if (userCompany.canCreate(EntityType.invoice)) {
actions.add(EntityAction.newInvoice);
}
if (userCompany.canCreate(EntityType.recurringInvoice)) {
actions.add(EntityAction.newRecurringInvoice);
}
if (userCompany.canCreate(EntityType.quote)) {
actions.add(EntityAction.newQuote);
}
if (userCompany.canCreate(EntityType.credit)) {
actions.add(EntityAction.newCredit);
actions.add(EntityAction.invoiceProject);
}
if (userCompany.canCreate(EntityType.task)) {
actions.add(EntityAction.newTask);

View File

@ -0,0 +1,210 @@
import 'package:flutter/material.dart';
import 'package:invoiceninja_flutter/constants.dart';
class ColorTheme {
ColorTheme(
{this.colorPrimary,
this.colorSecondary,
this.colorInfo,
this.colorSuccess,
this.colorWarning,
this.colorDanger,
this.colorLightGray = const Color(0xff888888),
this.colorDarkGray = const Color(0xff333333)});
Color colorPrimary;
Color colorSecondary;
Color colorInfo;
Color colorSuccess;
Color colorWarning;
Color colorDanger;
Color colorLightGray;
Color colorDarkGray;
}
Map<String, ColorTheme> colorThemesMap = {
kColorThemeLight: ColorTheme(
colorPrimary: const Color(0xff1266F1),
colorSecondary: const Color(0xffB23CFD),
colorInfo: const Color(0xff39C0ED),
colorSuccess: const Color(0xff00B74A),
colorWarning: const Color(0xffffA900),
colorDanger: const Color(0xffF93154),
),
kColorThemeDark: ColorTheme(
colorPrimary: const Color(0xff1266F1),
colorSecondary: const Color(0xffB23CFD),
colorInfo: const Color(0xff505f73),
colorSuccess: const Color(0xff407535),
colorWarning: const Color(0xffdd5600),
colorDanger: const Color(0xff8b3d40),
),
'cerulean': ColorTheme(
colorPrimary: const Color(0xff2fa4e7),
colorSecondary: const Color(0xffe9ecef),
colorInfo: const Color(0xff033c73),
colorSuccess: const Color(0xff73a839),
colorWarning: const Color(0xffdd5600),
colorDanger: const Color(0xffc71c22),
),
'cosmo': ColorTheme(
colorPrimary: const Color(0xff2780e3),
colorSecondary: const Color(0xff373a3c),
colorInfo: const Color(0xff9954bb),
colorSuccess: const Color(0xff3fb618),
colorWarning: const Color(0xffff7518),
colorDanger: const Color(0xffff0039),
),
'cyborg': ColorTheme(
colorPrimary: const Color(0xff2a9fd6),
colorSecondary: const Color(0xff555555),
colorInfo: const Color(0xff9933cc),
colorSuccess: const Color(0xff77b300),
colorWarning: const Color(0xffff8800),
colorDanger: const Color(0xffcc0000),
),
'darkly': ColorTheme(
colorPrimary: const Color(0xff375a7f),
colorSecondary: const Color(0xff444444),
colorInfo: const Color(0xff3498db),
colorSuccess: const Color(0xff00bc8c),
colorWarning: const Color(0xfff39c12),
colorDanger: const Color(0xffe74c3c),
),
'flatly': ColorTheme(
colorPrimary: const Color(0xff2c3e50),
colorSecondary: const Color(0xff95a5a6),
colorInfo: const Color(0xff3498db),
colorSuccess: const Color(0xff18bc9c),
colorWarning: const Color(0xfff39c12),
colorDanger: const Color(0xffe74c3c),
),
'journal': ColorTheme(
colorPrimary: const Color(0xffeb6864),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff336699),
colorSuccess: const Color(0xff22b24c),
colorWarning: const Color(0xfff5e625),
colorDanger: const Color(0xfff57a00),
),
'litera': ColorTheme(
colorPrimary: const Color(0xff4582ec),
colorSecondary: const Color(0xffadb5bd),
colorInfo: const Color(0xff17a2b8),
colorSuccess: const Color(0xff02b875),
colorWarning: const Color(0xfff0ad4e),
colorDanger: const Color(0xffd9534f),
),
'lumen': ColorTheme(
colorPrimary: const Color(0xff158cba),
colorSecondary: const Color(0xfff0f0f0),
colorInfo: const Color(0xff75caeb),
colorSuccess: const Color(0xff28b62c),
colorWarning: const Color(0xffff851b),
colorDanger: const Color(0xffff4136),
),
'lux': ColorTheme(
colorPrimary: const Color(0xff1a1a1a),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff1f9bcf),
colorSuccess: const Color(0xff4bbf73),
colorWarning: const Color(0xfff0ad4e),
colorDanger: const Color(0xffd9534f),
),
'materia': ColorTheme(
colorPrimary: const Color(0xff2196f3),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff9c27b0),
colorSuccess: const Color(0xff4caf50),
colorWarning: const Color(0xffff9800),
colorDanger: const Color(0xffe51c23),
),
'minty': ColorTheme(
colorPrimary: const Color(0xff78c2ad),
colorSecondary: const Color(0xfff3969a),
colorInfo: const Color(0xff6cc3d5),
colorSuccess: const Color(0xff56cc9d),
colorWarning: const Color(0xffffce67),
colorDanger: const Color(0xffff7851),
),
'pulse': ColorTheme(
colorPrimary: const Color(0xff593196),
colorSecondary: const Color(0xffa991d4),
colorInfo: const Color(0xff009cdc),
colorSuccess: const Color(0xff13b955),
colorWarning: const Color(0xffefa31d),
colorDanger: const Color(0xfffc3939),
),
'sandstone': ColorTheme(
colorPrimary: const Color(0xff325d88),
colorSecondary: const Color(0xff8e8c84),
colorInfo: const Color(0xff29abe0),
colorSuccess: const Color(0xff93c54b),
colorWarning: const Color(0xfff47c3c),
colorDanger: const Color(0xffd9534f),
),
'simplex': ColorTheme(
colorPrimary: const Color(0xffd9230f),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff029acf),
colorSuccess: const Color(0xff469408),
colorWarning: const Color(0xffd9831f),
colorDanger: const Color(0xff9b479f),
),
'sketchy': ColorTheme(
colorPrimary: const Color(0xff333333),
colorSecondary: const Color(0xff555555),
colorInfo: const Color(0xff17a2b8),
colorSuccess: const Color(0xff28a745),
colorWarning: const Color(0xffffc107),
colorDanger: const Color(0xffdc3545),
),
'slate': ColorTheme(
colorPrimary: const Color(0xff3a3f44),
colorSecondary: const Color(0xff7a8288),
colorInfo: const Color(0xff5bc0de),
colorSuccess: const Color(0xff62c462),
colorWarning: const Color(0xfff89406),
colorDanger: const Color(0xffee5f5b),
),
'solar': ColorTheme(
colorPrimary: const Color(0xffb58900),
colorSecondary: const Color(0xff839496),
colorInfo: const Color(0xff268bd2),
colorSuccess: const Color(0xff2aa198),
colorWarning: const Color(0xffcb4b16),
colorDanger: const Color(0xffd33682),
),
'spacelab': ColorTheme(
colorPrimary: const Color(0xff446e9b),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff3399f3),
colorSuccess: const Color(0xff3cb521),
colorWarning: const Color(0xffd47500),
colorDanger: const Color(0xffcd0200),
),
'superhero': ColorTheme(
colorPrimary: const Color(0xffdf691a),
colorSecondary: const Color(0xff4e5d6c),
colorInfo: const Color(0xff5bc0de),
colorSuccess: const Color(0xff5cb85c),
colorWarning: const Color(0xfff0ad4e),
colorDanger: const Color(0xffd9534f),
),
'united': ColorTheme(
colorPrimary: const Color(0xffe95420),
colorSecondary: const Color(0xffaea79f),
colorInfo: const Color(0xff17a2b8),
colorSuccess: const Color(0xff38b44a),
colorWarning: const Color(0xffefb73e),
colorDanger: const Color(0xffdf382c),
),
'yeti': ColorTheme(
colorPrimary: const Color(0xff008cba),
colorSecondary: const Color(0xff888888),
colorInfo: const Color(0xff5bc0de),
colorSuccess: const Color(0xff43ac6a),
colorWarning: const Color(0xffe99002),
colorDanger: const Color(0xfff04124),
),
};

View File

@ -127,6 +127,10 @@ abstract class UserEntity extends Object
@nullable
String get password;
@nullable
@BuiltValueField(wireName: 'email_verified_at')
int get emailVerifiedAt;
@BuiltValueField(wireName: 'custom_value1')
String get customValue1;

View File

@ -203,6 +203,12 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
..add(serializers.serialize(object.password,
specifiedType: const FullType(String)));
}
if (object.emailVerifiedAt != null) {
result
..add('email_verified_at')
..add(serializers.serialize(object.emailVerifiedAt,
specifiedType: const FullType(int)));
}
if (object.userCompany != null) {
result
..add('company_user')
@ -267,6 +273,10 @@ class _$UserEntitySerializer implements StructuredSerializer<UserEntity> {
result.password = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'email_verified_at':
result.emailVerifiedAt = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'custom_value1':
result.customValue1 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
@ -627,6 +637,8 @@ class _$UserEntity extends UserEntity {
@override
final String password;
@override
final int emailVerifiedAt;
@override
final String customValue1;
@override
final String customValue2;
@ -664,6 +676,7 @@ class _$UserEntity extends UserEntity {
this.email,
this.phone,
this.password,
this.emailVerifiedAt,
this.customValue1,
this.customValue2,
this.customValue3,
@ -736,6 +749,7 @@ class _$UserEntity extends UserEntity {
email == other.email &&
phone == other.phone &&
password == other.password &&
emailVerifiedAt == other.emailVerifiedAt &&
customValue1 == other.customValue1 &&
customValue2 == other.customValue2 &&
customValue3 == other.customValue3 &&
@ -773,20 +787,13 @@ class _$UserEntity extends UserEntity {
$jc(
$jc(
$jc(
$jc(
0,
firstName
.hashCode),
lastName
.hashCode),
email
.hashCode),
phone
.hashCode),
password
.hashCode),
customValue1
.hashCode),
$jc($jc(0, firstName.hashCode),
lastName.hashCode),
email.hashCode),
phone.hashCode),
password.hashCode),
emailVerifiedAt.hashCode),
customValue1.hashCode),
customValue2.hashCode),
customValue3.hashCode),
customValue4.hashCode),
@ -810,6 +817,7 @@ class _$UserEntity extends UserEntity {
..add('email', email)
..add('phone', phone)
..add('password', password)
..add('emailVerifiedAt', emailVerifiedAt)
..add('customValue1', customValue1)
..add('customValue2', customValue2)
..add('customValue3', customValue3)
@ -851,6 +859,11 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
String get password => _$this._password;
set password(String password) => _$this._password = password;
int _emailVerifiedAt;
int get emailVerifiedAt => _$this._emailVerifiedAt;
set emailVerifiedAt(int emailVerifiedAt) =>
_$this._emailVerifiedAt = emailVerifiedAt;
String _customValue1;
String get customValue1 => _$this._customValue1;
set customValue1(String customValue1) => _$this._customValue1 = customValue1;
@ -921,6 +934,7 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
_email = _$v.email;
_phone = _$v.phone;
_password = _$v.password;
_emailVerifiedAt = _$v.emailVerifiedAt;
_customValue1 = _$v.customValue1;
_customValue2 = _$v.customValue2;
_customValue3 = _$v.customValue3;
@ -964,6 +978,7 @@ class UserEntityBuilder implements Builder<UserEntity, UserEntityBuilder> {
email: email,
phone: phone,
password: password,
emailVerifiedAt: emailVerifiedAt,
customValue1: customValue1,
customValue2: customValue2,
customValue3: customValue3,

View File

@ -88,7 +88,7 @@ class ClientRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/clients/${entity.id}', credentials.token,
'${credentials.url}/clients/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final ClientItemResponse clientResponse =

View File

@ -106,7 +106,7 @@ class CreditRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/credits/${entity.id}', credentials.token,
'${credentials.url}/credits/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final InvoiceItemResponse invoiceResponse =

View File

@ -81,7 +81,7 @@ class ExpenseRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/expenses/${entity.id}', credentials.token,
'${credentials.url}/expenses/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final ExpenseItemResponse expenseResponse =

View File

@ -77,8 +77,10 @@ class GroupRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/group_settings/${entity.id}', credentials.token,
data: fields, multipartFile: multipartFile);
'${credentials.url}/group_settings/${entity.id}/upload',
credentials.token,
data: fields,
multipartFile: multipartFile);
final GroupItemResponse groupResponse =
serializers.deserializeWith(GroupItemResponse.serializer, response);

View File

@ -107,7 +107,7 @@ class InvoiceRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/invoices/${entity.id}', credentials.token,
'${credentials.url}/invoices/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final InvoiceItemResponse invoiceResponse =

View File

@ -83,7 +83,7 @@ class ProductRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/products/${entity.id}', credentials.token,
'${credentials.url}/products/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final ProductItemResponse productResponse =

View File

@ -81,7 +81,7 @@ class ProjectRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/projects/${entity.id}', credentials.token,
'${credentials.url}/projects/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final ProjectItemResponse projectResponse =

View File

@ -103,7 +103,7 @@ class QuoteRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/quotes/${entity.id}', credentials.token,
'${credentials.url}/quotes/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final InvoiceItemResponse invoiceResponse =

View File

@ -101,7 +101,7 @@ class SettingsRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/companies/${company.id}', credentials.token,
'${credentials.url}/companies/${company.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final CompanyItemResponse companyResponse =

View File

@ -80,7 +80,7 @@ class TaskRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/tasks/${entity.id}', credentials.token,
'${credentials.url}/tasks/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final TaskItemResponse taskResponse =

View File

@ -81,7 +81,7 @@ class VendorRepository {
};
final dynamic response = await webClient.post(
'${credentials.url}/vendors/${entity.id}', credentials.token,
'${credentials.url}/vendors/${entity.id}/upload', credentials.token,
data: fields, multipartFile: multipartFile);
final VendorItemResponse vendorResponse =

10
lib/flutter_version.dart Normal file
View File

@ -0,0 +1,10 @@
const FLUTTER_VERSION = const <String, String>{
'frameworkVersion': '1.26.0-17.2.pre',
'channel': 'dev',
'repositoryUrl': 'git@github.com:flutter/flutter.git',
'frameworkRevision': '79b49b9e1057f90ebf797725233c6b311722de69',
'frameworkCommitDate': '2021-02-03 15:33:39 -0800',
'engineRevision': '2c527d6c7e70e2f51bca1a46f1174b250f84c5da',
'dartSdkVersion': '2.12.0 (build 2.12.0-259.8.beta)',
'flutterRoot': 'C:\\Users\\hillel\\Documents\\flutter'
};

View File

@ -122,6 +122,7 @@ class UpdateUserPreferences implements PersistPrefs {
this.showFilterSidebar,
this.alwaysShowFilterSidebar,
this.rowsPerPage,
this.colorTheme,
});
final AppLayout appLayout;
@ -137,6 +138,7 @@ class UpdateUserPreferences implements PersistPrefs {
final bool alwaysShowFilterSidebar;
final String accentColor;
final int rowsPerPage;
final String colorTheme;
}
class LoadAccountSuccess implements StopLoading {
@ -1379,6 +1381,7 @@ void selectEntity({
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final uiState = state.uiState;
final entityUIState = state.getUIState(entity.entityType);
final isInMultiselect =
state.getListState(entity.entityType).isInMultiselect();
@ -1402,9 +1405,13 @@ void selectEntity({
!forceView &&
uiState.isViewing &&
!entity.entityType.isSetting &&
(state.getUIState(entity.entityType).selectedId == entity.id &&
state.prefState.isPreviewVisible)) {
editEntity(context: context, entity: entity);
entityUIState.selectedId == entity.id &&
state.prefState.isPreviewVisible) {
if (entityUIState.tabIndex > 0) {
store.dispatch(PreviewEntity());
} else {
editEntity(context: context, entity: entity);
}
} else {
ClientEntity client;
if (forceView && entity is BelongsToClient) {

View File

@ -44,6 +44,7 @@ import 'package:invoiceninja_flutter/redux/vendor/vendor_state.dart';
import 'package:invoiceninja_flutter/ui/app/screen_imports.dart';
import 'package:invoiceninja_flutter/ui/client/edit/client_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/company_gateway/edit/company_gateway_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/credit/credit_screen.dart';
import 'package:invoiceninja_flutter/ui/credit/edit/credit_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/design/edit/design_edit_vm.dart';
import 'package:invoiceninja_flutter/ui/group/edit/group_edit_vm.dart';
@ -51,6 +52,7 @@ import 'package:invoiceninja_flutter/ui/product/edit/product_edit_vm.dart';
// STARTER: import - do not remove comment
import 'package:invoiceninja_flutter/redux/task_status/task_status_state.dart';
import 'package:invoiceninja_flutter/ui/recurring_invoice/recurring_invoice_screen.dart';
import 'package:invoiceninja_flutter/ui/task_status/edit/task_status_edit_vm.dart';
import 'package:invoiceninja_flutter/redux/task_status/task_status_selectors.dart';
@ -385,6 +387,16 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
}
}
SelectionState getUISelection(EntityType type) {
final entityUIState = getUIState(type);
return SelectionState(
selectedId: entityUIState.selectedId,
filterEntityId: uiState.filterEntityId,
filterEntityType: uiState.filterEntityType,
);
}
EntityUIState getUIState(EntityType type) {
switch (type) {
case EntityType.product:
@ -712,6 +724,39 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
uiState.filterEntityType != null) ||
prefState.isMenuCollapsed;
bool get isFullScreen {
bool isFullScreen = false;
final mainRoute = '/' + uiState.mainRoute;
final subRoute = uiState.subRoute;
final isEdit = subRoute == 'edit';
final isEmail = subRoute == 'email';
final isPdf = subRoute == 'pdf';
if (<String>[
InvoiceScreen.route,
QuoteScreen.route,
CreditScreen.route,
RecurringInvoiceScreen.route,
TaskScreen.route,
].contains(mainRoute)) {
if (isEmail || isPdf) {
isFullScreen = true;
} else if (isEdit) {
if (mainRoute == TaskScreen.route) {
isFullScreen = prefState.isEditorFullScreen(EntityType.task);
} else {
isFullScreen = prefState.isEditorFullScreen(EntityType.invoice);
}
}
}
if (DesignEditScreen.route == uiState.currentRoute) {
isFullScreen = true;
}
return isFullScreen;
}
@override
String toString() {
final companyUpdated = userCompanyState.lastUpdated == null ||
@ -761,8 +806,17 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
}
class Credentials {
Credentials({this.url, this.token});
const Credentials({this.url, this.token});
String url;
String token;
final String url;
final String token;
}
class SelectionState {
const SelectionState(
{this.selectedId, this.filterEntityId, this.filterEntityType});
final String selectedId;
final String filterEntityId;
final EntityType filterEntityType;
}

View File

@ -78,7 +78,7 @@ Middleware<AppState> _createLoginRequest(AuthRepository repository) {
store.dispatch(
LoadAccountSuccess(completer: action.completer, loginResponse: data));
}).catchError((Object error) {
print('Login error: $error');
print('## Login error: $error');
final message = _parseError('$error');
if (action.completer != null) {
action.completer.completeError(message);
@ -108,7 +108,7 @@ Middleware<AppState> _createSignUpRequest(AuthRepository repository) {
store.dispatch(
LoadAccountSuccess(completer: action.completer, loginResponse: data));
}).catchError((Object error) {
print('Signup error: $error');
print('## Signup error: $error');
final message = _parseError('$error');
if (action.completer != null) {
action.completer.completeError(message);
@ -141,7 +141,7 @@ Middleware<AppState> _createOAuthLoginRequest(AuthRepository repository) {
store.dispatch(
LoadAccountSuccess(completer: action.completer, loginResponse: data));
}).catchError((Object error) {
print('Oauth login error: $error');
print('## Oauth login error: $error');
final message = _parseError('$error');
if (action.completer != null) {
action.completer.completeError(message);
@ -172,7 +172,7 @@ Middleware<AppState> _createOAuthSignUpRequest(AuthRepository repository) {
store.dispatch(
LoadAccountSuccess(completer: action.completer, loginResponse: data));
}).catchError((Object error) {
print('OAuth signup error: $error');
print('## OAuth signup error: $error');
final message = _parseError('$error');
if (action.completer != null) {
action.completer.completeError(message);
@ -198,11 +198,11 @@ Middleware<AppState> _createRefreshRequest(AuthRepository repository) {
//
} else {
if (state.isSaving || state.isLoading) {
print('Skipping refresh request - pending request');
print('## Skipping refresh request - pending request');
next(action);
return;
} else if (state.company.isLarge && !state.isLoaded) {
print('Skipping refresh request - not loaded');
print('## Skipping refresh request - not loaded');
next(action);
return;
}
@ -244,10 +244,10 @@ Middleware<AppState> _createRefreshRequest(AuthRepository repository) {
});
});
if (false && permissionsWereChanged) {
print('## Permissions were changed');
if (permissionsWereChanged) {
store.dispatch(ClearData());
store.dispatch(RefreshData(completer: action.completer));
store.dispatch(
RefreshData(completer: action.completer, clearData: true));
} else {
if (action.clearData && !company.isLarge) {
store.dispatch(ClearData());

View File

@ -455,3 +455,9 @@ class SaveClientDocumentFailure implements StopSaving {
final Object error;
}
class UpdateClientTab implements PersistUI {
UpdateClientTab({this.tabIndex});
final int tabIndex;
}

View File

@ -17,10 +17,20 @@ EntityUIState clientUIReducer(ClientUIState state, dynamic action) {
..editingContact
.replace(editingContactReducer(state.editingContact, action))
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateClientTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final saveCompleterReducer = combineReducers<Completer<SelectableEntity>>([
TypedReducer<Completer<SelectableEntity>, EditClient>((completer, action) {
return action.completer;

View File

@ -59,6 +59,7 @@ abstract class ClientUIState extends Object
editing: ClientEntity(),
editingContact: ContactEntity(),
saveCompleter: null,
tabIndex: 0,
);
}

View File

@ -77,6 +77,9 @@ class _$ClientUIStateSerializer implements StructuredSerializer<ClientUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -127,6 +130,10 @@ class _$ClientUIStateSerializer implements StructuredSerializer<ClientUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -250,6 +257,8 @@ class _$ClientUIState extends ClientUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -262,12 +271,16 @@ class _$ClientUIState extends ClientUIState {
this.editingContact,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('ClientUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('ClientUIState', 'tabIndex');
}
}
@override
@ -285,6 +298,7 @@ class _$ClientUIState extends ClientUIState {
editingContact == other.editingContact &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -295,9 +309,11 @@ class _$ClientUIState extends ClientUIState {
return __hashCode ??= $jf($jc(
$jc(
$jc(
$jc($jc($jc(0, editing.hashCode), editingContact.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), editingContact.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -309,6 +325,7 @@ class _$ClientUIState extends ClientUIState {
..add('editingContact', editingContact)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -340,6 +357,10 @@ class ClientUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -358,6 +379,7 @@ class ClientUIStateBuilder
_editingContact = _$v.editingContact?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -388,6 +410,7 @@ class ClientUIStateBuilder
editingContact: _editingContact?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -46,6 +46,7 @@ abstract class CompanyGatewayUIState extends Object
listUIState: ListUIState(CompanyGatewayFields.name),
editing: CompanyGatewayEntity(),
selectedId: '',
tabIndex: 0,
);
}
CompanyGatewayUIState._();

View File

@ -91,6 +91,9 @@ class _$CompanyGatewayUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -132,6 +135,10 @@ class _$CompanyGatewayUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -259,6 +266,8 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -271,6 +280,7 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
@ -278,6 +288,9 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
throw new BuiltValueNullFieldError(
'CompanyGatewayUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('CompanyGatewayUIState', 'tabIndex');
}
}
@override
@ -296,6 +309,7 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -305,8 +319,10 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -317,6 +333,7 @@ class _$CompanyGatewayUIState extends CompanyGatewayUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -342,6 +359,10 @@ class CompanyGatewayUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -359,6 +380,7 @@ class CompanyGatewayUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -388,6 +410,7 @@ class CompanyGatewayUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -442,7 +442,7 @@ Future handleCreditAction(
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(
@ -564,3 +564,9 @@ class RemoveFromCreditMultiselect {
}
class ClearCreditMultiselect {}
class UpdateCreditTab implements PersistUI {
UpdateCreditTab({this.tabIndex});
final int tabIndex;
}

View File

@ -15,10 +15,20 @@ EntityUIState creditUIReducer(CreditUIState state, dynamic action) {
..editing.replace(editingReducer(state.editing, action))
..editingItemIndex = editingItemReducer(state.editingItemIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..historyActivityId =
historyActivityIdReducer(state.historyActivityId, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateCreditTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final historyActivityIdReducer = combineReducers<String>([
TypedReducer<String, ShowPdfCredit>((index, action) => action.activityId),
]);

View File

@ -58,6 +58,7 @@ abstract class CreditUIState extends Object
listUIState: ListUIState(CreditFields.number, sortAscending: false),
editing: InvoiceEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -77,6 +77,9 @@ class _$CreditUIStateSerializer implements StructuredSerializer<CreditUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -117,6 +120,10 @@ class _$CreditUIStateSerializer implements StructuredSerializer<CreditUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -242,6 +249,8 @@ class _$CreditUIState extends CreditUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -255,12 +264,16 @@ class _$CreditUIState extends CreditUIState {
this.historyActivityId,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('CreditUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('CreditUIState', 'tabIndex');
}
}
@override
@ -279,6 +292,7 @@ class _$CreditUIState extends CreditUIState {
historyActivityId == other.historyActivityId &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -291,11 +305,13 @@ class _$CreditUIState extends CreditUIState {
$jc(
$jc(
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -308,6 +324,7 @@ class _$CreditUIState extends CreditUIState {
..add('historyActivityId', historyActivityId)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -343,6 +360,10 @@ class CreditUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -362,6 +383,7 @@ class CreditUIStateBuilder
_historyActivityId = _$v.historyActivityId;
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -393,6 +415,7 @@ class CreditUIStateBuilder
historyActivityId: historyActivityId,
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -60,6 +60,7 @@ abstract class DesignUIState extends Object
listUIState: ListUIState(DesignFields.name),
editing: DesignEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -77,6 +77,9 @@ class _$DesignUIStateSerializer implements StructuredSerializer<DesignUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -117,6 +120,10 @@ class _$DesignUIStateSerializer implements StructuredSerializer<DesignUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -238,6 +245,8 @@ class _$DesignUIState extends DesignUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -249,12 +258,16 @@ class _$DesignUIState extends DesignUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('DesignUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('DesignUIState', 'tabIndex');
}
}
@override
@ -271,6 +284,7 @@ class _$DesignUIState extends DesignUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -280,8 +294,10 @@ class _$DesignUIState extends DesignUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -292,6 +308,7 @@ class _$DesignUIState extends DesignUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -317,6 +334,10 @@ class DesignUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -334,6 +355,7 @@ class DesignUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -363,6 +385,7 @@ class DesignUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -38,6 +38,7 @@ abstract class DocumentUIState extends Object
listUIState: ListUIState(DocumentFields.name),
editing: DocumentEntity(),
selectedId: '',
tabIndex: 0,
);
}
DocumentUIState._();

View File

@ -80,6 +80,9 @@ class _$DocumentUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -120,6 +123,10 @@ class _$DocumentUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -242,6 +249,8 @@ class _$DocumentUIState extends DocumentUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -253,12 +262,16 @@ class _$DocumentUIState extends DocumentUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('DocumentUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('DocumentUIState', 'tabIndex');
}
}
@override
@ -276,6 +289,7 @@ class _$DocumentUIState extends DocumentUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -285,8 +299,10 @@ class _$DocumentUIState extends DocumentUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -297,6 +313,7 @@ class _$DocumentUIState extends DocumentUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -322,6 +339,10 @@ class DocumentUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -339,6 +360,7 @@ class DocumentUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -368,6 +390,7 @@ class DocumentUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -377,3 +377,9 @@ class SaveExpenseDocumentFailure implements StopSaving {
final Object error;
}
class UpdateExpenseTab implements PersistUI {
UpdateExpenseTab({this.tabIndex});
final int tabIndex;
}

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/document/document_actions.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:redux/redux.dart';
import 'package:invoiceninja_flutter/data/models/models.dart';

View File

@ -12,9 +12,19 @@ EntityUIState expenseUIReducer(ExpenseUIState state, dynamic action) {
return state.rebuild((b) => b
..listUIState.replace(expenseListReducer(state.listUIState, action))
..editing.replace(editingReducer(state.editing, action))
..selectedId = selectedIdReducer(state.selectedId, action));
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateExpenseTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, PreviewEntity>((selectedId, action) =>
action.entityType == EntityType.expense ? action.entityId : selectedId),

View File

@ -19,12 +19,15 @@ InvoiceItemEntity convertExpenseToInvoiceItem({
..cost = company.settings.enableInclusiveTaxes
? expense.convertedAmount
: expense.convertedNetAmount
..taxName1 = expense.taxName1
..taxRate1 = expense.calculatetaxRate1
..taxName2 = expense.taxName2
..taxRate2 = expense.calculatetaxRate2
..taxName3 = expense.taxName3
..taxRate3 = expense.calculatetaxRate3);
..taxName1 = company.numberOfItemTaxRates >= 1 ? expense.taxName1 : ''
..taxRate1 =
company.numberOfItemTaxRates >= 1 ? expense.calculatetaxRate1 : 0
..taxName2 = company.numberOfItemTaxRates >= 2 ? expense.taxName2 : ''
..taxRate2 =
company.numberOfItemTaxRates >= 2 ? expense.calculatetaxRate2 : 0
..taxName3 = company.numberOfItemTaxRates >= 3 ? expense.taxName3 : ''
..taxRate3 =
company.numberOfItemTaxRates >= 3 ? expense.calculatetaxRate3 : 0);
}
var memoizedDropdownExpenseList = memo9(

View File

@ -58,6 +58,7 @@ abstract class ExpenseUIState extends Object
listUIState: ListUIState(ExpenseFields.number, sortAscending: false),
editing: ExpenseEntity(),
selectedId: '',
tabIndex: 0,
);
}
ExpenseUIState._();

View File

@ -79,6 +79,9 @@ class _$ExpenseUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$ExpenseUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$ExpenseUIState extends ExpenseUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -252,12 +261,16 @@ class _$ExpenseUIState extends ExpenseUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('ExpenseUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('ExpenseUIState', 'tabIndex');
}
}
@override
@ -275,6 +288,7 @@ class _$ExpenseUIState extends ExpenseUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -284,8 +298,10 @@ class _$ExpenseUIState extends ExpenseUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -296,6 +312,7 @@ class _$ExpenseUIState extends ExpenseUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -321,6 +338,10 @@ class ExpenseUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -338,6 +359,7 @@ class ExpenseUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -367,6 +389,7 @@ class ExpenseUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -59,6 +59,7 @@ abstract class ExpenseCategoryUIState extends Object
listUIState: ListUIState(ExpenseCategoryFields.name),
editing: ExpenseCategoryEntity(),
selectedId: '',
tabIndex: 0,
);
}
ExpenseCategoryUIState._();

View File

@ -91,6 +91,9 @@ class _$ExpenseCategoryUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -132,6 +135,10 @@ class _$ExpenseCategoryUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -259,6 +266,8 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -271,6 +280,7 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
@ -278,6 +288,9 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
throw new BuiltValueNullFieldError(
'ExpenseCategoryUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('ExpenseCategoryUIState', 'tabIndex');
}
}
@override
@ -296,6 +309,7 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -305,8 +319,10 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -317,6 +333,7 @@ class _$ExpenseCategoryUIState extends ExpenseCategoryUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -343,6 +360,10 @@ class ExpenseCategoryUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -360,6 +381,7 @@ class ExpenseCategoryUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -389,6 +411,7 @@ class ExpenseCategoryUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -44,6 +44,7 @@ abstract class GroupUIState extends Object
listUIState: ListUIState(GroupFields.name),
editing: GroupEntity(),
selectedId: '',
tabIndex: 0,
);
}
GroupUIState._();

View File

@ -77,6 +77,9 @@ class _$GroupUIStateSerializer implements StructuredSerializer<GroupUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -116,6 +119,10 @@ class _$GroupUIStateSerializer implements StructuredSerializer<GroupUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -237,6 +244,8 @@ class _$GroupUIState extends GroupUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -248,12 +257,16 @@ class _$GroupUIState extends GroupUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('GroupUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('GroupUIState', 'tabIndex');
}
}
@override
@ -270,6 +283,7 @@ class _$GroupUIState extends GroupUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -279,8 +293,10 @@ class _$GroupUIState extends GroupUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -291,6 +307,7 @@ class _$GroupUIState extends GroupUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -316,6 +333,10 @@ class GroupUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -333,6 +354,7 @@ class GroupUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -362,6 +384,7 @@ class GroupUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -474,6 +474,12 @@ class SaveInvoiceDocumentFailure implements StopSaving {
final Object error;
}
class UpdateInvoiceTab implements PersistUI {
UpdateInvoiceTab({this.tabIndex});
final int tabIndex;
}
void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
EntityAction action) async {
if (invoices.isEmpty) {
@ -548,7 +554,7 @@ void handleInvoiceAction(BuildContext context, List<BaseEntity> invoices,
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(

View File

@ -3,7 +3,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/invoice/invoice_actions.dart';
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
import 'package:invoiceninja_flutter/redux/recurring_invoice/recurring_invoice_actions.dart';
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
import 'package:invoiceninja_flutter/ui/invoice/invoice_email_vm.dart';
import 'package:invoiceninja_flutter/ui/invoice/edit/invoice_edit_vm.dart';

View File

@ -16,10 +16,20 @@ EntityUIState invoiceUIReducer(InvoiceUIState state, dynamic action) {
..editing.replace(editingReducer(state.editing, action))
..editingItemIndex = editingItemIndexReducer(state.editingItemIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..historyActivityId =
historyActivityIdReducer(state.historyActivityId, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateInvoiceTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final historyActivityIdReducer = combineReducers<String>([
TypedReducer<String, ShowPdfInvoice>((index, action) => action.activityId),
]);

View File

@ -58,8 +58,7 @@ List<String> dropdownInvoiceSelector(
return list;
}
var memoizedFilteredInvoiceList = memo9((String filterEntityId,
EntityType filterEntityType,
var memoizedFilteredInvoiceList = memo8((SelectionState selectionState,
BuiltMap<String, InvoiceEntity> invoiceMap,
BuiltList<String> invoiceList,
BuiltMap<String, ClientEntity> clientMap,
@ -67,20 +66,11 @@ var memoizedFilteredInvoiceList = memo9((String filterEntityId,
ListUIState invoiceListState,
StaticState staticState,
BuiltMap<String, UserEntity> userMap) =>
filteredInvoicesSelector(
filterEntityId,
filterEntityType,
invoiceMap,
invoiceList,
clientMap,
paymentMap,
invoiceListState,
staticState,
userMap));
filteredInvoicesSelector(selectionState, invoiceMap, invoiceList, clientMap,
paymentMap, invoiceListState, staticState, userMap));
List<String> filteredInvoicesSelector(
String filterEntityId,
EntityType filterEntityType,
SelectionState selectionState,
BuiltMap<String, InvoiceEntity> invoiceMap,
BuiltList<String> invoiceList,
BuiltMap<String, ClientEntity> clientMap,
@ -88,8 +78,10 @@ List<String> filteredInvoicesSelector(
ListUIState invoiceListState,
StaticState staticState,
BuiltMap<String, UserEntity> userMap) {
final Map<String, List<String>> invoicePaymentMap = {};
final filterEntityId = selectionState.filterEntityId;
final filterEntityType = selectionState.filterEntityType;
final Map<String, List<String>> invoicePaymentMap = {};
if (filterEntityType == EntityType.payment) {
paymentMap.forEach((paymentId, payment) {
payment.invoicePaymentables.forEach((invoicePaymentable) {
@ -106,6 +98,10 @@ List<String> filteredInvoicesSelector(
final client =
clientMap[invoice.clientId] ?? ClientEntity(id: invoice.clientId);
if (invoice.id == selectionState.selectedId) {
return true;
}
if (!client.isActive &&
!client.matchesEntityFilter(filterEntityType, filterEntityId)) {
return false;

View File

@ -59,6 +59,7 @@ abstract class InvoiceUIState extends Object
listUIState: ListUIState(InvoiceFields.number, sortAscending: false),
editing: InvoiceEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -79,6 +79,9 @@ class _$InvoiceUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$InvoiceUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -245,6 +252,8 @@ class _$InvoiceUIState extends InvoiceUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -258,12 +267,16 @@ class _$InvoiceUIState extends InvoiceUIState {
this.historyActivityId,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('InvoiceUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('InvoiceUIState', 'tabIndex');
}
}
@override
@ -283,6 +296,7 @@ class _$InvoiceUIState extends InvoiceUIState {
historyActivityId == other.historyActivityId &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -295,11 +309,13 @@ class _$InvoiceUIState extends InvoiceUIState {
$jc(
$jc(
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -312,6 +328,7 @@ class _$InvoiceUIState extends InvoiceUIState {
..add('historyActivityId', historyActivityId)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -347,6 +364,10 @@ class InvoiceUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -366,6 +387,7 @@ class InvoiceUIStateBuilder
_historyActivityId = _$v.historyActivityId;
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -397,6 +419,7 @@ class InvoiceUIStateBuilder
historyActivityId: historyActivityId,
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -313,6 +313,12 @@ class RemoveFromPaymentMultiselect {
class ClearPaymentMultiselect {}
class UpdatePaymentTab implements PersistUI {
UpdatePaymentTab({this.tabIndex});
final int tabIndex;
}
void handlePaymentAction(
BuildContext context, List<BaseEntity> payments, EntityAction action) {
if (payments.isEmpty) {

View File

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
import 'package:invoiceninja_flutter/redux/recurring_invoice/recurring_invoice_actions.dart';
import 'package:invoiceninja_flutter/ui/payment/refund/payment_refund_vm.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';

View File

@ -12,9 +12,19 @@ EntityUIState paymentUIReducer(PaymentUIState state, dynamic action) {
return state.rebuild((b) => b
..listUIState.replace(paymentListReducer(state.listUIState, action))
..editing.replace(editingReducer(state.editing, action))
..selectedId = selectedIdReducer(state.selectedId, action));
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdatePaymentTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
Reducer<String> selectedIdReducer = combineReducers([
TypedReducer<String, PreviewEntity>((selectedId, action) =>
action.entityType == EntityType.payment ? action.entityId : selectedId),

View File

@ -60,6 +60,7 @@ abstract class PaymentUIState extends Object
listUIState: ListUIState(PaymentFields.number, sortAscending: false),
editing: PaymentEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -79,6 +79,9 @@ class _$PaymentUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$PaymentUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$PaymentUIState extends PaymentUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -252,12 +261,16 @@ class _$PaymentUIState extends PaymentUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('PaymentUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('PaymentUIState', 'tabIndex');
}
}
@override
@ -275,6 +288,7 @@ class _$PaymentUIState extends PaymentUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -284,8 +298,10 @@ class _$PaymentUIState extends PaymentUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -296,6 +312,7 @@ class _$PaymentUIState extends PaymentUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -321,6 +338,10 @@ class PaymentUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -338,6 +359,7 @@ class PaymentUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -367,6 +389,7 @@ class PaymentUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -50,6 +50,7 @@ abstract class PaymentTermUIState extends Object
listUIState: ListUIState(PaymentTermFields.name),
editing: PaymentTermEntity(),
selectedId: '',
tabIndex: 0,
);
}
PaymentTermUIState._();

View File

@ -83,6 +83,9 @@ class _$PaymentTermUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -124,6 +127,10 @@ class _$PaymentTermUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -248,6 +255,8 @@ class _$PaymentTermUIState extends PaymentTermUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -260,12 +269,16 @@ class _$PaymentTermUIState extends PaymentTermUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('PaymentTermUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('PaymentTermUIState', 'tabIndex');
}
}
@override
@ -284,6 +297,7 @@ class _$PaymentTermUIState extends PaymentTermUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -293,8 +307,10 @@ class _$PaymentTermUIState extends PaymentTermUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -305,6 +321,7 @@ class _$PaymentTermUIState extends PaymentTermUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -330,6 +347,10 @@ class PaymentTermUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -347,6 +368,7 @@ class PaymentTermUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -376,6 +398,7 @@ class PaymentTermUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -370,3 +370,15 @@ class SaveProductDocumentFailure implements StopSaving {
final Object error;
}
class UpdateProductTab implements PersistUI {
UpdateProductTab({this.tabIndex});
final int tabIndex;
}
class UpdateClientTab implements PersistUI {
UpdateClientTab({this.tabIndex});
final int tabIndex;
}

View File

@ -13,9 +13,19 @@ EntityUIState productUIReducer(ProductUIState state, dynamic action) {
return state.rebuild((b) => b
..listUIState.replace(productListReducer(state.listUIState, action))
..editing.replace(editingReducer(state.editing, action))
..tabIndex = tabIndexReducer(state.tabIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateProductTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
Reducer<String> dropdownFilterReducer = combineReducers([
TypedReducer<String, FilterProductDropdown>(filterProductDropdownReducer),
]);

View File

@ -31,10 +31,12 @@ InvoiceItemEntity convertProductToInvoiceItem({
: null
..customValue1 = product.customValue1
..customValue2 = product.customValue2
..taxName1 = product.taxName1
..taxRate1 = product.taxRate1
..taxName2 = product.taxName2
..taxRate2 = product.taxRate2);
..taxName1 = company.numberOfItemTaxRates >= 1 ? product.taxName1 : ''
..taxRate1 = company.numberOfItemTaxRates >= 1 ? product.taxRate1 : 0
..taxName2 = company.numberOfItemTaxRates >= 2 ? product.taxName2 : ''
..taxRate2 = company.numberOfItemTaxRates >= 2 ? product.taxRate2 : 0
..taxName3 = company.numberOfItemTaxRates >= 3 ? product.taxName3 : ''
..taxRate3 = company.numberOfItemTaxRates >= 3 ? product.taxRate3 : 0);
} else {
return InvoiceItemEntity(
productKey: product.productKey,

View File

@ -49,6 +49,7 @@ abstract class ProductUIState extends Object
listUIState: ListUIState(ProductFields.productKey),
editing: ProductEntity(),
selectedId: '',
tabIndex: 0,
);
}
ProductUIState._();

View File

@ -79,6 +79,9 @@ class _$ProductUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$ProductUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$ProductUIState extends ProductUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -252,12 +261,16 @@ class _$ProductUIState extends ProductUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('ProductUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('ProductUIState', 'tabIndex');
}
}
@override
@ -275,6 +288,7 @@ class _$ProductUIState extends ProductUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -284,8 +298,10 @@ class _$ProductUIState extends ProductUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -296,6 +312,7 @@ class _$ProductUIState extends ProductUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -321,6 +338,10 @@ class ProductUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -338,6 +359,7 @@ class ProductUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -367,6 +389,7 @@ class ProductUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -281,7 +281,7 @@ void handleProjectAction(
..projectId = project.id
..clientId = project.clientId));
break;
case EntityAction.newInvoice:
case EntityAction.invoiceProject:
final items =
convertProjectToInvoiceItem(project: project, context: context);
createEntity(
@ -388,3 +388,9 @@ class SaveProjectDocumentFailure implements StopSaving {
final Object error;
}
class UpdateProjectTab implements PersistUI {
UpdateProjectTab({this.tabIndex});
final int tabIndex;
}

View File

@ -15,10 +15,20 @@ EntityUIState projectUIReducer(ProjectUIState state, dynamic action) {
..listUIState.replace(projectListReducer(state.listUIState, action))
..editing.replace(editingReducer(state.editing, action))
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateProjectTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final saveCompleterReducer = combineReducers<Completer<SelectableEntity>>([
TypedReducer<Completer<SelectableEntity>, EditProject>((completer, action) {
return action.completer;

View File

@ -12,7 +12,10 @@ List<InvoiceItemEntity> convertProjectToInvoiceItem(
final List<InvoiceItemEntity> items = [];
final state = StoreProvider.of<AppState>(context).state;
state.taskState.map.forEach((index, task) {
if (task.isStopped && !task.isInvoiced && task.projectId == project.id) {
if (task.isActive &&
task.isStopped &&
!task.isInvoiced &&
task.projectId == project.id) {
final item = convertTaskToInvoiceItem(task: task, context: context);
items.add(item);
}

View File

@ -59,6 +59,7 @@ abstract class ProjectUIState extends Object
listUIState: ListUIState(ProjectFields.number, sortAscending: false),
editing: ProjectEntity(),
selectedId: '',
tabIndex: 0,
);
}
ProjectUIState._();

View File

@ -79,6 +79,9 @@ class _$ProjectUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$ProjectUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$ProjectUIState extends ProjectUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -252,12 +261,16 @@ class _$ProjectUIState extends ProjectUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('ProjectUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('ProjectUIState', 'tabIndex');
}
}
@override
@ -275,6 +288,7 @@ class _$ProjectUIState extends ProjectUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -284,8 +298,10 @@ class _$ProjectUIState extends ProjectUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -296,6 +312,7 @@ class _$ProjectUIState extends ProjectUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -321,6 +338,10 @@ class ProjectUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -338,6 +359,7 @@ class ProjectUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -367,6 +389,7 @@ class ProjectUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -466,7 +466,7 @@ Future handleQuoteAction(
context: context,
message: localization.clientEmailNotSet,
secondaryActions: [
FlatButton(
TextButton(
onPressed: () {
Navigator.of(context).pop();
editEntity(
@ -577,3 +577,9 @@ class RemoveFromQuoteMultiselect {
}
class ClearQuoteMultiselect {}
class UpdateQuoteTab implements PersistUI {
UpdateQuoteTab({this.tabIndex});
final int tabIndex;
}

View File

@ -16,10 +16,20 @@ EntityUIState quoteUIReducer(QuoteUIState state, dynamic action) {
..editing.replace(editingReducer(state.editing, action))
..editingItemIndex = editingItemReducer(state.editingItemIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..historyActivityId =
historyActivityIdReducer(state.historyActivityId, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateQuoteTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final historyActivityIdReducer = combineReducers<String>([
TypedReducer<String, ShowPdfQuote>((index, action) => action.activityId),
]);

View File

@ -60,6 +60,7 @@ abstract class QuoteUIState extends Object
listUIState: ListUIState(QuoteFields.number, sortAscending: false),
editing: InvoiceEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -77,6 +77,9 @@ class _$QuoteUIStateSerializer implements StructuredSerializer<QuoteUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -116,6 +119,10 @@ class _$QuoteUIStateSerializer implements StructuredSerializer<QuoteUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$QuoteUIState extends QuoteUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -254,12 +263,16 @@ class _$QuoteUIState extends QuoteUIState {
this.historyActivityId,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('QuoteUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('QuoteUIState', 'tabIndex');
}
}
@override
@ -278,6 +291,7 @@ class _$QuoteUIState extends QuoteUIState {
historyActivityId == other.historyActivityId &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -290,11 +304,13 @@ class _$QuoteUIState extends QuoteUIState {
$jc(
$jc(
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -307,6 +323,7 @@ class _$QuoteUIState extends QuoteUIState {
..add('historyActivityId', historyActivityId)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -342,6 +359,10 @@ class QuoteUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -361,6 +382,7 @@ class QuoteUIStateBuilder
_historyActivityId = _$v.historyActivityId;
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -392,6 +414,7 @@ class QuoteUIStateBuilder
historyActivityId: historyActivityId,
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -556,3 +556,9 @@ class RemoveFromRecurringInvoiceMultiselect {
class ClearRecurringInvoiceMultiselect {
ClearRecurringInvoiceMultiselect();
}
class UpdateRecurringInvoiceTab implements PersistUI {
UpdateRecurringInvoiceTab({this.tabIndex});
final int tabIndex;
}

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:invoiceninja_flutter/redux/payment/payment_actions.dart';
import 'package:invoiceninja_flutter/redux/quote/quote_actions.dart';
import 'package:invoiceninja_flutter/ui/recurring_invoice/recurring_invoice_pdf_vm.dart';
import 'package:redux/redux.dart';

View File

@ -17,10 +17,20 @@ EntityUIState recurringInvoiceUIReducer(
..editing.replace(editingReducer(state.editing, action))
..editingItemIndex = editingItemIndexReducer(state.editingItemIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action)
..historyActivityId =
historyActivityIdReducer(state.historyActivityId, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateRecurringInvoiceTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final historyActivityIdReducer = combineReducers<String>([
TypedReducer<String, ShowPdfRecurringInvoice>(
(index, action) => action.activityId),

View File

@ -61,6 +61,7 @@ abstract class RecurringInvoiceUIState extends Object
listUIState: ListUIState(InvoiceFields.number),
editing: InvoiceEntity(),
selectedId: '',
tabIndex: 0,
);
}

View File

@ -89,6 +89,9 @@ class _$RecurringInvoiceUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -129,6 +132,10 @@ class _$RecurringInvoiceUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -260,6 +267,8 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -274,6 +283,7 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
this.historyActivityId,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
@ -281,6 +291,9 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
throw new BuiltValueNullFieldError(
'RecurringInvoiceUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('RecurringInvoiceUIState', 'tabIndex');
}
}
@override
@ -301,6 +314,7 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
historyActivityId == other.historyActivityId &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -313,11 +327,13 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
$jc(
$jc(
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc(0, editing.hashCode),
editingItemIndex.hashCode),
historyActivityId.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -330,6 +346,7 @@ class _$RecurringInvoiceUIState extends RecurringInvoiceUIState {
..add('historyActivityId', historyActivityId)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -366,6 +383,10 @@ class RecurringInvoiceUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -385,6 +406,7 @@ class RecurringInvoiceUIStateBuilder
_historyActivityId = _$v.historyActivityId;
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -416,6 +438,7 @@ class RecurringInvoiceUIStateBuilder
historyActivityId: historyActivityId,
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -430,3 +430,9 @@ class SaveTaskDocumentFailure implements StopSaving {
final Object error;
}
class UpdateTaskTab implements PersistUI {
UpdateTaskTab({this.tabIndex});
final int tabIndex;
}

View File

@ -13,9 +13,19 @@ EntityUIState taskUIReducer(TaskUIState state, dynamic action) {
..listUIState.replace(taskListReducer(state.listUIState, action))
..editing.replace(editingReducer(state.editing, action))
..editingTimeIndex = editingTimeReducer(state.editingTimeIndex, action)
..selectedId = selectedIdReducer(state.selectedId, action));
..selectedId = selectedIdReducer(state.selectedId, action)
..tabIndex = tabIndexReducer(state.tabIndex, action));
}
final tabIndexReducer = combineReducers<int>([
TypedReducer<int, UpdateTaskTab>((completer, action) {
return action.tabIndex;
}),
TypedReducer<int, PreviewEntity>((completer, action) {
return 0;
}),
]);
final editingTimeReducer = combineReducers<int>([
TypedReducer<int, EditTask>((index, action) => action.taskTimeIndex),
TypedReducer<int, EditTaskTime>((index, action) => action.taskTimeIndex),

View File

@ -163,6 +163,9 @@ List<String> filteredTasksSelector(
} else if (filterEntityType == EntityType.user &&
task.assignedUserId != filterEntityId) {
return false;
} else if (filterEntityType == EntityType.taskStatus &&
task.statusId != filterEntityId) {
return false;
}
} else if (task.clientId != null && !client.isActive) {
return false;

View File

@ -57,6 +57,7 @@ abstract class TaskUIState extends Object
listUIState: ListUIState(TaskFields.number, sortAscending: false),
editing: TaskEntity(),
selectedId: '',
tabIndex: 0,
);
}
TaskUIState._();

View File

@ -74,6 +74,9 @@ class _$TaskUIStateSerializer implements StructuredSerializer<TaskUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -113,6 +116,10 @@ class _$TaskUIStateSerializer implements StructuredSerializer<TaskUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -235,6 +242,8 @@ class _$TaskUIState extends TaskUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -247,12 +256,16 @@ class _$TaskUIState extends TaskUIState {
this.editingTimeIndex,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('TaskUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('TaskUIState', 'tabIndex');
}
}
@override
@ -270,6 +283,7 @@ class _$TaskUIState extends TaskUIState {
editingTimeIndex == other.editingTimeIndex &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -280,9 +294,13 @@ class _$TaskUIState extends TaskUIState {
return __hashCode ??= $jf($jc(
$jc(
$jc(
$jc($jc($jc(0, editing.hashCode), editingTimeIndex.hashCode),
listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc(
$jc($jc(0, editing.hashCode),
editingTimeIndex.hashCode),
listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -294,6 +312,7 @@ class _$TaskUIState extends TaskUIState {
..add('editingTimeIndex', editingTimeIndex)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -322,6 +341,10 @@ class TaskUIStateBuilder implements Builder<TaskUIState, TaskUIStateBuilder> {
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -340,6 +363,7 @@ class TaskUIStateBuilder implements Builder<TaskUIState, TaskUIStateBuilder> {
_editingTimeIndex = _$v.editingTimeIndex;
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -370,6 +394,7 @@ class TaskUIStateBuilder implements Builder<TaskUIState, TaskUIStateBuilder> {
editingTimeIndex: editingTimeIndex,
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -59,6 +59,7 @@ abstract class TaskStatusUIState extends Object
listUIState: ListUIState(TaskStatusFields.name),
editing: TaskStatusEntity(),
selectedId: '',
tabIndex: 0,
);
}
TaskStatusUIState._();

View File

@ -83,6 +83,9 @@ class _$TaskStatusUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -124,6 +127,10 @@ class _$TaskStatusUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -247,6 +254,8 @@ class _$TaskStatusUIState extends TaskStatusUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -259,12 +268,16 @@ class _$TaskStatusUIState extends TaskStatusUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('TaskStatusUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('TaskStatusUIState', 'tabIndex');
}
}
@override
@ -282,6 +295,7 @@ class _$TaskStatusUIState extends TaskStatusUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -291,8 +305,10 @@ class _$TaskStatusUIState extends TaskStatusUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -303,6 +319,7 @@ class _$TaskStatusUIState extends TaskStatusUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -328,6 +345,10 @@ class TaskStatusUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -345,6 +366,7 @@ class TaskStatusUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -374,6 +396,7 @@ class TaskStatusUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -37,6 +37,7 @@ abstract class TaxRateUIState extends Object
listUIState: ListUIState(TaxRateFields.name),
editing: TaxRateEntity(),
selectedId: '',
tabIndex: 0,
);
}
TaxRateUIState._();

View File

@ -79,6 +79,9 @@ class _$TaxRateUIStateSerializer
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -119,6 +122,10 @@ class _$TaxRateUIStateSerializer
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -241,6 +248,8 @@ class _$TaxRateUIState extends TaxRateUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -252,12 +261,16 @@ class _$TaxRateUIState extends TaxRateUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('TaxRateUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('TaxRateUIState', 'tabIndex');
}
}
@override
@ -275,6 +288,7 @@ class _$TaxRateUIState extends TaxRateUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -284,8 +298,10 @@ class _$TaxRateUIState extends TaxRateUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -296,6 +312,7 @@ class _$TaxRateUIState extends TaxRateUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -321,6 +338,10 @@ class TaxRateUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -338,6 +359,7 @@ class TaxRateUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -367,6 +389,7 @@ class TaxRateUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -48,6 +48,7 @@ abstract class TokenUIState extends Object
listUIState: ListUIState(TokenFields.name),
editing: TokenEntity(),
selectedId: '',
tabIndex: 0,
);
}
TokenUIState._();

View File

@ -77,6 +77,9 @@ class _$TokenUIStateSerializer implements StructuredSerializer<TokenUIState> {
'listUIState',
serializers.serialize(object.listUIState,
specifiedType: const FullType(ListUIState)),
'tabIndex',
serializers.serialize(object.tabIndex,
specifiedType: const FullType(int)),
];
if (object.editing != null) {
result
@ -116,6 +119,10 @@ class _$TokenUIStateSerializer implements StructuredSerializer<TokenUIState> {
result.selectedId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tabIndex':
result.tabIndex = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
}
}
@ -237,6 +244,8 @@ class _$TokenUIState extends TokenUIState {
@override
final String selectedId;
@override
final int tabIndex;
@override
final Completer<SelectableEntity> saveCompleter;
@override
final Completer<Null> cancelCompleter;
@ -248,12 +257,16 @@ class _$TokenUIState extends TokenUIState {
{this.editing,
this.listUIState,
this.selectedId,
this.tabIndex,
this.saveCompleter,
this.cancelCompleter})
: super._() {
if (listUIState == null) {
throw new BuiltValueNullFieldError('TokenUIState', 'listUIState');
}
if (tabIndex == null) {
throw new BuiltValueNullFieldError('TokenUIState', 'tabIndex');
}
}
@override
@ -270,6 +283,7 @@ class _$TokenUIState extends TokenUIState {
editing == other.editing &&
listUIState == other.listUIState &&
selectedId == other.selectedId &&
tabIndex == other.tabIndex &&
saveCompleter == other.saveCompleter &&
cancelCompleter == other.cancelCompleter;
}
@ -279,8 +293,10 @@ class _$TokenUIState extends TokenUIState {
int get hashCode {
return __hashCode ??= $jf($jc(
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
$jc(
$jc($jc($jc(0, editing.hashCode), listUIState.hashCode),
selectedId.hashCode),
tabIndex.hashCode),
saveCompleter.hashCode),
cancelCompleter.hashCode));
}
@ -291,6 +307,7 @@ class _$TokenUIState extends TokenUIState {
..add('editing', editing)
..add('listUIState', listUIState)
..add('selectedId', selectedId)
..add('tabIndex', tabIndex)
..add('saveCompleter', saveCompleter)
..add('cancelCompleter', cancelCompleter))
.toString();
@ -316,6 +333,10 @@ class TokenUIStateBuilder
String get selectedId => _$this._selectedId;
set selectedId(String selectedId) => _$this._selectedId = selectedId;
int _tabIndex;
int get tabIndex => _$this._tabIndex;
set tabIndex(int tabIndex) => _$this._tabIndex = tabIndex;
Completer<SelectableEntity> _saveCompleter;
Completer<SelectableEntity> get saveCompleter => _$this._saveCompleter;
set saveCompleter(Completer<SelectableEntity> saveCompleter) =>
@ -333,6 +354,7 @@ class TokenUIStateBuilder
_editing = _$v.editing?.toBuilder();
_listUIState = _$v.listUIState?.toBuilder();
_selectedId = _$v.selectedId;
_tabIndex = _$v.tabIndex;
_saveCompleter = _$v.saveCompleter;
_cancelCompleter = _$v.cancelCompleter;
_$v = null;
@ -362,6 +384,7 @@ class TokenUIStateBuilder
editing: _editing?.build(),
listUIState: listUIState.build(),
selectedId: selectedId,
tabIndex: tabIndex,
saveCompleter: saveCompleter,
cancelCompleter: cancelCompleter);
} catch (_) {

View File

@ -12,6 +12,8 @@ abstract class EntityUIState {
@nullable
String get selectedId;
int get tabIndex;
@nullable
@BuiltValueField(serialize: false)
Completer<SelectableEntity> get saveCompleter;

View File

@ -56,6 +56,7 @@ PrefState prefReducer(
longPressReducer(state.longPressSelectionIsDefault, action)
..requireAuthentication =
requireAuthenticationReducer(state.requireAuthentication, action)
..colorTheme = colorThemeReducer(state.colorTheme, action)
..useSidebarEditor
.replace(sidebarEditorReducer(state.useSidebarEditor, action)),
);
@ -184,6 +185,12 @@ Reducer<bool> requireAuthenticationReducer = combineReducers([
}),
]);
Reducer<String> colorThemeReducer = combineReducers([
TypedReducer<String, UpdateUserPreferences>((currentColorTheme, action) {
return action.colorTheme ?? currentColorTheme;
}),
]);
Reducer<String> currentRouteReducer = combineReducers([
TypedReducer<String, UpdateCurrentRoute>((currentRoute, action) {
return action.route;

View File

@ -2,7 +2,9 @@ import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:flutter/foundation.dart';
import 'package:invoiceninja_flutter/constants.dart';
import 'package:invoiceninja_flutter/data/models/entities.dart';
import 'package:invoiceninja_flutter/data/models/static/color_theme_model.dart';
part 'pref_state.g.dart';
@ -20,6 +22,7 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
isHistoryVisible: false,
enableDarkMode: false,
requireAuthentication: false,
colorTheme: kColorThemeLight,
showFilterSidebar: false,
longPressSelectionIsDefault: false,
companyPrefs: BuiltMap<String, CompanyPrefState>(),
@ -58,6 +61,12 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
int get rowsPerPage;
String get colorTheme;
ColorTheme get colorThemeModel => colorThemesMap.containsKey(colorTheme)
? colorThemesMap[colorTheme]
: colorThemesMap[kColorThemeLight];
BuiltMap<String, CompanyPrefState> get companyPrefs;
bool get isDesktop => appLayout == AppLayout.desktop;
@ -95,8 +104,9 @@ abstract class PrefState implements Built<PrefState, PrefStateBuilder> {
!isMenuVisible;
// ignore: unused_element
static void _initializeBuilder(PrefStateBuilder builder) =>
builder..useSidebarEditor.replace(BuiltMap<EntityType, bool>());
static void _initializeBuilder(PrefStateBuilder builder) => builder
..useSidebarEditor.replace(BuiltMap<EntityType, bool>())
..colorTheme = kColorThemeLight;
static Serializer<PrefState> get serializer => _$prefStateSerializer;
}

View File

@ -151,6 +151,9 @@ class _$PrefStateSerializer implements StructuredSerializer<PrefState> {
'rowsPerPage',
serializers.serialize(object.rowsPerPage,
specifiedType: const FullType(int)),
'colorTheme',
serializers.serialize(object.colorTheme,
specifiedType: const FullType(String)),
'companyPrefs',
serializers.serialize(object.companyPrefs,
specifiedType: const FullType(BuiltMap, const [
@ -226,6 +229,10 @@ class _$PrefStateSerializer implements StructuredSerializer<PrefState> {
result.rowsPerPage = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'colorTheme':
result.colorTheme = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'companyPrefs':
result.companyPrefs.replace(serializers.deserialize(value,
specifiedType: const FullType(BuiltMap, const [
@ -439,6 +446,8 @@ class _$PrefState extends PrefState {
@override
final int rowsPerPage;
@override
final String colorTheme;
@override
final BuiltMap<String, CompanyPrefState> companyPrefs;
factory _$PrefState([void Function(PrefStateBuilder) updates]) =>
@ -458,6 +467,7 @@ class _$PrefState extends PrefState {
this.longPressSelectionIsDefault,
this.requireAuthentication,
this.rowsPerPage,
this.colorTheme,
this.companyPrefs})
: super._() {
if (appLayout == null) {
@ -500,6 +510,9 @@ class _$PrefState extends PrefState {
if (rowsPerPage == null) {
throw new BuiltValueNullFieldError('PrefState', 'rowsPerPage');
}
if (colorTheme == null) {
throw new BuiltValueNullFieldError('PrefState', 'colorTheme');
}
if (companyPrefs == null) {
throw new BuiltValueNullFieldError('PrefState', 'companyPrefs');
}
@ -529,6 +542,7 @@ class _$PrefState extends PrefState {
longPressSelectionIsDefault == other.longPressSelectionIsDefault &&
requireAuthentication == other.requireAuthentication &&
rowsPerPage == other.rowsPerPage &&
colorTheme == other.colorTheme &&
companyPrefs == other.companyPrefs;
}
@ -548,20 +562,27 @@ class _$PrefState extends PrefState {
$jc(
$jc(
$jc(
$jc(0,
appLayout.hashCode),
moduleLayout.hashCode),
menuSidebarMode.hashCode),
historySidebarMode.hashCode),
useSidebarEditor.hashCode),
isPreviewVisible.hashCode),
isMenuVisible.hashCode),
isHistoryVisible.hashCode),
enableDarkMode.hashCode),
showFilterSidebar.hashCode),
longPressSelectionIsDefault.hashCode),
requireAuthentication.hashCode),
rowsPerPage.hashCode),
$jc(
$jc(
0,
appLayout
.hashCode),
moduleLayout
.hashCode),
menuSidebarMode
.hashCode),
historySidebarMode
.hashCode),
useSidebarEditor.hashCode),
isPreviewVisible.hashCode),
isMenuVisible.hashCode),
isHistoryVisible.hashCode),
enableDarkMode.hashCode),
showFilterSidebar.hashCode),
longPressSelectionIsDefault.hashCode),
requireAuthentication.hashCode),
rowsPerPage.hashCode),
colorTheme.hashCode),
companyPrefs.hashCode));
}
@ -581,6 +602,7 @@ class _$PrefState extends PrefState {
..add('longPressSelectionIsDefault', longPressSelectionIsDefault)
..add('requireAuthentication', requireAuthentication)
..add('rowsPerPage', rowsPerPage)
..add('colorTheme', colorTheme)
..add('companyPrefs', companyPrefs))
.toString();
}
@ -653,6 +675,10 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
int get rowsPerPage => _$this._rowsPerPage;
set rowsPerPage(int rowsPerPage) => _$this._rowsPerPage = rowsPerPage;
String _colorTheme;
String get colorTheme => _$this._colorTheme;
set colorTheme(String colorTheme) => _$this._colorTheme = colorTheme;
MapBuilder<String, CompanyPrefState> _companyPrefs;
MapBuilder<String, CompanyPrefState> get companyPrefs =>
_$this._companyPrefs ??= new MapBuilder<String, CompanyPrefState>();
@ -678,6 +704,7 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
_longPressSelectionIsDefault = _$v.longPressSelectionIsDefault;
_requireAuthentication = _$v.requireAuthentication;
_rowsPerPage = _$v.rowsPerPage;
_colorTheme = _$v.colorTheme;
_companyPrefs = _$v.companyPrefs?.toBuilder();
_$v = null;
}
@ -716,6 +743,7 @@ class PrefStateBuilder implements Builder<PrefState, PrefStateBuilder> {
longPressSelectionIsDefault: longPressSelectionIsDefault,
requireAuthentication: requireAuthentication,
rowsPerPage: rowsPerPage,
colorTheme: colorTheme,
companyPrefs: companyPrefs.build());
} catch (_) {
String _$failedField;

View File

@ -198,7 +198,7 @@ Reducer<SettingsUIState> settingsUIReducer = combineReducers([
..origUser.replace(action.user ?? state.origUser)
..updatedAt = DateTime.now().millisecondsSinceEpoch
..section = action.section ?? state.section
..tabIndex = action.tabIndex ?? 0
..tabIndex = action.tabIndex ?? state.tabIndex
..isChanged = false
..entityType = action.client != null
? EntityType.client
@ -289,6 +289,10 @@ Reducer<SettingsUIState> settingsUIReducer = combineReducers([
Reducer<BuiltList<EntityType>> previewStackReducer = combineReducers([
TypedReducer<BuiltList<EntityType>, PreviewEntity>((previewStack, action) {
if (action.entityType == null) {
return previewStack;
}
if (previewStack.isNotEmpty && previewStack.last == action.entityType) {
return BuiltList(<EntityType>[]);
}

Some files were not shown because too many files have changed in this diff Show More