This commit is contained in:
Hillel Coren 2019-10-30 18:21:51 +02:00
parent f493a43b5b
commit 80942709d4
23 changed files with 109 additions and 32 deletions

View File

@ -169,7 +169,7 @@ abstract class InvoiceEntity extends Object
String get terms; String get terms;
@BuiltValueField(wireName: 'invoice_footer') @BuiltValueField(wireName: 'footer')
String get footer; String get footer;
@nullable @nullable
@ -314,7 +314,7 @@ abstract class InvoiceEntity extends Object
} }
if (response == 0) { if (response == 0) {
return invoiceA.invoiceNumber.compareTo(invoiceB.invoiceNumber); return (invoiceA.invoiceNumber ?? '').compareTo(invoiceB.invoiceNumber ?? '');
} else { } else {
return response; return response;
} }
@ -447,7 +447,7 @@ abstract class InvoiceEntity extends Object
@override @override
String get listDisplayName { String get listDisplayName {
return invoiceNumber; return invoiceNumber ?? id;
} }
@override @override

View File

@ -152,7 +152,7 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
'terms', 'terms',
serializers.serialize(object.terms, serializers.serialize(object.terms,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'invoice_footer', 'footer',
serializers.serialize(object.footer, serializers.serialize(object.footer,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'tax_name1', 'tax_name1',
@ -380,7 +380,7 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
result.terms = serializers.deserialize(value, result.terms = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'invoice_footer': case 'footer':
result.footer = serializers.deserialize(value, result.footer = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;

View File

@ -80,6 +80,9 @@ abstract class QuoteEntity extends Object
dueDate: '', dueDate: '',
publicNotes: '', publicNotes: '',
privateNotes: '', privateNotes: '',
terms: '',
footer: '',
designId: '1',
taxName1: company?.settings?.defaultTaxName1 ?? '', taxName1: company?.settings?.defaultTaxName1 ?? '',
taxRate1: company?.settings?.defaultTaxRate1 ?? 0.0, taxRate1: company?.settings?.defaultTaxRate1 ?? 0.0,
taxName2: company?.settings?.defaultTaxName2 ?? '', taxName2: company?.settings?.defaultTaxName2 ?? '',
@ -159,6 +162,15 @@ abstract class QuoteEntity extends Object
@BuiltValueField(wireName: 'private_notes') @BuiltValueField(wireName: 'private_notes')
String get privateNotes; String get privateNotes;
String get terms;
@BuiltValueField(wireName: 'footer')
String get footer;
@nullable
@BuiltValueField(wireName: 'design_id')
String get designId;
/* /*
@BuiltValueField(wireName: 'frequency_id') @BuiltValueField(wireName: 'frequency_id')
int get frequencyId; int get frequencyId;

View File

@ -141,6 +141,12 @@ class _$QuoteEntitySerializer implements StructuredSerializer<QuoteEntity> {
'private_notes', 'private_notes',
serializers.serialize(object.privateNotes, serializers.serialize(object.privateNotes,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
'terms',
serializers.serialize(object.terms,
specifiedType: const FullType(String)),
'footer',
serializers.serialize(object.footer,
specifiedType: const FullType(String)),
'tax_name1', 'tax_name1',
serializers.serialize(object.taxName1, serializers.serialize(object.taxName1,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
@ -231,6 +237,12 @@ class _$QuoteEntitySerializer implements StructuredSerializer<QuoteEntity> {
..add(serializers.serialize(object.invoiceNumber, ..add(serializers.serialize(object.invoiceNumber,
specifiedType: const FullType(String))); specifiedType: const FullType(String)));
} }
if (object.designId != null) {
result
..add('design_id')
..add(serializers.serialize(object.designId,
specifiedType: const FullType(String)));
}
if (object.isChanged != null) { if (object.isChanged != null) {
result result
..add('isChanged') ..add('isChanged')
@ -331,6 +343,18 @@ class _$QuoteEntitySerializer implements StructuredSerializer<QuoteEntity> {
result.privateNotes = serializers.deserialize(value, result.privateNotes = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'terms':
result.terms = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'footer':
result.footer = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'design_id':
result.designId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'tax_name1': case 'tax_name1':
result.taxName1 = serializers.deserialize(value, result.taxName1 = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
@ -817,6 +841,12 @@ class _$QuoteEntity extends QuoteEntity {
@override @override
final String privateNotes; final String privateNotes;
@override @override
final String terms;
@override
final String footer;
@override
final String designId;
@override
final String taxName1; final String taxName1;
@override @override
final double taxRate1; final double taxRate1;
@ -900,6 +930,9 @@ class _$QuoteEntity extends QuoteEntity {
this.dueDate, this.dueDate,
this.publicNotes, this.publicNotes,
this.privateNotes, this.privateNotes,
this.terms,
this.footer,
this.designId,
this.taxName1, this.taxName1,
this.taxRate1, this.taxRate1,
this.taxName2, this.taxName2,
@ -965,6 +998,12 @@ class _$QuoteEntity extends QuoteEntity {
if (privateNotes == null) { if (privateNotes == null) {
throw new BuiltValueNullFieldError('QuoteEntity', 'privateNotes'); throw new BuiltValueNullFieldError('QuoteEntity', 'privateNotes');
} }
if (terms == null) {
throw new BuiltValueNullFieldError('QuoteEntity', 'terms');
}
if (footer == null) {
throw new BuiltValueNullFieldError('QuoteEntity', 'footer');
}
if (taxName1 == null) { if (taxName1 == null) {
throw new BuiltValueNullFieldError('QuoteEntity', 'taxName1'); throw new BuiltValueNullFieldError('QuoteEntity', 'taxName1');
} }
@ -1070,6 +1109,9 @@ class _$QuoteEntity extends QuoteEntity {
dueDate == other.dueDate && dueDate == other.dueDate &&
publicNotes == other.publicNotes && publicNotes == other.publicNotes &&
privateNotes == other.privateNotes && privateNotes == other.privateNotes &&
terms == other.terms &&
footer == other.footer &&
designId == other.designId &&
taxName1 == other.taxName1 && taxName1 == other.taxName1 &&
taxRate1 == other.taxRate1 && taxRate1 == other.taxRate1 &&
taxName2 == other.taxName2 && taxName2 == other.taxName2 &&
@ -1126,7 +1168,7 @@ class _$QuoteEntity extends QuoteEntity {
$jc( $jc(
$jc( $jc(
$jc( $jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), clientId.hashCode), statusId.hashCode), invoiceNumber.hashCode), discount.hashCode), poNumber.hashCode), invoiceDate.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), isAmountDiscount.hashCode), partial.hashCode), partialDueDate.hashCode), hasTasks.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), $jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), clientId.hashCode), statusId.hashCode), invoiceNumber.hashCode), discount.hashCode), poNumber.hashCode), invoiceDate.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), isAmountDiscount.hashCode), partial.hashCode), partialDueDate.hashCode), hasTasks.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode),
customSurcharge3.hashCode), customSurcharge3.hashCode),
customSurcharge4.hashCode), customSurcharge4.hashCode),
customTaxes1.hashCode), customTaxes1.hashCode),
@ -1162,6 +1204,9 @@ class _$QuoteEntity extends QuoteEntity {
..add('dueDate', dueDate) ..add('dueDate', dueDate)
..add('publicNotes', publicNotes) ..add('publicNotes', publicNotes)
..add('privateNotes', privateNotes) ..add('privateNotes', privateNotes)
..add('terms', terms)
..add('footer', footer)
..add('designId', designId)
..add('taxName1', taxName1) ..add('taxName1', taxName1)
..add('taxRate1', taxRate1) ..add('taxRate1', taxRate1)
..add('taxName2', taxName2) ..add('taxName2', taxName2)
@ -1248,6 +1293,18 @@ class QuoteEntityBuilder implements Builder<QuoteEntity, QuoteEntityBuilder> {
String get privateNotes => _$this._privateNotes; String get privateNotes => _$this._privateNotes;
set privateNotes(String privateNotes) => _$this._privateNotes = privateNotes; set privateNotes(String privateNotes) => _$this._privateNotes = privateNotes;
String _terms;
String get terms => _$this._terms;
set terms(String terms) => _$this._terms = terms;
String _footer;
String get footer => _$this._footer;
set footer(String footer) => _$this._footer = footer;
String _designId;
String get designId => _$this._designId;
set designId(String designId) => _$this._designId = designId;
String _taxName1; String _taxName1;
String get taxName1 => _$this._taxName1; String get taxName1 => _$this._taxName1;
set taxName1(String taxName1) => _$this._taxName1 = taxName1; set taxName1(String taxName1) => _$this._taxName1 = taxName1;
@ -1411,6 +1468,9 @@ class QuoteEntityBuilder implements Builder<QuoteEntity, QuoteEntityBuilder> {
_dueDate = _$v.dueDate; _dueDate = _$v.dueDate;
_publicNotes = _$v.publicNotes; _publicNotes = _$v.publicNotes;
_privateNotes = _$v.privateNotes; _privateNotes = _$v.privateNotes;
_terms = _$v.terms;
_footer = _$v.footer;
_designId = _$v.designId;
_taxName1 = _$v.taxName1; _taxName1 = _$v.taxName1;
_taxRate1 = _$v.taxRate1; _taxRate1 = _$v.taxRate1;
_taxName2 = _$v.taxName2; _taxName2 = _$v.taxName2;
@ -1480,6 +1540,9 @@ class QuoteEntityBuilder implements Builder<QuoteEntity, QuoteEntityBuilder> {
dueDate: dueDate, dueDate: dueDate,
publicNotes: publicNotes, publicNotes: publicNotes,
privateNotes: privateNotes, privateNotes: privateNotes,
terms: terms,
footer: footer,
designId: designId,
taxName1: taxName1, taxName1: taxName1,
taxRate1: taxRate1, taxRate1: taxRate1,
taxName2: taxName2, taxName2: taxName2,

View File

@ -181,7 +181,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState clientListState, ClearClientMultiselect action) { ListUIState clientListState, ClearClientMultiselect action) {
return clientListState.rebuild((b) => b..selectedIds = null); return clientListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final clientsReducer = combineReducers<ClientState>([ final clientsReducer = combineReducers<ClientState>([

View File

@ -148,7 +148,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState productListState, ClearCompanyGatewayMultiselect action) { ListUIState productListState, ClearCompanyGatewayMultiselect action) {
return productListState.rebuild((b) => b..selectedIds = null); return productListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final companyGatewaysReducer = combineReducers<CompanyGatewayState>([ final companyGatewaysReducer = combineReducers<CompanyGatewayState>([

View File

@ -130,7 +130,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState documentListState, ClearDocumentMultiselect action) { ListUIState documentListState, ClearDocumentMultiselect action) {
return documentListState.rebuild((b) => b..selectedIds = null); return documentListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final documentsReducer = combineReducers<DocumentState>([ final documentsReducer = combineReducers<DocumentState>([

View File

@ -140,7 +140,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState expenseListState, ClearExpenseMultiselect action) { ListUIState expenseListState, ClearExpenseMultiselect action) {
return expenseListState.rebuild((b) => b..selectedIds = null); return expenseListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final expensesReducer = combineReducers<ExpenseState>([ final expensesReducer = combineReducers<ExpenseState>([

View File

@ -127,7 +127,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState groupListState, ClearGroupMultiselect action) { ListUIState groupListState, ClearGroupMultiselect action) {
return groupListState.rebuild((b) => b..selectedIds = null); return groupListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final groupsReducer = combineReducers<GroupState>([ final groupsReducer = combineReducers<GroupState>([

View File

@ -199,7 +199,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState invoiceListState, ClearInvoiceMultiselect action) { ListUIState invoiceListState, ClearInvoiceMultiselect action) {
return invoiceListState.rebuild((b) => b..selectedIds = null); return invoiceListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final invoicesReducer = combineReducers<InvoiceState>([ final invoicesReducer = combineReducers<InvoiceState>([

View File

@ -129,7 +129,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState paymentListState, ClearPaymentMultiselect action) { ListUIState paymentListState, ClearPaymentMultiselect action) {
return paymentListState.rebuild((b) => b..selectedIds = null); return paymentListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final paymentsReducer = combineReducers<PaymentState>([ final paymentsReducer = combineReducers<PaymentState>([

View File

@ -128,7 +128,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState productListState, ClearProductMultiselect action) { ListUIState productListState, ClearProductMultiselect action) {
return productListState.rebuild((b) => b..selectedIds = null); return productListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final productsReducer = combineReducers<ProductState>([ final productsReducer = combineReducers<ProductState>([

View File

@ -145,7 +145,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState projectListState, ClearProjectMultiselect action) { ListUIState projectListState, ClearProjectMultiselect action) {
return projectListState.rebuild((b) => b..selectedIds = null); return projectListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final projectsReducer = combineReducers<ProjectState>([ final projectsReducer = combineReducers<ProjectState>([

View File

@ -185,7 +185,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState quoteListState, ClearQuoteMultiselect action) { ListUIState quoteListState, ClearQuoteMultiselect action) {
return quoteListState.rebuild((b) => b..selectedIds = null); return quoteListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final quotesReducer = combineReducers<QuoteState>([ final quotesReducer = combineReducers<QuoteState>([

View File

@ -158,7 +158,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState taskListState, ClearTaskMultiselect action) { ListUIState taskListState, ClearTaskMultiselect action) {
return taskListState.rebuild((b) => b..selectedIds = null); return taskListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final tasksReducer = combineReducers<TaskState>([ final tasksReducer = combineReducers<TaskState>([

View File

@ -130,7 +130,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState taxRateListState, ClearTaxRateMultiselect action) { ListUIState taxRateListState, ClearTaxRateMultiselect action) {
return taxRateListState.rebuild((b) => b..selectedIds = null); return taxRateListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final taxRatesReducer = combineReducers<TaxRateState>([ final taxRatesReducer = combineReducers<TaxRateState>([

View File

@ -126,7 +126,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState productListState, ClearUserMultiselect action) { ListUIState productListState, ClearUserMultiselect action) {
return productListState.rebuild((b) => b..selectedIds = null); return productListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final usersReducer = combineReducers<UserState>([ final usersReducer = combineReducers<UserState>([

View File

@ -171,7 +171,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState vendorListState, ClearVendorMultiselect action) { ListUIState vendorListState, ClearVendorMultiselect action) {
return vendorListState.rebuild((b) => b..selectedIds = null); return vendorListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final vendorsReducer = combineReducers<VendorState>([ final vendorsReducer = combineReducers<VendorState>([

View File

@ -125,7 +125,7 @@ class _InvoiceEditState extends State<InvoiceEdit>
child: Padding( child: Padding(
padding: const EdgeInsets.all(14.0), padding: const EdgeInsets.all(14.0),
child: Text( child: Text(
'${localization.total}: ${formatNumber(invoice.calculateTotal(viewModel.company.settings.enableInclusiveTaxes), context, clientId: viewModel.invoice.clientId)}', '${localization.total}: ${formatNumber(invoice.calculateTotal(viewModel.company.settings.enableInclusiveTaxes ?? false), context, clientId: viewModel.invoice.clientId)}',
style: TextStyle( style: TextStyle(
//color: Theme.of(context).selectedRowColor, //color: Theme.of(context).selectedRowColor,
color: Colors.white, color: Colors.white,

View File

@ -275,7 +275,7 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
TextInputType.numberWithOptions(decimal: true), TextInputType.numberWithOptions(decimal: true),
) )
: Container(), : Container(),
company.settings.enableInvoiceTaxes (company.settings.enableInvoiceTaxes ?? false)
? TaxRateDropdown( ? TaxRateDropdown(
taxRates: company.taxRates, taxRates: company.taxRates,
onSelected: (taxRate) => onSelected: (taxRate) =>
@ -285,7 +285,7 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
initialTaxRate: invoice.taxRate1, initialTaxRate: invoice.taxRate1,
) )
: Container(), : Container(),
company.settings.enableInvoiceTaxes && (company.settings.enableInvoiceTaxes ?? false) &&
company.settings.enableSecondTaxRate company.settings.enableSecondTaxRate
? TaxRateDropdown( ? TaxRateDropdown(
taxRates: company.taxRates, taxRates: company.taxRates,

View File

@ -124,7 +124,7 @@ class _QuoteEditState extends State<QuoteEdit>
child: Padding( child: Padding(
padding: const EdgeInsets.all(14.0), padding: const EdgeInsets.all(14.0),
child: Text( child: Text(
'${localization.total}: ${formatNumber(invoice.calculateTotal(viewModel.company.settings.enableInclusiveTaxes), context, clientId: viewModel.invoice.clientId)}', '${localization.total}: ${formatNumber(invoice.calculateTotal(viewModel.company.settings.enableInclusiveTaxes ?? false), context, clientId: viewModel.invoice.clientId)}',
style: TextStyle( style: TextStyle(
//color: Theme.of(context).selectedRowColor, //color: Theme.of(context).selectedRowColor,
color: Colors.white, color: Colors.white,

View File

@ -97,13 +97,15 @@ class _DeviceSettingsState extends State<DeviceSettings> {
), ),
FormCard( FormCard(
children: <Widget>[ children: <Widget>[
ListTile( Builder(builder: (BuildContext context) {
leading: Icon(FontAwesomeIcons.syncAlt), return ListTile(
title: Text(AppLocalization.of(context).refreshData), leading: Icon(FontAwesomeIcons.syncAlt),
onTap: () { title: Text(AppLocalization.of(context).refreshData),
widget.viewModel.onRefreshTap(context); onTap: () {
}, widget.viewModel.onRefreshTap(context);
), },
);
}),
ListTile( ListTile(
leading: Icon(FontAwesomeIcons.powerOff), leading: Icon(FontAwesomeIcons.powerOff),
title: Text(AppLocalization.of(context).logout), title: Text(AppLocalization.of(context).logout),

View File

@ -129,7 +129,7 @@ ListUIState _removeFromListMultiselect(
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(
ListUIState productListState, ClearStubMultiselect action) { ListUIState productListState, ClearStubMultiselect action) {
return productListState.rebuild((b) => b..selectedIds = null); return productListState.rebuild((b) => b..selectedIds = ListBuilder());
} }
final stubsReducer = combineReducers<StubState>([ final stubsReducer = combineReducers<StubState>([