Fix invoice actions

This commit is contained in:
Hillel Coren 2020-01-02 17:22:33 +02:00
parent 22696e4859
commit 150a119455
5 changed files with 18 additions and 9 deletions

View File

@ -66,7 +66,7 @@ class InvoiceFields {
} }
abstract class InvoiceEntity extends Object abstract class InvoiceEntity extends Object
with BaseEntity, SelectableEntity, CalculateInvoiceTotal with BaseEntity, SelectableEntity, CalculateInvoiceTotal, BelongsToClient
implements Built<InvoiceEntity, InvoiceEntityBuilder> { implements Built<InvoiceEntity, InvoiceEntityBuilder> {
factory InvoiceEntity( factory InvoiceEntity(
{String id, bool isQuote = false, AppState state, ClientEntity client}) { {String id, bool isQuote = false, AppState state, ClientEntity client}) {
@ -148,6 +148,7 @@ abstract class InvoiceEntity extends Object
double get balance; double get balance;
@override
@nullable @nullable
@BuiltValueField(wireName: 'client_id') @BuiltValueField(wireName: 'client_id')
String get clientId; String get clientId;
@ -600,6 +601,7 @@ abstract class InvoiceItemEntity
@BuiltValueField(wireName: 'tax_rate3') @BuiltValueField(wireName: 'tax_rate3')
double get taxRate3; double get taxRate3;
@nullable
@BuiltValueField(wireName: 'invoice_item_type_id') @BuiltValueField(wireName: 'invoice_item_type_id')
String get invoiceItemTypeId; String get invoiceItemTypeId;

View File

@ -594,9 +594,6 @@ class _$InvoiceItemEntitySerializer
'tax_rate3', 'tax_rate3',
serializers.serialize(object.taxRate3, serializers.serialize(object.taxRate3,
specifiedType: const FullType(double)), specifiedType: const FullType(double)),
'invoice_item_type_id',
serializers.serialize(object.invoiceItemTypeId,
specifiedType: const FullType(String)),
'custom_value1', 'custom_value1',
serializers.serialize(object.customValue1, serializers.serialize(object.customValue1,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
@ -610,6 +607,12 @@ class _$InvoiceItemEntitySerializer
serializers.serialize(object.createdAt, serializers.serialize(object.createdAt,
specifiedType: const FullType(int)), specifiedType: const FullType(int)),
]; ];
if (object.invoiceItemTypeId != null) {
result
..add('invoice_item_type_id')
..add(serializers.serialize(object.invoiceItemTypeId,
specifiedType: const FullType(String)));
}
if (object.customValue3 != null) { if (object.customValue3 != null) {
result result
..add('custom_value3') ..add('custom_value3')
@ -1943,10 +1946,6 @@ class _$InvoiceItemEntity extends InvoiceItemEntity {
if (taxRate3 == null) { if (taxRate3 == null) {
throw new BuiltValueNullFieldError('InvoiceItemEntity', 'taxRate3'); throw new BuiltValueNullFieldError('InvoiceItemEntity', 'taxRate3');
} }
if (invoiceItemTypeId == null) {
throw new BuiltValueNullFieldError(
'InvoiceItemEntity', 'invoiceItemTypeId');
}
if (customValue1 == null) { if (customValue1 == null) {
throw new BuiltValueNullFieldError('InvoiceItemEntity', 'customValue1'); throw new BuiltValueNullFieldError('InvoiceItemEntity', 'customValue1');
} }

View File

@ -50,7 +50,7 @@ class ProjectFields {
} }
abstract class ProjectEntity extends Object abstract class ProjectEntity extends Object
with BaseEntity, SelectableEntity with BaseEntity, SelectableEntity, BelongsToClient
implements Built<ProjectEntity, ProjectEntityBuilder> { implements Built<ProjectEntity, ProjectEntityBuilder> {
factory ProjectEntity({String id, AppState state}) { factory ProjectEntity({String id, AppState state}) {
return _$ProjectEntity._( return _$ProjectEntity._(
@ -86,6 +86,7 @@ abstract class ProjectEntity extends Object
String get name; String get name;
@override
@BuiltValueField(wireName: 'client_id') @BuiltValueField(wireName: 'client_id')
String get clientId; String get clientId;

View File

@ -115,6 +115,8 @@ class AuthRepository {
]; ];
url += '?include=${includes.join(',')}&include_static=true'; url += '?include=${includes.join(',')}&include_static=true';
//url += '?first_load=true&include_static=true';
dynamic response; dynamic response;
if (Config.DEMO_MODE) { if (Config.DEMO_MODE) {

View File

@ -241,6 +241,9 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
final accentColor = convertHexStringToColor(state.accentColor) ?? final accentColor = convertHexStringToColor(state.accentColor) ??
Colors.lightBlueAccent; Colors.lightBlueAccent;
final fontFamily = kIsWeb ? 'Roboto' : null; final fontFamily = kIsWeb ? 'Roboto' : null;
final pageTransitionsTheme = PageTransitionsTheme(builders: {
TargetPlatform.android: ZoomPageTransitionsBuilder(),
});
Intl.defaultLocale = localeSelector(state); Intl.defaultLocale = localeSelector(state);
return MaterialApp( return MaterialApp(
@ -261,12 +264,14 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
locale: AppLocalization.createLocale(localeSelector(state)), locale: AppLocalization.createLocale(localeSelector(state)),
theme: state.prefState.enableDarkMode theme: state.prefState.enableDarkMode
? ThemeData( ? ThemeData(
pageTransitionsTheme: pageTransitionsTheme,
brightness: Brightness.dark, brightness: Brightness.dark,
accentColor: accentColor, accentColor: accentColor,
textSelectionHandleColor: accentColor, textSelectionHandleColor: accentColor,
fontFamily: fontFamily, fontFamily: fontFamily,
) )
: ThemeData(fontFamily: fontFamily).copyWith( : ThemeData(fontFamily: fontFamily).copyWith(
pageTransitionsTheme: pageTransitionsTheme,
accentColor: accentColor, accentColor: accentColor,
textSelectionColor: accentColor, textSelectionColor: accentColor,
primaryColor: const Color(0xFF117cc1), primaryColor: const Color(0xFF117cc1),