Dartfmt
This commit is contained in:
parent
894b53153f
commit
a92459ce9a
|
|
@ -269,7 +269,6 @@ abstract class CompanyEntity
|
|||
@BuiltValueField(wireName: 'has_custom_design3')
|
||||
bool get hasCustomDesign3;
|
||||
|
||||
|
||||
//@BuiltValueField(wireName: 'custom_messages')
|
||||
//@BuiltValueField(wireName: 'invoice_labels')
|
||||
|
||||
|
|
@ -341,7 +340,8 @@ abstract class CompanyEntity
|
|||
companyCurrencyId > 0 ? companyCurrencyId : kDefaultCurrencyId;
|
||||
|
||||
// Handle bug in earlier version of API
|
||||
int get firstMonthOfYear => financialYearStart == 2000 ? 1 : financialYearStart;
|
||||
int get firstMonthOfYear =>
|
||||
financialYearStart == 2000 ? 1 : financialYearStart;
|
||||
|
||||
static Serializer<CompanyEntity> get serializer => _$companyEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,7 +441,6 @@ abstract class InvoiceEntity extends Object
|
|||
}
|
||||
|
||||
InvoiceEntity applyTax(TaxRateEntity taxRate, {bool isSecond = false}) {
|
||||
|
||||
InvoiceEntity invoice;
|
||||
|
||||
if (isSecond) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ abstract class CalculateInvoiceTotal {
|
|||
bool get customTaxes2;
|
||||
BuiltList<InvoiceItemEntity> get invoiceItems;
|
||||
|
||||
double _calculateTaxAmount(double amount, double rate, bool useInclusiveTaxes) {
|
||||
double _calculateTaxAmount(
|
||||
double amount, double rate, bool useInclusiveTaxes) {
|
||||
double taxAmount;
|
||||
if (useInclusiveTaxes) {
|
||||
taxAmount = amount - (amount / (1 + (rate / 100)));
|
||||
|
|
@ -57,11 +58,13 @@ abstract class CalculateInvoiceTotal {
|
|||
|
||||
if (taxRate1 != 0) {
|
||||
taxAmount = _calculateTaxAmount(lineTotal, taxRate1, useInclusiveTaxes);
|
||||
map.update(item.taxName1, (value) => value + taxAmount, ifAbsent: () => taxAmount);
|
||||
map.update(item.taxName1, (value) => value + taxAmount,
|
||||
ifAbsent: () => taxAmount);
|
||||
}
|
||||
if (taxRate2 != 0) {
|
||||
taxAmount = _calculateTaxAmount(lineTotal, taxRate2, useInclusiveTaxes);
|
||||
map.update(item.taxName2, (value) => value + taxAmount, ifAbsent: () => taxAmount);
|
||||
map.update(item.taxName2, (value) => value + taxAmount,
|
||||
ifAbsent: () => taxAmount);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -81,15 +84,16 @@ abstract class CalculateInvoiceTotal {
|
|||
total += round(customValue2, 2);
|
||||
}
|
||||
|
||||
|
||||
if (taxRate1 != 0) {
|
||||
taxAmount = _calculateTaxAmount(total, taxRate1, useInclusiveTaxes);
|
||||
map.update(taxName1, (value) => value + taxAmount, ifAbsent: () => taxAmount);
|
||||
map.update(taxName1, (value) => value + taxAmount,
|
||||
ifAbsent: () => taxAmount);
|
||||
}
|
||||
|
||||
if (taxRate2 != 0) {
|
||||
taxAmount = _calculateTaxAmount(total, taxRate2, useInclusiveTaxes);
|
||||
map.update(taxName2, (value) => value + taxAmount, ifAbsent: () => taxAmount);
|
||||
map.update(taxName2, (value) => value + taxAmount,
|
||||
ifAbsent: () => taxAmount);
|
||||
}
|
||||
|
||||
return map;
|
||||
|
|
@ -147,18 +151,18 @@ abstract class CalculateInvoiceTotal {
|
|||
total += round(customValue2, 2);
|
||||
}
|
||||
|
||||
if (! useInclusiveTaxes) {
|
||||
if (!useInclusiveTaxes) {
|
||||
final double taxAmount1 = round(total * taxRate1 / 100, 2);
|
||||
final double taxAmount2 = round(total * taxRate2 / 100, 2);
|
||||
|
||||
total += itemTax + taxAmount1 + taxAmount2;
|
||||
}
|
||||
|
||||
if (customValue1 != 0.0 && ! customTaxes1) {
|
||||
if (customValue1 != 0.0 && !customTaxes1) {
|
||||
total += round(customValue1, 2);
|
||||
}
|
||||
|
||||
if (customValue2 != 0.0 && ! customTaxes2) {
|
||||
if (customValue2 != 0.0 && !customTaxes2) {
|
||||
total += round(customValue2, 2);
|
||||
}
|
||||
|
||||
|
|
@ -189,4 +193,3 @@ abstract class CalculateInvoiceTotal {
|
|||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ export 'package:invoiceninja_flutter/data/models/static/frequency_model.dart';
|
|||
part 'models.g.dart';
|
||||
|
||||
class EntityAction extends EnumClass {
|
||||
|
||||
const EntityAction._(String name) : super(name);
|
||||
|
||||
static Serializer<EntityAction> get serializer => _$entityActionSerializer;
|
||||
|
|
@ -59,4 +58,3 @@ class EntityAction extends EnumClass {
|
|||
static BuiltSet<EntityAction> get values => _$values;
|
||||
static EntityAction valueOf(String name) => _$valueOf(name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ abstract class ProductEntity extends Object
|
|||
return null;
|
||||
}
|
||||
|
||||
List<EntityAction> getEntityActions({UserEntity user, bool includeEdit = false}) {
|
||||
List<EntityAction> getEntityActions(
|
||||
{UserEntity user, bool includeEdit = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
if (includeEdit && user.canEditEntity(this)) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ part 'serializers.g.dart';
|
|||
TimezoneItemResponse,
|
||||
TimezoneListResponse,
|
||||
// STARTER: serializers - do not remove comment
|
||||
VendorEntity,
|
||||
VendorEntity,
|
||||
|
||||
TaskEntity,
|
||||
ProjectEntity,
|
||||
|
|
|
|||
|
|
@ -5,24 +5,28 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'country_model.g.dart';
|
||||
|
||||
abstract class CountryListResponse implements Built<CountryListResponse, CountryListResponseBuilder> {
|
||||
|
||||
factory CountryListResponse([void updates(CountryListResponseBuilder b)]) = _$CountryListResponse;
|
||||
abstract class CountryListResponse
|
||||
implements Built<CountryListResponse, CountryListResponseBuilder> {
|
||||
factory CountryListResponse([void updates(CountryListResponseBuilder b)]) =
|
||||
_$CountryListResponse;
|
||||
CountryListResponse._();
|
||||
|
||||
BuiltList<CountryEntity> get data;
|
||||
|
||||
static Serializer<CountryListResponse> get serializer => _$countryListResponseSerializer;
|
||||
static Serializer<CountryListResponse> get serializer =>
|
||||
_$countryListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class CountryItemResponse implements Built<CountryItemResponse, CountryItemResponseBuilder> {
|
||||
|
||||
factory CountryItemResponse([void updates(CountryItemResponseBuilder b)]) = _$CountryItemResponse;
|
||||
abstract class CountryItemResponse
|
||||
implements Built<CountryItemResponse, CountryItemResponseBuilder> {
|
||||
factory CountryItemResponse([void updates(CountryItemResponseBuilder b)]) =
|
||||
_$CountryItemResponse;
|
||||
CountryItemResponse._();
|
||||
|
||||
CountryEntity get data;
|
||||
|
||||
static Serializer<CountryItemResponse> get serializer => _$countryItemResponseSerializer;
|
||||
static Serializer<CountryItemResponse> get serializer =>
|
||||
_$countryItemResponseSerializer;
|
||||
}
|
||||
|
||||
class CountryFields {
|
||||
|
|
@ -46,9 +50,9 @@ class CountryFields {
|
|||
*/
|
||||
}
|
||||
|
||||
|
||||
abstract class CountryEntity extends Object with SelectableEntity implements Built<CountryEntity, CountryEntityBuilder> {
|
||||
|
||||
abstract class CountryEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<CountryEntity, CountryEntityBuilder> {
|
||||
factory CountryEntity() {
|
||||
return _$CountryEntity._(
|
||||
id: 0,
|
||||
|
|
@ -87,7 +91,6 @@ abstract class CountryEntity extends Object with SelectableEntity implements Bui
|
|||
@BuiltValueField(wireName: 'iso_3166_3')
|
||||
String get iso3;
|
||||
|
||||
|
||||
/*
|
||||
factory CountryEntity() {
|
||||
return _$CountryEntity._(
|
||||
|
|
@ -186,4 +189,3 @@ abstract class CountryEntity extends Object with SelectableEntity implements Bui
|
|||
|
||||
static Serializer<CountryEntity> get serializer => _$countryEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,24 +5,28 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'currency_model.g.dart';
|
||||
|
||||
abstract class CurrencyListResponse implements Built<CurrencyListResponse, CurrencyListResponseBuilder> {
|
||||
|
||||
factory CurrencyListResponse([void updates(CurrencyListResponseBuilder b)]) = _$CurrencyListResponse;
|
||||
abstract class CurrencyListResponse
|
||||
implements Built<CurrencyListResponse, CurrencyListResponseBuilder> {
|
||||
factory CurrencyListResponse([void updates(CurrencyListResponseBuilder b)]) =
|
||||
_$CurrencyListResponse;
|
||||
CurrencyListResponse._();
|
||||
|
||||
BuiltList<CurrencyEntity> get data;
|
||||
|
||||
static Serializer<CurrencyListResponse> get serializer => _$currencyListResponseSerializer;
|
||||
static Serializer<CurrencyListResponse> get serializer =>
|
||||
_$currencyListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class CurrencyItemResponse implements Built<CurrencyItemResponse, CurrencyItemResponseBuilder> {
|
||||
|
||||
factory CurrencyItemResponse([void updates(CurrencyItemResponseBuilder b)]) = _$CurrencyItemResponse;
|
||||
abstract class CurrencyItemResponse
|
||||
implements Built<CurrencyItemResponse, CurrencyItemResponseBuilder> {
|
||||
factory CurrencyItemResponse([void updates(CurrencyItemResponseBuilder b)]) =
|
||||
_$CurrencyItemResponse;
|
||||
CurrencyItemResponse._();
|
||||
|
||||
CurrencyEntity get data;
|
||||
|
||||
static Serializer<CurrencyItemResponse> get serializer => _$currencyItemResponseSerializer;
|
||||
static Serializer<CurrencyItemResponse> get serializer =>
|
||||
_$currencyItemResponseSerializer;
|
||||
}
|
||||
|
||||
class CurrencyFields {
|
||||
|
|
@ -36,8 +40,9 @@ class CurrencyFields {
|
|||
static const String exchangeRate = 'exchangeRate';
|
||||
}
|
||||
|
||||
abstract class CurrencyEntity extends Object with SelectableEntity implements Built<CurrencyEntity, CurrencyEntityBuilder> {
|
||||
|
||||
abstract class CurrencyEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<CurrencyEntity, CurrencyEntityBuilder> {
|
||||
factory CurrencyEntity() {
|
||||
return _$CurrencyEntity._(
|
||||
id: 0,
|
||||
|
|
@ -115,5 +120,6 @@ abstract class CurrencyEntity extends Object with SelectableEntity implements Bu
|
|||
@override
|
||||
double get listDisplayAmount => null;
|
||||
|
||||
static Serializer<CurrencyEntity> get serializer => _$currencyEntitySerializer;
|
||||
}
|
||||
static Serializer<CurrencyEntity> get serializer =>
|
||||
_$currencyEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,30 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
part 'date_format_model.g.dart';
|
||||
|
||||
abstract class DateFormatListResponse implements Built<DateFormatListResponse, DateFormatListResponseBuilder> {
|
||||
|
||||
factory DateFormatListResponse([void updates(DateFormatListResponseBuilder b)]) = _$DateFormatListResponse;
|
||||
abstract class DateFormatListResponse
|
||||
implements Built<DateFormatListResponse, DateFormatListResponseBuilder> {
|
||||
factory DateFormatListResponse(
|
||||
[void updates(DateFormatListResponseBuilder b)]) =
|
||||
_$DateFormatListResponse;
|
||||
DateFormatListResponse._();
|
||||
|
||||
BuiltList<DateFormatEntity> get data;
|
||||
|
||||
static Serializer<DateFormatListResponse> get serializer => _$dateFormatListResponseSerializer;
|
||||
static Serializer<DateFormatListResponse> get serializer =>
|
||||
_$dateFormatListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class DateFormatItemResponse implements Built<DateFormatItemResponse, DateFormatItemResponseBuilder> {
|
||||
|
||||
factory DateFormatItemResponse([void updates(DateFormatItemResponseBuilder b)]) = _$DateFormatItemResponse;
|
||||
abstract class DateFormatItemResponse
|
||||
implements Built<DateFormatItemResponse, DateFormatItemResponseBuilder> {
|
||||
factory DateFormatItemResponse(
|
||||
[void updates(DateFormatItemResponseBuilder b)]) =
|
||||
_$DateFormatItemResponse;
|
||||
DateFormatItemResponse._();
|
||||
|
||||
DateFormatEntity get data;
|
||||
|
||||
static Serializer<DateFormatItemResponse> get serializer => _$dateFormatItemResponseSerializer;
|
||||
static Serializer<DateFormatItemResponse> get serializer =>
|
||||
_$dateFormatItemResponseSerializer;
|
||||
}
|
||||
|
||||
class DateFormatFields {
|
||||
|
|
@ -30,8 +36,8 @@ class DateFormatFields {
|
|||
static const String formatMoment = 'formatMoment';
|
||||
}
|
||||
|
||||
abstract class DateFormatEntity implements Built<DateFormatEntity, DateFormatEntityBuilder> {
|
||||
|
||||
abstract class DateFormatEntity
|
||||
implements Built<DateFormatEntity, DateFormatEntityBuilder> {
|
||||
factory DateFormatEntity() {
|
||||
return _$DateFormatEntity._(
|
||||
id: 0,
|
||||
|
|
@ -45,5 +51,6 @@ abstract class DateFormatEntity implements Built<DateFormatEntity, DateFormatEnt
|
|||
@BuiltValueField(wireName: 'format_dart')
|
||||
String get format;
|
||||
|
||||
static Serializer<DateFormatEntity> get serializer => _$dateFormatEntitySerializer;
|
||||
}
|
||||
static Serializer<DateFormatEntity> get serializer =>
|
||||
_$dateFormatEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,32 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
part 'datetime_format_model.g.dart';
|
||||
|
||||
abstract class DatetimeFormatListResponse implements Built<DatetimeFormatListResponse, DatetimeFormatListResponseBuilder> {
|
||||
|
||||
factory DatetimeFormatListResponse([void updates(DatetimeFormatListResponseBuilder b)]) = _$DatetimeFormatListResponse;
|
||||
abstract class DatetimeFormatListResponse
|
||||
implements
|
||||
Built<DatetimeFormatListResponse, DatetimeFormatListResponseBuilder> {
|
||||
factory DatetimeFormatListResponse(
|
||||
[void updates(DatetimeFormatListResponseBuilder b)]) =
|
||||
_$DatetimeFormatListResponse;
|
||||
DatetimeFormatListResponse._();
|
||||
|
||||
BuiltList<DatetimeFormatEntity> get data;
|
||||
|
||||
static Serializer<DatetimeFormatListResponse> get serializer => _$datetimeFormatListResponseSerializer;
|
||||
static Serializer<DatetimeFormatListResponse> get serializer =>
|
||||
_$datetimeFormatListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class DatetimeFormatItemResponse implements Built<DatetimeFormatItemResponse, DatetimeFormatItemResponseBuilder> {
|
||||
|
||||
factory DatetimeFormatItemResponse([void updates(DatetimeFormatItemResponseBuilder b)]) = _$DatetimeFormatItemResponse;
|
||||
abstract class DatetimeFormatItemResponse
|
||||
implements
|
||||
Built<DatetimeFormatItemResponse, DatetimeFormatItemResponseBuilder> {
|
||||
factory DatetimeFormatItemResponse(
|
||||
[void updates(DatetimeFormatItemResponseBuilder b)]) =
|
||||
_$DatetimeFormatItemResponse;
|
||||
DatetimeFormatItemResponse._();
|
||||
|
||||
DatetimeFormatEntity get data;
|
||||
|
||||
static Serializer<DatetimeFormatItemResponse> get serializer => _$datetimeFormatItemResponseSerializer;
|
||||
static Serializer<DatetimeFormatItemResponse> get serializer =>
|
||||
_$datetimeFormatItemResponseSerializer;
|
||||
}
|
||||
|
||||
class DatetimeFormatFields {
|
||||
|
|
@ -29,8 +37,8 @@ class DatetimeFormatFields {
|
|||
static const String formatMoment = 'formatMoment';
|
||||
}
|
||||
|
||||
abstract class DatetimeFormatEntity implements Built<DatetimeFormatEntity, DatetimeFormatEntityBuilder> {
|
||||
|
||||
abstract class DatetimeFormatEntity
|
||||
implements Built<DatetimeFormatEntity, DatetimeFormatEntityBuilder> {
|
||||
factory DatetimeFormatEntity() {
|
||||
return _$DatetimeFormatEntity._(
|
||||
id: 0,
|
||||
|
|
@ -44,5 +52,6 @@ abstract class DatetimeFormatEntity implements Built<DatetimeFormatEntity, Datet
|
|||
@BuiltValueField(wireName: 'format_dart')
|
||||
String get format;
|
||||
|
||||
static Serializer<DatetimeFormatEntity> get serializer => _$datetimeFormatEntitySerializer;
|
||||
}
|
||||
static Serializer<DatetimeFormatEntity> get serializer =>
|
||||
_$datetimeFormatEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,35 +4,37 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
part 'frequency_model.g.dart';
|
||||
|
||||
abstract class FrequencyListResponse implements Built<FrequencyListResponse, FrequencyListResponseBuilder> {
|
||||
|
||||
factory FrequencyListResponse([void updates(FrequencyListResponseBuilder b)]) = _$FrequencyListResponse;
|
||||
abstract class FrequencyListResponse
|
||||
implements Built<FrequencyListResponse, FrequencyListResponseBuilder> {
|
||||
factory FrequencyListResponse(
|
||||
[void updates(FrequencyListResponseBuilder b)]) = _$FrequencyListResponse;
|
||||
FrequencyListResponse._();
|
||||
|
||||
BuiltList<FrequencyEntity> get data;
|
||||
|
||||
static Serializer<FrequencyListResponse> get serializer => _$frequencyListResponseSerializer;
|
||||
static Serializer<FrequencyListResponse> get serializer =>
|
||||
_$frequencyListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class FrequencyItemResponse implements Built<FrequencyItemResponse, FrequencyItemResponseBuilder> {
|
||||
|
||||
factory FrequencyItemResponse([void updates(FrequencyItemResponseBuilder b)]) = _$FrequencyItemResponse;
|
||||
abstract class FrequencyItemResponse
|
||||
implements Built<FrequencyItemResponse, FrequencyItemResponseBuilder> {
|
||||
factory FrequencyItemResponse(
|
||||
[void updates(FrequencyItemResponseBuilder b)]) = _$FrequencyItemResponse;
|
||||
FrequencyItemResponse._();
|
||||
|
||||
FrequencyEntity get data;
|
||||
|
||||
static Serializer<FrequencyItemResponse> get serializer => _$frequencyItemResponseSerializer;
|
||||
static Serializer<FrequencyItemResponse> get serializer =>
|
||||
_$frequencyItemResponseSerializer;
|
||||
}
|
||||
|
||||
class FrequencyFields {
|
||||
static const String name = 'name';
|
||||
static const String dateInterval = 'dateInterval';
|
||||
|
||||
}
|
||||
|
||||
|
||||
abstract class FrequencyEntity implements Built<FrequencyEntity, FrequencyEntityBuilder> {
|
||||
|
||||
abstract class FrequencyEntity
|
||||
implements Built<FrequencyEntity, FrequencyEntityBuilder> {
|
||||
factory FrequencyEntity() {
|
||||
return _$FrequencyEntity._(
|
||||
id: 0,
|
||||
|
|
@ -47,6 +49,6 @@ abstract class FrequencyEntity implements Built<FrequencyEntity, FrequencyEntity
|
|||
@BuiltValueField(wireName: 'date_interval')
|
||||
String get dateInterval;
|
||||
|
||||
static Serializer<FrequencyEntity> get serializer => _$frequencyEntitySerializer;
|
||||
static Serializer<FrequencyEntity> get serializer =>
|
||||
_$frequencyEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,32 +5,37 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'industry_model.g.dart';
|
||||
|
||||
abstract class IndustryListResponse implements Built<IndustryListResponse, IndustryListResponseBuilder> {
|
||||
|
||||
factory IndustryListResponse([void updates(IndustryListResponseBuilder b)]) = _$IndustryListResponse;
|
||||
abstract class IndustryListResponse
|
||||
implements Built<IndustryListResponse, IndustryListResponseBuilder> {
|
||||
factory IndustryListResponse([void updates(IndustryListResponseBuilder b)]) =
|
||||
_$IndustryListResponse;
|
||||
IndustryListResponse._();
|
||||
|
||||
BuiltList<IndustryEntity> get data;
|
||||
|
||||
static Serializer<IndustryListResponse> get serializer => _$industryListResponseSerializer;
|
||||
static Serializer<IndustryListResponse> get serializer =>
|
||||
_$industryListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class IndustryItemResponse implements Built<IndustryItemResponse, IndustryItemResponseBuilder> {
|
||||
|
||||
factory IndustryItemResponse([void updates(IndustryItemResponseBuilder b)]) = _$IndustryItemResponse;
|
||||
abstract class IndustryItemResponse
|
||||
implements Built<IndustryItemResponse, IndustryItemResponseBuilder> {
|
||||
factory IndustryItemResponse([void updates(IndustryItemResponseBuilder b)]) =
|
||||
_$IndustryItemResponse;
|
||||
IndustryItemResponse._();
|
||||
|
||||
IndustryEntity get data;
|
||||
|
||||
static Serializer<IndustryItemResponse> get serializer => _$industryItemResponseSerializer;
|
||||
static Serializer<IndustryItemResponse> get serializer =>
|
||||
_$industryItemResponseSerializer;
|
||||
}
|
||||
|
||||
class IndustryFields {
|
||||
static const String name = 'name';
|
||||
}
|
||||
|
||||
abstract class IndustryEntity extends Object with SelectableEntity implements Built<IndustryEntity, IndustryEntityBuilder> {
|
||||
|
||||
abstract class IndustryEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<IndustryEntity, IndustryEntityBuilder> {
|
||||
factory IndustryEntity() {
|
||||
return _$IndustryEntity._(
|
||||
id: 0,
|
||||
|
|
@ -75,5 +80,6 @@ abstract class IndustryEntity extends Object with SelectableEntity implements Bu
|
|||
@override
|
||||
double get listDisplayAmount => null;
|
||||
|
||||
static Serializer<IndustryEntity> get serializer => _$industryEntitySerializer;
|
||||
}
|
||||
static Serializer<IndustryEntity> get serializer =>
|
||||
_$industryEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,35 +4,42 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
part 'invoice_design_model.g.dart';
|
||||
|
||||
abstract class InvoiceDesignListResponse implements Built<InvoiceDesignListResponse, InvoiceDesignListResponseBuilder> {
|
||||
|
||||
factory InvoiceDesignListResponse([void updates(InvoiceDesignListResponseBuilder b)]) = _$InvoiceDesignListResponse;
|
||||
abstract class InvoiceDesignListResponse
|
||||
implements
|
||||
Built<InvoiceDesignListResponse, InvoiceDesignListResponseBuilder> {
|
||||
factory InvoiceDesignListResponse(
|
||||
[void updates(InvoiceDesignListResponseBuilder b)]) =
|
||||
_$InvoiceDesignListResponse;
|
||||
InvoiceDesignListResponse._();
|
||||
|
||||
BuiltList<InvoiceDesignEntity> get data;
|
||||
|
||||
static Serializer<InvoiceDesignListResponse> get serializer => _$invoiceDesignListResponseSerializer;
|
||||
static Serializer<InvoiceDesignListResponse> get serializer =>
|
||||
_$invoiceDesignListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class InvoiceDesignItemResponse implements Built<InvoiceDesignItemResponse, InvoiceDesignItemResponseBuilder> {
|
||||
|
||||
factory InvoiceDesignItemResponse([void updates(InvoiceDesignItemResponseBuilder b)]) = _$InvoiceDesignItemResponse;
|
||||
abstract class InvoiceDesignItemResponse
|
||||
implements
|
||||
Built<InvoiceDesignItemResponse, InvoiceDesignItemResponseBuilder> {
|
||||
factory InvoiceDesignItemResponse(
|
||||
[void updates(InvoiceDesignItemResponseBuilder b)]) =
|
||||
_$InvoiceDesignItemResponse;
|
||||
InvoiceDesignItemResponse._();
|
||||
|
||||
InvoiceDesignEntity get data;
|
||||
|
||||
static Serializer<InvoiceDesignItemResponse> get serializer => _$invoiceDesignItemResponseSerializer;
|
||||
static Serializer<InvoiceDesignItemResponse> get serializer =>
|
||||
_$invoiceDesignItemResponseSerializer;
|
||||
}
|
||||
|
||||
class InvoiceDesignFields {
|
||||
static const String name = 'name';
|
||||
static const String javascript = 'javascript';
|
||||
static const String pdfmake = 'pdfmake';
|
||||
|
||||
}
|
||||
|
||||
abstract class InvoiceDesignEntity implements Built<InvoiceDesignEntity, InvoiceDesignEntityBuilder> {
|
||||
|
||||
abstract class InvoiceDesignEntity
|
||||
implements Built<InvoiceDesignEntity, InvoiceDesignEntityBuilder> {
|
||||
factory InvoiceDesignEntity() {
|
||||
return _$InvoiceDesignEntity._(
|
||||
id: 0,
|
||||
|
|
@ -43,12 +50,11 @@ abstract class InvoiceDesignEntity implements Built<InvoiceDesignEntity, Invoice
|
|||
}
|
||||
InvoiceDesignEntity._();
|
||||
|
||||
|
||||
int get id;
|
||||
String get name;
|
||||
String get javascript;
|
||||
String get pdfmake;
|
||||
|
||||
static Serializer<InvoiceDesignEntity> get serializer => _$invoiceDesignEntitySerializer;
|
||||
}
|
||||
|
||||
static Serializer<InvoiceDesignEntity> get serializer =>
|
||||
_$invoiceDesignEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,35 +5,41 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'invoice_status_model.g.dart';
|
||||
|
||||
abstract class InvoiceStatusListResponse implements Built<InvoiceStatusListResponse, InvoiceStatusListResponseBuilder> {
|
||||
|
||||
factory InvoiceStatusListResponse([void updates(InvoiceStatusListResponseBuilder b)]) = _$InvoiceStatusListResponse;
|
||||
abstract class InvoiceStatusListResponse
|
||||
implements
|
||||
Built<InvoiceStatusListResponse, InvoiceStatusListResponseBuilder> {
|
||||
factory InvoiceStatusListResponse(
|
||||
[void updates(InvoiceStatusListResponseBuilder b)]) =
|
||||
_$InvoiceStatusListResponse;
|
||||
InvoiceStatusListResponse._();
|
||||
|
||||
BuiltList<InvoiceStatusEntity> get data;
|
||||
|
||||
static Serializer<InvoiceStatusListResponse> get serializer => _$invoiceStatusListResponseSerializer;
|
||||
static Serializer<InvoiceStatusListResponse> get serializer =>
|
||||
_$invoiceStatusListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class InvoiceStatusItemResponse implements Built<InvoiceStatusItemResponse, InvoiceStatusItemResponseBuilder> {
|
||||
|
||||
factory InvoiceStatusItemResponse([void updates(InvoiceStatusItemResponseBuilder b)]) = _$InvoiceStatusItemResponse;
|
||||
abstract class InvoiceStatusItemResponse
|
||||
implements
|
||||
Built<InvoiceStatusItemResponse, InvoiceStatusItemResponseBuilder> {
|
||||
factory InvoiceStatusItemResponse(
|
||||
[void updates(InvoiceStatusItemResponseBuilder b)]) =
|
||||
_$InvoiceStatusItemResponse;
|
||||
InvoiceStatusItemResponse._();
|
||||
|
||||
InvoiceStatusEntity get data;
|
||||
|
||||
static Serializer<InvoiceStatusItemResponse> get serializer => _$invoiceStatusItemResponseSerializer;
|
||||
static Serializer<InvoiceStatusItemResponse> get serializer =>
|
||||
_$invoiceStatusItemResponseSerializer;
|
||||
}
|
||||
|
||||
class InvoiceStatusFields {
|
||||
static const String name = 'name';
|
||||
|
||||
}
|
||||
|
||||
abstract class InvoiceStatusEntity extends Object
|
||||
with EntityStatus
|
||||
implements Built<InvoiceStatusEntity, InvoiceStatusEntityBuilder> {
|
||||
|
||||
factory InvoiceStatusEntity() {
|
||||
return _$InvoiceStatusEntity._(
|
||||
id: 0,
|
||||
|
|
@ -46,4 +52,3 @@ abstract class InvoiceStatusEntity extends Object
|
|||
static Serializer<InvoiceStatusEntity> get serializer =>
|
||||
_$invoiceStatusEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,34 +5,38 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'language_model.g.dart';
|
||||
|
||||
abstract class LanguageListResponse implements Built<LanguageListResponse, LanguageListResponseBuilder> {
|
||||
|
||||
factory LanguageListResponse([void updates(LanguageListResponseBuilder b)]) = _$LanguageListResponse;
|
||||
abstract class LanguageListResponse
|
||||
implements Built<LanguageListResponse, LanguageListResponseBuilder> {
|
||||
factory LanguageListResponse([void updates(LanguageListResponseBuilder b)]) =
|
||||
_$LanguageListResponse;
|
||||
LanguageListResponse._();
|
||||
|
||||
BuiltList<LanguageEntity> get data;
|
||||
|
||||
static Serializer<LanguageListResponse> get serializer => _$languageListResponseSerializer;
|
||||
static Serializer<LanguageListResponse> get serializer =>
|
||||
_$languageListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class LanguageItemResponse implements Built<LanguageItemResponse, LanguageItemResponseBuilder> {
|
||||
|
||||
factory LanguageItemResponse([void updates(LanguageItemResponseBuilder b)]) = _$LanguageItemResponse;
|
||||
abstract class LanguageItemResponse
|
||||
implements Built<LanguageItemResponse, LanguageItemResponseBuilder> {
|
||||
factory LanguageItemResponse([void updates(LanguageItemResponseBuilder b)]) =
|
||||
_$LanguageItemResponse;
|
||||
LanguageItemResponse._();
|
||||
|
||||
LanguageEntity get data;
|
||||
|
||||
static Serializer<LanguageItemResponse> get serializer => _$languageItemResponseSerializer;
|
||||
static Serializer<LanguageItemResponse> get serializer =>
|
||||
_$languageItemResponseSerializer;
|
||||
}
|
||||
|
||||
class LanguageFields {
|
||||
static const String name = 'name';
|
||||
static const String locale = 'locale';
|
||||
|
||||
}
|
||||
|
||||
abstract class LanguageEntity extends Object with SelectableEntity implements Built<LanguageEntity, LanguageEntityBuilder> {
|
||||
|
||||
abstract class LanguageEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<LanguageEntity, LanguageEntityBuilder> {
|
||||
factory LanguageEntity() {
|
||||
return _$LanguageEntity._(
|
||||
id: 0,
|
||||
|
|
@ -83,6 +87,6 @@ abstract class LanguageEntity extends Object with SelectableEntity implements Bu
|
|||
@override
|
||||
double get listDisplayAmount => null;
|
||||
|
||||
static Serializer<LanguageEntity> get serializer => _$languageEntitySerializer;
|
||||
static Serializer<LanguageEntity> get serializer =>
|
||||
_$languageEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,34 +5,40 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'payment_type_model.g.dart';
|
||||
|
||||
abstract class PaymentTypeListResponse implements Built<PaymentTypeListResponse, PaymentTypeListResponseBuilder> {
|
||||
|
||||
factory PaymentTypeListResponse([void updates(PaymentTypeListResponseBuilder b)]) = _$PaymentTypeListResponse;
|
||||
abstract class PaymentTypeListResponse
|
||||
implements Built<PaymentTypeListResponse, PaymentTypeListResponseBuilder> {
|
||||
factory PaymentTypeListResponse(
|
||||
[void updates(PaymentTypeListResponseBuilder b)]) =
|
||||
_$PaymentTypeListResponse;
|
||||
PaymentTypeListResponse._();
|
||||
|
||||
BuiltList<PaymentTypeEntity> get data;
|
||||
|
||||
static Serializer<PaymentTypeListResponse> get serializer => _$paymentTypeListResponseSerializer;
|
||||
static Serializer<PaymentTypeListResponse> get serializer =>
|
||||
_$paymentTypeListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class PaymentTypeItemResponse implements Built<PaymentTypeItemResponse, PaymentTypeItemResponseBuilder> {
|
||||
|
||||
factory PaymentTypeItemResponse([void updates(PaymentTypeItemResponseBuilder b)]) = _$PaymentTypeItemResponse;
|
||||
abstract class PaymentTypeItemResponse
|
||||
implements Built<PaymentTypeItemResponse, PaymentTypeItemResponseBuilder> {
|
||||
factory PaymentTypeItemResponse(
|
||||
[void updates(PaymentTypeItemResponseBuilder b)]) =
|
||||
_$PaymentTypeItemResponse;
|
||||
PaymentTypeItemResponse._();
|
||||
|
||||
PaymentTypeEntity get data;
|
||||
|
||||
static Serializer<PaymentTypeItemResponse> get serializer => _$paymentTypeItemResponseSerializer;
|
||||
static Serializer<PaymentTypeItemResponse> get serializer =>
|
||||
_$paymentTypeItemResponseSerializer;
|
||||
}
|
||||
|
||||
class PaymentTypeFields {
|
||||
static const String name = 'name';
|
||||
static const String gatewayTypeId = 'gatewayTypeId';
|
||||
|
||||
}
|
||||
|
||||
abstract class PaymentTypeEntity extends Object with SelectableEntity implements Built<PaymentTypeEntity, PaymentTypeEntityBuilder> {
|
||||
|
||||
abstract class PaymentTypeEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<PaymentTypeEntity, PaymentTypeEntityBuilder> {
|
||||
factory PaymentTypeEntity() {
|
||||
return _$PaymentTypeEntity._(
|
||||
id: 0,
|
||||
|
|
@ -75,6 +81,6 @@ abstract class PaymentTypeEntity extends Object with SelectableEntity implements
|
|||
@override
|
||||
double get listDisplayAmount => null;
|
||||
|
||||
static Serializer<PaymentTypeEntity> get serializer => _$paymentTypeEntitySerializer;
|
||||
static Serializer<PaymentTypeEntity> get serializer =>
|
||||
_$paymentTypeEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,32 +5,37 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
|
||||
part 'size_model.g.dart';
|
||||
|
||||
abstract class SizeListResponse implements Built<SizeListResponse, SizeListResponseBuilder> {
|
||||
|
||||
factory SizeListResponse([void updates(SizeListResponseBuilder b)]) = _$SizeListResponse;
|
||||
abstract class SizeListResponse
|
||||
implements Built<SizeListResponse, SizeListResponseBuilder> {
|
||||
factory SizeListResponse([void updates(SizeListResponseBuilder b)]) =
|
||||
_$SizeListResponse;
|
||||
SizeListResponse._();
|
||||
|
||||
BuiltList<SizeEntity> get data;
|
||||
|
||||
static Serializer<SizeListResponse> get serializer => _$sizeListResponseSerializer;
|
||||
static Serializer<SizeListResponse> get serializer =>
|
||||
_$sizeListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class SizeItemResponse implements Built<SizeItemResponse, SizeItemResponseBuilder> {
|
||||
|
||||
factory SizeItemResponse([void updates(SizeItemResponseBuilder b)]) = _$SizeItemResponse;
|
||||
abstract class SizeItemResponse
|
||||
implements Built<SizeItemResponse, SizeItemResponseBuilder> {
|
||||
factory SizeItemResponse([void updates(SizeItemResponseBuilder b)]) =
|
||||
_$SizeItemResponse;
|
||||
SizeItemResponse._();
|
||||
|
||||
SizeEntity get data;
|
||||
|
||||
static Serializer<SizeItemResponse> get serializer => _$sizeItemResponseSerializer;
|
||||
static Serializer<SizeItemResponse> get serializer =>
|
||||
_$sizeItemResponseSerializer;
|
||||
}
|
||||
|
||||
class SizeFields {
|
||||
static const String name = 'name';
|
||||
}
|
||||
|
||||
abstract class SizeEntity extends Object with SelectableEntity implements Built<SizeEntity, SizeEntityBuilder> {
|
||||
|
||||
abstract class SizeEntity extends Object
|
||||
with SelectableEntity
|
||||
implements Built<SizeEntity, SizeEntityBuilder> {
|
||||
factory SizeEntity() {
|
||||
return _$SizeEntity._(
|
||||
id: 0,
|
||||
|
|
@ -76,4 +81,4 @@ abstract class SizeEntity extends Object with SelectableEntity implements Built<
|
|||
double get listDisplayAmount => null;
|
||||
|
||||
static Serializer<SizeEntity> get serializer => _$sizeEntitySerializer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,24 +17,30 @@ import 'package:invoiceninja_flutter/data/models/static/frequency_model.dart';
|
|||
|
||||
part 'static_data_model.g.dart';
|
||||
|
||||
abstract class StaticDataListResponse implements Built<StaticDataListResponse, StaticDataListResponseBuilder> {
|
||||
|
||||
factory StaticDataListResponse([void updates(StaticDataListResponseBuilder b)]) = _$StaticDataListResponse;
|
||||
abstract class StaticDataListResponse
|
||||
implements Built<StaticDataListResponse, StaticDataListResponseBuilder> {
|
||||
factory StaticDataListResponse(
|
||||
[void updates(StaticDataListResponseBuilder b)]) =
|
||||
_$StaticDataListResponse;
|
||||
StaticDataListResponse._();
|
||||
|
||||
BuiltList<StaticDataEntity> get data;
|
||||
|
||||
static Serializer<StaticDataListResponse> get serializer => _$staticDataListResponseSerializer;
|
||||
static Serializer<StaticDataListResponse> get serializer =>
|
||||
_$staticDataListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class StaticDataItemResponse implements Built<StaticDataItemResponse, StaticDataItemResponseBuilder> {
|
||||
|
||||
factory StaticDataItemResponse([void updates(StaticDataItemResponseBuilder b)]) = _$StaticDataItemResponse;
|
||||
abstract class StaticDataItemResponse
|
||||
implements Built<StaticDataItemResponse, StaticDataItemResponseBuilder> {
|
||||
factory StaticDataItemResponse(
|
||||
[void updates(StaticDataItemResponseBuilder b)]) =
|
||||
_$StaticDataItemResponse;
|
||||
StaticDataItemResponse._();
|
||||
|
||||
StaticDataEntity get data;
|
||||
|
||||
static Serializer<StaticDataItemResponse> get serializer => _$staticDataItemResponseSerializer;
|
||||
static Serializer<StaticDataItemResponse> get serializer =>
|
||||
_$staticDataItemResponseSerializer;
|
||||
}
|
||||
|
||||
class StaticDataFields {
|
||||
|
|
@ -56,8 +62,8 @@ class StaticDataFields {
|
|||
static const String banks = 'banks';
|
||||
}
|
||||
|
||||
abstract class StaticDataEntity implements Built<StaticDataEntity, StaticDataEntityBuilder> {
|
||||
|
||||
abstract class StaticDataEntity
|
||||
implements Built<StaticDataEntity, StaticDataEntityBuilder> {
|
||||
factory StaticDataEntity() {
|
||||
return _$StaticDataEntity._(
|
||||
currencies: BuiltList<CurrencyEntity>(),
|
||||
|
|
@ -100,6 +106,6 @@ abstract class StaticDataEntity implements Built<StaticDataEntity, StaticDataEnt
|
|||
|
||||
BuiltList<FrequencyEntity> get frequencies;
|
||||
|
||||
static Serializer<StaticDataEntity> get serializer => _$staticDataEntitySerializer;
|
||||
static Serializer<StaticDataEntity> get serializer =>
|
||||
_$staticDataEntitySerializer;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,24 +4,28 @@ import 'package:built_value/serializer.dart';
|
|||
|
||||
part 'timezone_model.g.dart';
|
||||
|
||||
abstract class TimezoneListResponse implements Built<TimezoneListResponse, TimezoneListResponseBuilder> {
|
||||
|
||||
factory TimezoneListResponse([void updates(TimezoneListResponseBuilder b)]) = _$TimezoneListResponse;
|
||||
abstract class TimezoneListResponse
|
||||
implements Built<TimezoneListResponse, TimezoneListResponseBuilder> {
|
||||
factory TimezoneListResponse([void updates(TimezoneListResponseBuilder b)]) =
|
||||
_$TimezoneListResponse;
|
||||
TimezoneListResponse._();
|
||||
|
||||
BuiltList<TimezoneEntity> get data;
|
||||
|
||||
static Serializer<TimezoneListResponse> get serializer => _$timezoneListResponseSerializer;
|
||||
static Serializer<TimezoneListResponse> get serializer =>
|
||||
_$timezoneListResponseSerializer;
|
||||
}
|
||||
|
||||
abstract class TimezoneItemResponse implements Built<TimezoneItemResponse, TimezoneItemResponseBuilder> {
|
||||
|
||||
factory TimezoneItemResponse([void updates(TimezoneItemResponseBuilder b)]) = _$TimezoneItemResponse;
|
||||
abstract class TimezoneItemResponse
|
||||
implements Built<TimezoneItemResponse, TimezoneItemResponseBuilder> {
|
||||
factory TimezoneItemResponse([void updates(TimezoneItemResponseBuilder b)]) =
|
||||
_$TimezoneItemResponse;
|
||||
TimezoneItemResponse._();
|
||||
|
||||
TimezoneEntity get data;
|
||||
|
||||
static Serializer<TimezoneItemResponse> get serializer => _$timezoneItemResponseSerializer;
|
||||
static Serializer<TimezoneItemResponse> get serializer =>
|
||||
_$timezoneItemResponseSerializer;
|
||||
}
|
||||
|
||||
class TimezoneFields {
|
||||
|
|
@ -29,8 +33,8 @@ class TimezoneFields {
|
|||
static const String location = 'location';
|
||||
}
|
||||
|
||||
abstract class TimezoneEntity implements Built<TimezoneEntity, TimezoneEntityBuilder> {
|
||||
|
||||
abstract class TimezoneEntity
|
||||
implements Built<TimezoneEntity, TimezoneEntityBuilder> {
|
||||
factory TimezoneEntity() {
|
||||
return _$TimezoneEntity._(
|
||||
id: 0,
|
||||
|
|
@ -45,6 +49,7 @@ abstract class TimezoneEntity implements Built<TimezoneEntity, TimezoneEntityBui
|
|||
String get name;
|
||||
|
||||
String get location;
|
||||
|
||||
static Serializer<TimezoneEntity> get serializer => _$timezoneEntitySerializer;
|
||||
}
|
||||
|
||||
static Serializer<TimezoneEntity> get serializer =>
|
||||
_$timezoneEntitySerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,6 @@ abstract class TaskEntity extends Object
|
|||
@BuiltValueField(wireName: 'task_status_sort_order')
|
||||
int get taskStatusSortOrder;
|
||||
|
||||
|
||||
List<EntityAction> getEntityActions(
|
||||
{UserEntity user, ClientEntity client, bool includeEdit = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
|
|
|||
|
|
@ -60,7 +60,8 @@ class AuthRepository {
|
|||
|
||||
Future<LoginResponseData> sendRequest(
|
||||
{String url, dynamic data, String token}) async {
|
||||
url += '?include=tax_rates,users,custom_payment_terms,task_statuses&include_static=true';
|
||||
url +=
|
||||
'?include=tax_rates,users,custom_payment_terms,task_statuses&include_static=true';
|
||||
|
||||
final dynamic response =
|
||||
await webClient.post(url, token ?? '', json.encode(data));
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class ProjectRepository {
|
|||
|
||||
Future<ProjectEntity> loadItem(
|
||||
CompanyEntity company, AuthState auth, int entityId) async {
|
||||
final dynamic response = await webClient.get(
|
||||
'${auth.url}/projects/$entityId', company.token);
|
||||
final dynamic response =
|
||||
await webClient.get('${auth.url}/projects/$entityId', company.token);
|
||||
|
||||
final ProjectItemResponse projectResponse =
|
||||
serializers.deserializeWith(ProjectItemResponse.serializer, response);
|
||||
|
|
@ -41,7 +41,7 @@ class ProjectRepository {
|
|||
|
||||
return projectResponse.data;
|
||||
}
|
||||
|
||||
|
||||
Future<ProjectEntity> saveData(
|
||||
CompanyEntity company, AuthState auth, ProjectEntity project,
|
||||
[EntityAction action]) async {
|
||||
|
|
@ -50,9 +50,7 @@ class ProjectRepository {
|
|||
|
||||
if (project.isNew) {
|
||||
response = await webClient.post(
|
||||
auth.url + '/projects',
|
||||
company.token,
|
||||
json.encode(data));
|
||||
auth.url + '/projects', company.token, json.encode(data));
|
||||
} else {
|
||||
var url = auth.url + '/projects/' + project.id.toString();
|
||||
if (action != null) {
|
||||
|
|
@ -62,7 +60,7 @@ class ProjectRepository {
|
|||
}
|
||||
|
||||
final ProjectItemResponse projectResponse =
|
||||
serializers.deserializeWith(ProjectItemResponse.serializer, response);
|
||||
serializers.deserializeWith(ProjectItemResponse.serializer, response);
|
||||
|
||||
return projectResponse.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,9 @@ class TaskRepository {
|
|||
Future<TaskEntity> saveData(
|
||||
CompanyEntity company, AuthState auth, TaskEntity task,
|
||||
[EntityAction action]) async {
|
||||
|
||||
// Workaround for API issue
|
||||
if (task.isNew) {
|
||||
task = task.rebuild((b) => b
|
||||
..id = null);
|
||||
task = task.rebuild((b) => b..id = null);
|
||||
}
|
||||
|
||||
final data = serializers.serializeWith(TaskEntity.serializer, task);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
import 'package:invoiceninja_flutter/data/web_client.dart';
|
||||
|
||||
class VendorRepository {
|
||||
|
||||
const VendorRepository({
|
||||
this.webClient = const WebClient(),
|
||||
});
|
||||
|
|
@ -18,8 +17,8 @@ class VendorRepository {
|
|||
|
||||
Future<VendorEntity> loadItem(
|
||||
CompanyEntity company, AuthState auth, int entityId) async {
|
||||
final dynamic response = await webClient.get(
|
||||
'${auth.url}/vendors/$entityId', company.token);
|
||||
final dynamic response =
|
||||
await webClient.get('${auth.url}/vendors/$entityId', company.token);
|
||||
|
||||
final VendorItemResponse vendorResponse =
|
||||
serializers.deserializeWith(VendorItemResponse.serializer, response);
|
||||
|
|
@ -42,7 +41,7 @@ class VendorRepository {
|
|||
|
||||
return vendorResponse.data;
|
||||
}
|
||||
|
||||
|
||||
Future<VendorEntity> saveData(
|
||||
CompanyEntity company, AuthState auth, VendorEntity vendor,
|
||||
[EntityAction action]) async {
|
||||
|
|
@ -51,9 +50,7 @@ class VendorRepository {
|
|||
|
||||
if (vendor.isNew) {
|
||||
response = await webClient.post(
|
||||
auth.url + '/vendors',
|
||||
company.token,
|
||||
json.encode(data));
|
||||
auth.url + '/vendors', company.token, json.encode(data));
|
||||
} else {
|
||||
var url = auth.url + '/vendors/' + vendor.id.toString();
|
||||
if (action != null) {
|
||||
|
|
@ -63,7 +60,7 @@ class VendorRepository {
|
|||
}
|
||||
|
||||
final VendorItemResponse vendorResponse =
|
||||
serializers.deserializeWith(VendorItemResponse.serializer, response);
|
||||
serializers.deserializeWith(VendorItemResponse.serializer, response);
|
||||
|
||||
return vendorResponse.data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,8 +97,7 @@ void main() async {
|
|||
..addAll(createStoreInvoicesMiddleware())
|
||||
..addAll(createStorePersistenceMiddleware())
|
||||
// STARTER: middleware - do not remove comment
|
||||
..addAll(createStoreVendorsMiddleware())
|
||||
|
||||
..addAll(createStoreVendorsMiddleware())
|
||||
..addAll(createStoreTasksMiddleware())
|
||||
..addAll(createStoreProjectsMiddleware())
|
||||
..addAll(createStorePaymentsMiddleware())
|
||||
|
|
@ -307,12 +306,12 @@ class InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
|||
InvoiceEditScreen.route: (context) => InvoiceEditScreen(),
|
||||
InvoiceEmailScreen.route: (context) => InvoiceEmailScreen(),
|
||||
// STARTER: routes - do not remove comment
|
||||
VendorScreen.route: (context) {
|
||||
widget.store.dispatch(LoadVendors());
|
||||
return VendorScreen();
|
||||
},
|
||||
VendorViewScreen.route: (context) => VendorViewScreen(),
|
||||
VendorEditScreen.route: (context) => VendorEditScreen(),
|
||||
VendorScreen.route: (context) {
|
||||
widget.store.dispatch(LoadVendors());
|
||||
return VendorScreen();
|
||||
},
|
||||
VendorViewScreen.route: (context) => VendorViewScreen(),
|
||||
VendorEditScreen.route: (context) => VendorEditScreen(),
|
||||
|
||||
TaskScreen.route: (context) {
|
||||
widget.store.dispatch(LoadTasks());
|
||||
|
|
|
|||
|
|
@ -352,7 +352,7 @@ Middleware<AppState> _createDeleteState(
|
|||
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
for (int i=0; i<5; i++) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
prefs.setString(getCompanyTokenKey(i), '');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ import 'package:invoiceninja_flutter/redux/company/company_reducer.dart';
|
|||
AppState appReducer(AppState state, dynamic action) {
|
||||
if (action is UserLogout) {
|
||||
return AppState().rebuild((b) => b
|
||||
..authState.replace(state.authState)
|
||||
..uiState.enableDarkMode = state.uiState.enableDarkMode);
|
||||
..authState.replace(state.authState)
|
||||
..uiState.enableDarkMode = state.uiState.enableDarkMode);
|
||||
} else if (action is LoadStateSuccess) {
|
||||
return action.state.rebuild((b) => b
|
||||
..isLoading = false
|
||||
..isSaving = false
|
||||
);
|
||||
..isLoading = false
|
||||
..isSaving = false);
|
||||
}
|
||||
|
||||
return state.rebuild((b) => b
|
||||
|
|
@ -25,15 +24,19 @@ AppState appReducer(AppState state, dynamic action) {
|
|||
..authState.replace(authReducer(state.authState, action))
|
||||
..staticState.replace(staticReducer(state.staticState, action))
|
||||
..companyState1.replace(state.uiState.selectedCompanyIndex == 1
|
||||
? companyReducer(state.companyState1, action) : state.companyState1)
|
||||
? companyReducer(state.companyState1, action)
|
||||
: state.companyState1)
|
||||
..companyState2.replace(state.uiState.selectedCompanyIndex == 2
|
||||
? companyReducer(state.companyState2, action) : state.companyState2)
|
||||
? companyReducer(state.companyState2, action)
|
||||
: state.companyState2)
|
||||
..companyState3.replace(state.uiState.selectedCompanyIndex == 3
|
||||
? companyReducer(state.companyState3, action) : state.companyState3)
|
||||
? companyReducer(state.companyState3, action)
|
||||
: state.companyState3)
|
||||
..companyState4.replace(state.uiState.selectedCompanyIndex == 4
|
||||
? companyReducer(state.companyState4, action) : state.companyState4)
|
||||
? companyReducer(state.companyState4, action)
|
||||
: state.companyState4)
|
||||
..companyState5.replace(state.uiState.selectedCompanyIndex == 5
|
||||
? companyReducer(state.companyState5, action) : state.companyState5)
|
||||
..uiState.replace(uiReducer(state.uiState, action))
|
||||
);
|
||||
? companyReducer(state.companyState5, action)
|
||||
: state.companyState5)
|
||||
..uiState.replace(uiReducer(state.uiState, action)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,8 +109,8 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
case EntityType.invoice:
|
||||
return invoiceUIState;
|
||||
// STARTER: states switch - do not remove comment
|
||||
case EntityType.vendor:
|
||||
return vendorUIState;
|
||||
case EntityType.vendor:
|
||||
return vendorUIState;
|
||||
|
||||
case EntityType.task:
|
||||
return taskUIState;
|
||||
|
|
@ -150,10 +150,9 @@ return vendorUIState;
|
|||
ListUIState get invoiceListState => uiState.invoiceUIState.listUIState;
|
||||
|
||||
// STARTER: state getters - do not remove comment
|
||||
VendorState get vendorState => selectedCompanyState.vendorState;
|
||||
ListUIState get vendorListState => uiState.vendorUIState.listUIState;
|
||||
VendorUIState get vendorUIState => uiState.vendorUIState;
|
||||
|
||||
VendorState get vendorState => selectedCompanyState.vendorState;
|
||||
ListUIState get vendorListState => uiState.vendorUIState.listUIState;
|
||||
VendorUIState get vendorUIState => uiState.vendorUIState;
|
||||
|
||||
TaskState get taskState => selectedCompanyState.taskState;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ bool _setLoaded(bool state, StopLoading action) {
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
final savingReducer = combineReducers<bool>([
|
||||
TypedReducer<bool, StartSaving>(_setSaving),
|
||||
TypedReducer<bool, StopSaving>(_setSaved),
|
||||
|
|
|
|||
|
|
@ -39,10 +39,8 @@ void _saveAuthLocal(dynamic action) async {
|
|||
void _loadAuthLocal(Store<AppState> store, dynamic action) async {
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final String email = prefs.getString(kSharedPrefEmail) ?? '';
|
||||
final String url =
|
||||
formatApiUrlMachine(prefs.getString(kSharedPrefUrl) ?? '');
|
||||
final String secret =
|
||||
prefs.getString(kSharedPrefSecret) ?? '';
|
||||
final String url = formatApiUrlMachine(prefs.getString(kSharedPrefUrl) ?? '');
|
||||
final String secret = prefs.getString(kSharedPrefSecret) ?? '';
|
||||
store.dispatch(UserLoginLoaded(email, url, secret));
|
||||
|
||||
final bool enableDarkMode = prefs.getBool(kSharedPrefEnableDarkMode) ?? false;
|
||||
|
|
@ -135,8 +133,8 @@ Middleware<AppState> _createRefreshRequest(AuthRepository repository) {
|
|||
_loadAuthLocal(store, action);
|
||||
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final String url = formatApiUrlMachine(
|
||||
prefs.getString(kSharedPrefUrl) ?? Config.TEST_URL);
|
||||
final String url =
|
||||
formatApiUrlMachine(prefs.getString(kSharedPrefUrl) ?? Config.TEST_URL);
|
||||
final String token = prefs.getString(getCompanyTokenKey());
|
||||
|
||||
repository
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ Reducer<AuthState> authReducer = combineReducers([
|
|||
TypedReducer<AuthState, ClearAuthError>(clearAuthErrorReducer),
|
||||
]);
|
||||
|
||||
AuthState clearAuthErrorReducer(
|
||||
AuthState authState, ClearAuthError action) {
|
||||
AuthState clearAuthErrorReducer(AuthState authState, ClearAuthError action) {
|
||||
return authState.rebuild((b) => b..error = null);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import 'package:built_value/serializer.dart';
|
|||
part 'auth_state.g.dart';
|
||||
|
||||
abstract class AuthState implements Built<AuthState, AuthStateBuilder> {
|
||||
|
||||
factory AuthState() {
|
||||
return _$AuthState._(
|
||||
email: '',
|
||||
|
|
@ -27,7 +26,6 @@ abstract class AuthState implements Built<AuthState, AuthStateBuilder> {
|
|||
@nullable
|
||||
String get error;
|
||||
|
||||
|
||||
//factory AuthState([void updates(AuthStateBuilder b)]) = _$AuthState;
|
||||
static Serializer<AuthState> get serializer => _$authStateSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ ClientState _setLoadedClient(
|
|||
ClientState clientState, LoadClientSuccess action) {
|
||||
return clientState.rebuild((b) => b
|
||||
..map[action.client.id] = action.client.rebuild((b) =>
|
||||
b..lastUpdatedActivities = DateTime.now().millisecondsSinceEpoch));
|
||||
b..lastUpdatedActivities = DateTime.now().millisecondsSinceEpoch));
|
||||
}
|
||||
|
||||
ClientState _setLoadedClients(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
|||
part 'client_state.g.dart';
|
||||
|
||||
abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
||||
|
||||
factory ClientState() {
|
||||
return _$ClientState._(
|
||||
lastUpdated: 0,
|
||||
|
|
@ -26,11 +25,12 @@ abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
|||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated > kMillisecondsToRefreshData;
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded => lastUpdated != null && lastUpdated > 0;
|
||||
|
|
@ -38,8 +38,9 @@ abstract class ClientState implements Built<ClientState, ClientStateBuilder> {
|
|||
static Serializer<ClientState> get serializer => _$clientStateSerializer;
|
||||
}
|
||||
|
||||
abstract class ClientUIState extends Object with EntityUIState implements Built<ClientUIState, ClientUIStateBuilder> {
|
||||
|
||||
abstract class ClientUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ClientUIState, ClientUIStateBuilder> {
|
||||
factory ClientUIState() {
|
||||
return _$ClientUIState._(
|
||||
listUIState: ListUIState(ClientFields.name),
|
||||
|
|
@ -60,4 +61,4 @@ abstract class ClientUIState extends Object with EntityUIState implements Built<
|
|||
bool get isCreatingNew => editing.isNew;
|
||||
|
||||
static Serializer<ClientUIState> get serializer => _$clientUIStateSerializer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,8 +31,7 @@ CompanyState companyReducer(CompanyState state, dynamic action) {
|
|||
..productState.replace(productsReducer(state.productState, action))
|
||||
..invoiceState.replace(invoicesReducer(state.invoiceState, action))
|
||||
// STARTER: reducer - do not remove comment
|
||||
..vendorState.replace(vendorsReducer(state.vendorState, action))
|
||||
|
||||
..vendorState.replace(vendorsReducer(state.vendorState, action))
|
||||
..taskState.replace(tasksReducer(state.taskState, action))
|
||||
..projectState.replace(projectsReducer(state.projectState, action))
|
||||
..paymentState.replace(paymentsReducer(state.paymentState, action))
|
||||
|
|
@ -45,7 +44,6 @@ Reducer<CompanyEntity> companyEntityReducer = combineReducers([
|
|||
|
||||
CompanyEntity loadCompanySuccessReducer(
|
||||
CompanyEntity company, LoadCompanySuccess action) {
|
||||
|
||||
if (action.company.taskStatuses == null) {
|
||||
return action.company;
|
||||
} else {
|
||||
|
|
@ -54,8 +52,7 @@ CompanyEntity loadCompanySuccessReducer(
|
|||
action.company.taskStatuses,
|
||||
key: (dynamic item) => item.id,
|
||||
value: (dynamic item) => item,
|
||||
))
|
||||
);
|
||||
)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ abstract class CompanyState
|
|||
clientState: ClientState(),
|
||||
invoiceState: InvoiceState(),
|
||||
// STARTER: constructor - do not remove comment
|
||||
vendorState: VendorState(),
|
||||
vendorState: VendorState(),
|
||||
|
||||
taskState: TaskState(),
|
||||
projectState: ProjectState(),
|
||||
|
|
@ -52,7 +52,7 @@ vendorState: VendorState(),
|
|||
InvoiceState get invoiceState;
|
||||
|
||||
// STARTER: fields - do not remove comment
|
||||
VendorState get vendorState;
|
||||
VendorState get vendorState;
|
||||
|
||||
TaskState get taskState;
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ List<Middleware<AppState>> createStoreDashboardMiddleware([
|
|||
];
|
||||
}
|
||||
|
||||
|
||||
Middleware<AppState> _createViewDashboard() {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
store.dispatch(LoadDashboard());
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ abstract class DashboardUIState
|
|||
String startDate(CompanyEntity company) {
|
||||
final today = DateTime.now();
|
||||
final firstDayOfMonth = DateTime.utc(today.year, today.month, 1);
|
||||
final firstDayOfYear = DateTime.utc(today.year, company.firstMonthOfYear, 1);
|
||||
final firstDayOfYear =
|
||||
DateTime.utc(today.year, company.firstMonthOfYear, 1);
|
||||
switch (dateRange) {
|
||||
case DateRange.last7Days:
|
||||
final date = today.subtract(Duration(days: 7 * (1 + offset)));
|
||||
|
|
@ -115,7 +116,8 @@ abstract class DashboardUIState
|
|||
String endDate(CompanyEntity company) {
|
||||
final today = DateTime.now();
|
||||
final firstDayOfMonth = DateTime.utc(today.year, today.month, 1);
|
||||
final firstDayOfYear = DateTime.utc(today.year, company.firstMonthOfYear, 1);
|
||||
final firstDayOfYear =
|
||||
DateTime.utc(today.year, company.firstMonthOfYear, 1);
|
||||
switch (dateRange) {
|
||||
case DateRange.last7Days:
|
||||
final date = today.subtract(Duration(days: 7 * offset));
|
||||
|
|
|
|||
|
|
@ -248,7 +248,6 @@ Middleware<AppState> _loadInvoice(InvoiceRepository repository) {
|
|||
repository
|
||||
.loadItem(state.selectedCompany, state.authState, action.invoiceId)
|
||||
.then((invoice) {
|
||||
|
||||
store.dispatch(LoadInvoiceSuccess(invoice));
|
||||
store.dispatch(LoadClient(clientId: invoice.clientId));
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,9 @@ Middleware<AppState> _archivePayment(PaymentRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origPayment = store.state.paymentState.map[action.paymentId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origPayment, action: EntityAction.archive)
|
||||
.saveData(
|
||||
store.state.selectedCompany, store.state.authState, origPayment,
|
||||
action: EntityAction.archive)
|
||||
.then((PaymentEntity payment) {
|
||||
store.dispatch(ArchivePaymentSuccess(payment));
|
||||
if (action.completer != null) {
|
||||
|
|
@ -102,8 +103,9 @@ Middleware<AppState> _deletePayment(PaymentRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origPayment = store.state.paymentState.map[action.paymentId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origPayment, action: EntityAction.delete)
|
||||
.saveData(
|
||||
store.state.selectedCompany, store.state.authState, origPayment,
|
||||
action: EntityAction.delete)
|
||||
.then((PaymentEntity payment) {
|
||||
store.dispatch(DeletePaymentSuccess(payment));
|
||||
store.dispatch(LoadInvoice(invoiceId: payment.invoiceId));
|
||||
|
|
@ -126,8 +128,9 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origPayment = store.state.paymentState.map[action.paymentId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origPayment, action: EntityAction.restore)
|
||||
.saveData(
|
||||
store.state.selectedCompany, store.state.authState, origPayment,
|
||||
action: EntityAction.restore)
|
||||
.then((PaymentEntity payment) {
|
||||
store.dispatch(RestorePaymentSuccess(payment));
|
||||
store.dispatch(LoadInvoice(invoiceId: payment.invoiceId));
|
||||
|
|
@ -149,10 +152,12 @@ Middleware<AppState> _restorePayment(PaymentRepository repository) {
|
|||
Middleware<AppState> _savePayment(PaymentRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final PaymentEntity payment = action.payment;
|
||||
final bool sendEmail = payment.isNew ? store.state.uiState.emailPayment : false;
|
||||
final bool sendEmail =
|
||||
payment.isNew ? store.state.uiState.emailPayment : false;
|
||||
repository
|
||||
.saveData(
|
||||
store.state.selectedCompany, store.state.authState, action.payment, sendEmail: sendEmail)
|
||||
store.state.selectedCompany, store.state.authState, action.payment,
|
||||
sendEmail: sendEmail)
|
||||
.then((PaymentEntity payment) {
|
||||
if (action.payment.isNew) {
|
||||
store.dispatch(AddPaymentSuccess(payment));
|
||||
|
|
@ -175,7 +180,8 @@ Middleware<AppState> _emailPayment(PaymentRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
repository
|
||||
.saveData(
|
||||
store.state.selectedCompany, store.state.authState, action.payment, sendEmail: true)
|
||||
store.state.selectedCompany, store.state.authState, action.payment,
|
||||
sendEmail: true)
|
||||
.then((PaymentEntity payment) {
|
||||
store.dispatch(SavePaymentSuccess(payment));
|
||||
action.completer.complete(null);
|
||||
|
|
@ -189,7 +195,6 @@ Middleware<AppState> _emailPayment(PaymentRepository repository) {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Middleware<AppState> _loadPayment(PaymentRepository repository) {
|
||||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,9 @@ Middleware<AppState> _loadProducts(ProductRepository repository) {
|
|||
final int updatedAt = (state.productState.lastUpdated / 1000).round();
|
||||
|
||||
store.dispatch(LoadProductsRequest());
|
||||
repository.loadList(state.selectedCompany, state.authState, updatedAt).then((data) {
|
||||
repository
|
||||
.loadList(state.selectedCompany, state.authState, updatedAt)
|
||||
.then((data) {
|
||||
store.dispatch(LoadProductsSuccess(data));
|
||||
if (action.completer != null) {
|
||||
action.completer.complete(null);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
|
||||
InvoiceItemEntity convertProductToInvoiceItem({BuildContext context, ProductEntity product}) {
|
||||
InvoiceItemEntity convertProductToInvoiceItem(
|
||||
{BuildContext context, ProductEntity product}) {
|
||||
return InvoiceItemEntity().rebuild((b) => b
|
||||
..productKey = product.productKey
|
||||
..notes = product.notes
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
|||
|
||||
part 'product_state.g.dart';
|
||||
|
||||
abstract class ProductState implements Built<ProductState, ProductStateBuilder> {
|
||||
|
||||
abstract class ProductState
|
||||
implements Built<ProductState, ProductStateBuilder> {
|
||||
factory ProductState() {
|
||||
return _$ProductState._(
|
||||
lastUpdated: 0,
|
||||
|
|
@ -26,11 +26,12 @@ abstract class ProductState implements Built<ProductState, ProductStateBuilder>
|
|||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated > kMillisecondsToRefreshData;
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded => lastUpdated != null && lastUpdated > 0;
|
||||
|
|
@ -38,8 +39,9 @@ abstract class ProductState implements Built<ProductState, ProductStateBuilder>
|
|||
static Serializer<ProductState> get serializer => _$productStateSerializer;
|
||||
}
|
||||
|
||||
abstract class ProductUIState extends Object with EntityUIState implements Built<ProductUIState, ProductUIStateBuilder> {
|
||||
|
||||
abstract class ProductUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ProductUIState, ProductUIStateBuilder> {
|
||||
factory ProductUIState() {
|
||||
return _$ProductUIState._(
|
||||
listUIState: ListUIState(ProductFields.productKey),
|
||||
|
|
@ -55,5 +57,6 @@ abstract class ProductUIState extends Object with EntityUIState implements Built
|
|||
@override
|
||||
bool get isCreatingNew => editing.isNew;
|
||||
|
||||
static Serializer<ProductUIState> get serializer => _$productUIStateSerializer;
|
||||
}
|
||||
static Serializer<ProductUIState> get serializer =>
|
||||
_$productUIStateSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ class ViewProject implements PersistUI {
|
|||
}
|
||||
|
||||
class EditProject implements PersistUI {
|
||||
EditProject({this.project, this.context, this.completer, this.trackRoute = true});
|
||||
EditProject(
|
||||
{this.project, this.context, this.completer, this.trackRoute = true});
|
||||
|
||||
final ProjectEntity project;
|
||||
final BuildContext context;
|
||||
|
|
@ -102,7 +103,6 @@ class LoadProjectsSuccess implements StopLoading, PersistData {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class SaveProjectRequest implements StartSaving {
|
||||
SaveProjectRequest({this.completer, this.project});
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class AddProjectSuccess implements StopSaving, PersistData, PersistUI {
|
|||
}
|
||||
|
||||
class SaveProjectFailure implements StopSaving {
|
||||
SaveProjectFailure (this.error);
|
||||
SaveProjectFailure(this.error);
|
||||
|
||||
final Object error;
|
||||
}
|
||||
|
|
@ -185,9 +185,6 @@ class RestoreProjectFailure implements StopSaving {
|
|||
final ProjectEntity project;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class FilterProjects {
|
||||
FilterProjects(this.filter);
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,8 @@ Middleware<AppState> _viewProjectList() {
|
|||
|
||||
store.dispatch(UpdateCurrentRoute(ProjectScreen.route));
|
||||
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(ProjectScreen.route, (Route<dynamic> route) => false);
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(
|
||||
ProjectScreen.route, (Route<dynamic> route) => false);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ ProjectEntity _updateEditing(ProjectEntity project, dynamic action) {
|
|||
return action.project;
|
||||
}
|
||||
|
||||
|
||||
final projectListReducer = combineReducers<ListUIState>([
|
||||
TypedReducer<ListUIState, SortProjects>(_sortProjects),
|
||||
TypedReducer<ListUIState, FilterProjectsByState>(_filterProjectsByState),
|
||||
|
|
@ -52,8 +51,8 @@ final projectListReducer = combineReducers<ListUIState>([
|
|||
ListUIState _filterProjectsByClient(
|
||||
ListUIState projectListState, FilterProjectsByEntity action) {
|
||||
return projectListState.rebuild((b) => b
|
||||
..filterEntityId = action.entityId
|
||||
..filterEntityType = action.entityType);
|
||||
..filterEntityId = action.entityId
|
||||
..filterEntityType = action.entityType);
|
||||
}
|
||||
|
||||
ListUIState _filterProjectsByCustom1(
|
||||
|
|
@ -79,13 +78,15 @@ ListUIState _filterProjectsByCustom2(
|
|||
ListUIState _filterProjectsByState(
|
||||
ListUIState projectListState, FilterProjectsByState action) {
|
||||
if (projectListState.stateFilters.contains(action.state)) {
|
||||
return projectListState.rebuild((b) => b..stateFilters.remove(action.state));
|
||||
return projectListState
|
||||
.rebuild((b) => b..stateFilters.remove(action.state));
|
||||
} else {
|
||||
return projectListState.rebuild((b) => b..stateFilters.add(action.state));
|
||||
}
|
||||
}
|
||||
|
||||
ListUIState _filterProjects(ListUIState projectListState, FilterProjects action) {
|
||||
ListUIState _filterProjects(
|
||||
ListUIState projectListState, FilterProjects action) {
|
||||
return projectListState.rebuild((b) => b..filter = action.filter);
|
||||
}
|
||||
|
||||
|
|
@ -121,12 +122,14 @@ ProjectState _archiveProjectRequest(
|
|||
|
||||
ProjectState _archiveProjectSuccess(
|
||||
ProjectState projectState, ArchiveProjectSuccess action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _archiveProjectFailure(
|
||||
ProjectState projectState, ArchiveProjectFailure action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _deleteProjectRequest(
|
||||
|
|
@ -140,12 +143,14 @@ ProjectState _deleteProjectRequest(
|
|||
|
||||
ProjectState _deleteProjectSuccess(
|
||||
ProjectState projectState, DeleteProjectSuccess action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _deleteProjectFailure(
|
||||
ProjectState projectState, DeleteProjectFailure action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _restoreProjectRequest(
|
||||
|
|
@ -158,12 +163,14 @@ ProjectState _restoreProjectRequest(
|
|||
|
||||
ProjectState _restoreProjectSuccess(
|
||||
ProjectState projectState, RestoreProjectSuccess action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _restoreProjectFailure(
|
||||
ProjectState projectState, RestoreProjectFailure action) {
|
||||
return projectState.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _addProject(ProjectState projectState, AddProjectSuccess action) {
|
||||
|
|
@ -172,15 +179,16 @@ ProjectState _addProject(ProjectState projectState, AddProjectSuccess action) {
|
|||
..list.add(action.project.id));
|
||||
}
|
||||
|
||||
ProjectState _updateProject(ProjectState projectState, SaveProjectSuccess action) {
|
||||
return projectState.rebuild((b) => b
|
||||
..map[action.project.id] = action.project);
|
||||
ProjectState _updateProject(
|
||||
ProjectState projectState, SaveProjectSuccess action) {
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _setLoadedProject(
|
||||
ProjectState projectState, LoadProjectSuccess action) {
|
||||
return projectState.rebuild((b) => b
|
||||
..map[action.project.id] = action.project);
|
||||
return projectState
|
||||
.rebuild((b) => b..map[action.project.id] = action.project);
|
||||
}
|
||||
|
||||
ProjectState _setLoadedProjects(
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
|||
|
||||
part 'project_state.g.dart';
|
||||
|
||||
abstract class ProjectState implements Built<ProjectState, ProjectStateBuilder> {
|
||||
|
||||
abstract class ProjectState
|
||||
implements Built<ProjectState, ProjectStateBuilder> {
|
||||
factory ProjectState() {
|
||||
return _$ProjectState._(
|
||||
lastUpdated: 0,
|
||||
|
|
@ -26,11 +26,12 @@ abstract class ProjectState implements Built<ProjectState, ProjectStateBuilder>
|
|||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated > kMillisecondsToRefreshData;
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded => lastUpdated != null && lastUpdated > 0;
|
||||
|
|
@ -38,8 +39,9 @@ abstract class ProjectState implements Built<ProjectState, ProjectStateBuilder>
|
|||
static Serializer<ProjectState> get serializer => _$projectStateSerializer;
|
||||
}
|
||||
|
||||
abstract class ProjectUIState extends Object with EntityUIState implements Built<ProjectUIState, ProjectUIStateBuilder> {
|
||||
|
||||
abstract class ProjectUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<ProjectUIState, ProjectUIStateBuilder> {
|
||||
factory ProjectUIState() {
|
||||
return _$ProjectUIState._(
|
||||
listUIState: ListUIState(ProjectFields.name),
|
||||
|
|
@ -55,5 +57,6 @@ abstract class ProjectUIState extends Object with EntityUIState implements Built
|
|||
@override
|
||||
bool get isCreatingNew => editing.isNew;
|
||||
|
||||
static Serializer<ProjectUIState> get serializer => _$projectUIStateSerializer;
|
||||
}
|
||||
static Serializer<ProjectUIState> get serializer =>
|
||||
_$projectUIStateSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ Middleware<AppState> _restoreQuote(QuoteRepository repository) {
|
|||
final origQuote = store.state.quoteState.map[action.quoteId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState, origQuote,
|
||||
EntityAction.restore)
|
||||
EntityAction.restore)
|
||||
.then((InvoiceEntity quote) {
|
||||
store.dispatch(RestoreQuoteSuccess(quote));
|
||||
if (action.completer != null) {
|
||||
|
|
@ -165,7 +165,7 @@ Middleware<AppState> _convertQuote(QuoteRepository repository) {
|
|||
final quote = store.state.quoteState.map[action.quoteId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState, quote,
|
||||
EntityAction.convert)
|
||||
EntityAction.convert)
|
||||
.then((InvoiceEntity invoice) {
|
||||
store.dispatch(ConvertQuoteSuccess(quote: quote, invoice: invoice));
|
||||
action.completer.complete(invoice);
|
||||
|
|
@ -207,7 +207,7 @@ Middleware<AppState> _emailQuote(QuoteRepository repository) {
|
|||
final origQuote = store.state.quoteState.map[action.quoteId];
|
||||
repository
|
||||
.emailQuote(store.state.selectedCompany, store.state.authState,
|
||||
origQuote, action.template, action.subject, action.body)
|
||||
origQuote, action.template, action.subject, action.body)
|
||||
.then((void _) {
|
||||
store.dispatch(EmailQuoteSuccess());
|
||||
if (action.completer != null) {
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ ClientEntity quoteClientSelector(
|
|||
return clientMap[quote.clientId];
|
||||
}
|
||||
|
||||
var memoizedFilteredQuoteList = memo4(
|
||||
(BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
var memoizedFilteredQuoteList = memo4((BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
BuiltList<int> quoteList,
|
||||
BuiltMap<int, ClientEntity> clientMap,
|
||||
ListUIState quoteListState) =>
|
||||
filteredQuotesSelector(
|
||||
quoteMap, quoteList, clientMap, quoteListState));
|
||||
filteredQuotesSelector(quoteMap, quoteList, clientMap, quoteListState));
|
||||
|
||||
List<int> filteredQuotesSelector(
|
||||
BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
|
|
@ -24,7 +22,7 @@ List<int> filteredQuotesSelector(
|
|||
final list = quoteList.where((quoteId) {
|
||||
final quote = quoteMap[quoteId];
|
||||
final client = clientMap[quote.clientId];
|
||||
if (client == null || ! client.isActive) {
|
||||
if (client == null || !client.isActive) {
|
||||
return false;
|
||||
}
|
||||
if (!quote.matchesStates(quoteListState.stateFilters)) {
|
||||
|
|
@ -61,16 +59,13 @@ List<int> filteredQuotesSelector(
|
|||
}
|
||||
|
||||
var memoizedQuoteStatsForClient = memo4((int clientId,
|
||||
BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
String activeLabel,
|
||||
String archivedLabel) =>
|
||||
BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
String activeLabel,
|
||||
String archivedLabel) =>
|
||||
quoteStatsForClient(clientId, quoteMap, activeLabel, archivedLabel));
|
||||
|
||||
String quoteStatsForClient(
|
||||
int clientId,
|
||||
BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
String activeLabel,
|
||||
String archivedLabel) {
|
||||
String quoteStatsForClient(int clientId, BuiltMap<int, InvoiceEntity> quoteMap,
|
||||
String activeLabel, String archivedLabel) {
|
||||
int countActive = 0;
|
||||
int countArchived = 0;
|
||||
quoteMap.forEach((quoteId, quote) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ StaticState refreshData(StaticState staticState, RefreshData action) {
|
|||
return StaticState();
|
||||
}
|
||||
|
||||
StaticState staticLoadedReducer(StaticState staticState, LoadStaticSuccess action) {
|
||||
StaticState staticLoadedReducer(
|
||||
StaticState staticState, LoadStaticSuccess action) {
|
||||
return StaticState().rebuild((b) => b
|
||||
..currencyMap.addAll(Map.fromIterable(
|
||||
action.data.currencies,
|
||||
|
|
@ -67,7 +68,5 @@ StaticState staticLoadedReducer(StaticState staticState, LoadStaticSuccess actio
|
|||
action.data.frequencies,
|
||||
key: (dynamic item) => item.id,
|
||||
value: (dynamic item) => item,
|
||||
))
|
||||
);
|
||||
)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,76 +2,78 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:memoize/memoize.dart';
|
||||
|
||||
var memoizedCountryList = memo1((BuiltMap<int, CountryEntity> countryMap) =>
|
||||
countryList(countryMap));
|
||||
var memoizedCountryList =
|
||||
memo1((BuiltMap<int, CountryEntity> countryMap) => countryList(countryMap));
|
||||
|
||||
List<int> countryList(BuiltMap<int, CountryEntity> countryMap) {
|
||||
final list = countryMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => countryMap[idA].listDisplayName
|
||||
list.sort((idA, idB) => countryMap[idA]
|
||||
.listDisplayName
|
||||
.compareTo(countryMap[idB].listDisplayName));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var memoizedLanguageList = memo1((BuiltMap<int, LanguageEntity> languageMap) =>
|
||||
languageList(languageMap));
|
||||
var memoizedLanguageList = memo1(
|
||||
(BuiltMap<int, LanguageEntity> languageMap) => languageList(languageMap));
|
||||
|
||||
List<int> languageList(BuiltMap<int, LanguageEntity> languageMap) {
|
||||
final list = languageMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => languageMap[idA].listDisplayName
|
||||
list.sort((idA, idB) => languageMap[idA]
|
||||
.listDisplayName
|
||||
.compareTo(languageMap[idB].listDisplayName));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var memoizedCurrencyList = memo1((BuiltMap<int, CurrencyEntity> currencyMap) =>
|
||||
currencyList(currencyMap));
|
||||
var memoizedCurrencyList = memo1(
|
||||
(BuiltMap<int, CurrencyEntity> currencyMap) => currencyList(currencyMap));
|
||||
|
||||
List<int> currencyList(BuiltMap<int, CurrencyEntity> currencyMap) {
|
||||
final list = currencyMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => currencyMap[idA].listDisplayName
|
||||
list.sort((idA, idB) => currencyMap[idA]
|
||||
.listDisplayName
|
||||
.compareTo(currencyMap[idB].listDisplayName));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var memoizedIndustryList = memo1((BuiltMap<int, IndustryEntity> industryMap) =>
|
||||
industryList(industryMap));
|
||||
var memoizedIndustryList = memo1(
|
||||
(BuiltMap<int, IndustryEntity> industryMap) => industryList(industryMap));
|
||||
|
||||
List<int> industryList(BuiltMap<int, IndustryEntity> industryMap) {
|
||||
final list = industryMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => industryMap[idA].listDisplayName
|
||||
list.sort((idA, idB) => industryMap[idA]
|
||||
.listDisplayName
|
||||
.compareTo(industryMap[idB].listDisplayName));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var memoizedSizeList = memo1((BuiltMap<int, SizeEntity> sizeMap) =>
|
||||
sizeList(sizeMap));
|
||||
var memoizedSizeList =
|
||||
memo1((BuiltMap<int, SizeEntity> sizeMap) => sizeList(sizeMap));
|
||||
|
||||
List<int> sizeList(BuiltMap<int, SizeEntity> sizeMap) {
|
||||
final list = sizeMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => sizeMap[idA].id
|
||||
.compareTo(sizeMap[idB].id));
|
||||
list.sort((idA, idB) => sizeMap[idA].id.compareTo(sizeMap[idB].id));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var memoizedPaymentTypeList = memo1((BuiltMap<int, PaymentTypeEntity> paymentTypeMap) =>
|
||||
paymentTypeList(paymentTypeMap));
|
||||
var memoizedPaymentTypeList = memo1(
|
||||
(BuiltMap<int, PaymentTypeEntity> paymentTypeMap) =>
|
||||
paymentTypeList(paymentTypeMap));
|
||||
|
||||
List<int> paymentTypeList(BuiltMap<int, PaymentTypeEntity> paymentTypeMap) {
|
||||
final list = paymentTypeMap.keys.toList();
|
||||
|
||||
list.sort((idA, idB) => paymentTypeMap[idA].id
|
||||
.compareTo(paymentTypeMap[idB].id));
|
||||
list.sort(
|
||||
(idA, idB) => paymentTypeMap[idA].id.compareTo(paymentTypeMap[idB].id));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
part 'static_state.g.dart';
|
||||
|
||||
abstract class StaticState implements Built<StaticState, StaticStateBuilder> {
|
||||
|
||||
factory StaticState() {
|
||||
return _$StaticState._(
|
||||
currencyMap: BuiltMap<int, CurrencyEntity>(),
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ Middleware<AppState> _viewTaskList() {
|
|||
|
||||
store.dispatch(UpdateCurrentRoute(TaskScreen.route));
|
||||
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(TaskScreen.route, (Route<dynamic> route) => false);
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(
|
||||
TaskScreen.route, (Route<dynamic> route) => false);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -74,8 +75,8 @@ Middleware<AppState> _archiveTask(TaskRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origTask = store.state.taskState.map[action.taskId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origTask, EntityAction.archive)
|
||||
.saveData(store.state.selectedCompany, store.state.authState, origTask,
|
||||
EntityAction.archive)
|
||||
.then((TaskEntity task) {
|
||||
store.dispatch(ArchiveTaskSuccess(task));
|
||||
if (action.completer != null) {
|
||||
|
|
@ -97,8 +98,8 @@ Middleware<AppState> _deleteTask(TaskRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origTask = store.state.taskState.map[action.taskId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origTask, EntityAction.delete)
|
||||
.saveData(store.state.selectedCompany, store.state.authState, origTask,
|
||||
EntityAction.delete)
|
||||
.then((TaskEntity task) {
|
||||
store.dispatch(DeleteTaskSuccess(task));
|
||||
if (action.completer != null) {
|
||||
|
|
@ -120,8 +121,8 @@ Middleware<AppState> _restoreTask(TaskRepository repository) {
|
|||
return (Store<AppState> store, dynamic action, NextDispatcher next) {
|
||||
final origTask = store.state.taskState.map[action.taskId];
|
||||
repository
|
||||
.saveData(store.state.selectedCompany, store.state.authState,
|
||||
origTask, EntityAction.restore)
|
||||
.saveData(store.state.selectedCompany, store.state.authState, origTask,
|
||||
EntityAction.restore)
|
||||
.then((TaskEntity task) {
|
||||
store.dispatch(RestoreTaskSuccess(task));
|
||||
if (action.completer != null) {
|
||||
|
|
|
|||
|
|
@ -96,11 +96,10 @@ ListUIState _filterTasksByState(
|
|||
}
|
||||
}
|
||||
|
||||
ListUIState _filterTasksByStatus(ListUIState taskListState,
|
||||
FilterTasksByStatus action) {
|
||||
ListUIState _filterTasksByStatus(
|
||||
ListUIState taskListState, FilterTasksByStatus action) {
|
||||
if (taskListState.statusFilters.contains(action.status)) {
|
||||
return taskListState
|
||||
.rebuild((b) => b..statusFilters.remove(action.status));
|
||||
return taskListState.rebuild((b) => b..statusFilters.remove(action.status));
|
||||
} else {
|
||||
return taskListState.rebuild((b) => b..statusFilters.add(action.status));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
|||
part 'task_state.g.dart';
|
||||
|
||||
abstract class TaskState implements Built<TaskState, TaskStateBuilder> {
|
||||
|
||||
factory TaskState() {
|
||||
return _$TaskState._(
|
||||
lastUpdated: 0,
|
||||
|
|
@ -26,11 +25,12 @@ abstract class TaskState implements Built<TaskState, TaskStateBuilder> {
|
|||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated > kMillisecondsToRefreshData;
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded => lastUpdated != null && lastUpdated > 0;
|
||||
|
|
@ -38,8 +38,9 @@ abstract class TaskState implements Built<TaskState, TaskStateBuilder> {
|
|||
static Serializer<TaskState> get serializer => _$taskStateSerializer;
|
||||
}
|
||||
|
||||
abstract class TaskUIState extends Object with EntityUIState implements Built<TaskUIState, TaskUIStateBuilder> {
|
||||
|
||||
abstract class TaskUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<TaskUIState, TaskUIStateBuilder> {
|
||||
factory TaskUIState() {
|
||||
return _$TaskUIState._(
|
||||
listUIState: ListUIState(TaskFields.updatedAt, sortAscending: false),
|
||||
|
|
@ -60,4 +61,4 @@ abstract class TaskUIState extends Object with EntityUIState implements Built<Ta
|
|||
bool get isCreatingNew => editing.isNew;
|
||||
|
||||
static Serializer<TaskUIState> get serializer => _$taskUIStateSerializer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
|
||||
abstract class EntityUIState {
|
||||
|
||||
bool get isCreatingNew;
|
||||
int get selectedId;
|
||||
ListUIState get listUIState;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
part 'list_ui_state.g.dart';
|
||||
|
||||
abstract class ListUIState implements Built<ListUIState, ListUIStateBuilder> {
|
||||
|
||||
factory ListUIState(String sortField, {bool sortAscending = true}) {
|
||||
return _$ListUIState._(
|
||||
sortField: sortField,
|
||||
|
|
@ -37,11 +36,12 @@ abstract class ListUIState implements Built<ListUIState, ListUIStateBuilder> {
|
|||
BuiltList<String> get custom1Filters;
|
||||
BuiltList<String> get custom2Filters;
|
||||
|
||||
bool get hasStateFilters => stateFilters.length != 1 || stateFilters.first != EntityState.active;
|
||||
bool get hasStateFilters =>
|
||||
stateFilters.length != 1 || stateFilters.first != EntityState.active;
|
||||
bool get hasStatusFilters => statusFilters.isNotEmpty;
|
||||
bool get hasCustom1Filters => custom1Filters.isNotEmpty;
|
||||
bool get hasCustom2Filters => custom2Filters.isNotEmpty;
|
||||
|
||||
//factory EntityUIState([void updates(EntityUIStateBuilder b)]) = _$listUIState;
|
||||
static Serializer<ListUIState> get serializer => _$listUIStateSerializer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ UIState uiReducer(UIState state, dynamic action) {
|
|||
..dashboardUIState
|
||||
.replace(dashboardUIReducer(state.dashboardUIState, action))
|
||||
// STARTER: reducer - do not remove comment
|
||||
..vendorUIState.replace(vendorUIReducer(state.vendorUIState, action))
|
||||
|
||||
..vendorUIState.replace(vendorUIReducer(state.vendorUIState, action))
|
||||
..taskUIState.replace(taskUIReducer(state.taskUIState, action))
|
||||
..projectUIState.replace(projectUIReducer(state.projectUIState, action))
|
||||
..paymentUIState.replace(paymentUIReducer(state.paymentUIState, action))
|
||||
|
|
@ -72,7 +71,8 @@ Reducer<bool> autoStartTasksReducer = combineReducers([
|
|||
TypedReducer<bool, UserSettingsChanged>(updateAutoStartTasksReducer),
|
||||
]);
|
||||
|
||||
bool updateAutoStartTasksReducer(bool autoStartTasks, UserSettingsChanged action) {
|
||||
bool updateAutoStartTasksReducer(
|
||||
bool autoStartTasks, UserSettingsChanged action) {
|
||||
return action.autoStartTasks ?? autoStartTasks;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ abstract class UIState implements Built<UIState, UIStateBuilder> {
|
|||
clientUIState: ClientUIState(),
|
||||
invoiceUIState: InvoiceUIState(),
|
||||
// STARTER: constructor - do not remove comment
|
||||
vendorUIState: VendorUIState(),
|
||||
vendorUIState: VendorUIState(),
|
||||
|
||||
taskUIState: TaskUIState(),
|
||||
projectUIState: ProjectUIState(),
|
||||
|
|
@ -70,7 +70,7 @@ vendorUIState: VendorUIState(),
|
|||
String get filter;
|
||||
|
||||
// STARTER: properties - do not remove comment
|
||||
VendorUIState get vendorUIState;
|
||||
VendorUIState get vendorUIState;
|
||||
|
||||
TaskUIState get taskUIState;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ class ViewVendor implements PersistUI {
|
|||
}
|
||||
|
||||
class EditVendor implements PersistUI {
|
||||
EditVendor({this.vendor, this.context, this.completer, this.trackRoute = true});
|
||||
EditVendor(
|
||||
{this.vendor, this.context, this.completer, this.trackRoute = true});
|
||||
|
||||
final VendorEntity vendor;
|
||||
final BuildContext context;
|
||||
|
|
@ -102,7 +103,6 @@ class LoadVendorsSuccess implements StopLoading, PersistData {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class SaveVendorRequest implements StartSaving {
|
||||
SaveVendorRequest({this.completer, this.vendor});
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ class AddVendorSuccess implements StopSaving, PersistData, PersistUI {
|
|||
}
|
||||
|
||||
class SaveVendorFailure implements StopSaving {
|
||||
SaveVendorFailure (this.error);
|
||||
SaveVendorFailure(this.error);
|
||||
|
||||
final Object error;
|
||||
}
|
||||
|
|
@ -185,9 +185,6 @@ class RestoreVendorFailure implements StopSaving {
|
|||
final VendorEntity vendor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class FilterVendors {
|
||||
FilterVendors(this.filter);
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ Middleware<AppState> _viewVendorList() {
|
|||
|
||||
store.dispatch(UpdateCurrentRoute(VendorScreen.route));
|
||||
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(VendorScreen.route, (Route<dynamic> route) => false);
|
||||
Navigator.of(action.context).pushNamedAndRemoveUntil(
|
||||
VendorScreen.route, (Route<dynamic> route) => false);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ VendorEntity _updateEditing(VendorEntity vendor, dynamic action) {
|
|||
return action.vendor;
|
||||
}
|
||||
|
||||
|
||||
final vendorListReducer = combineReducers<ListUIState>([
|
||||
TypedReducer<ListUIState, SortVendors>(_sortVendors),
|
||||
TypedReducer<ListUIState, FilterVendorsByState>(_filterVendorsByState),
|
||||
|
|
@ -52,8 +51,8 @@ final vendorListReducer = combineReducers<ListUIState>([
|
|||
ListUIState _filterVendorsByClient(
|
||||
ListUIState vendorListState, FilterVendorsByEntity action) {
|
||||
return vendorListState.rebuild((b) => b
|
||||
..filterEntityId = action.entityId
|
||||
..filterEntityType = action.entityType);
|
||||
..filterEntityId = action.entityId
|
||||
..filterEntityType = action.entityType);
|
||||
}
|
||||
|
||||
ListUIState _filterVendorsByCustom1(
|
||||
|
|
@ -173,14 +172,12 @@ VendorState _addVendor(VendorState vendorState, AddVendorSuccess action) {
|
|||
}
|
||||
|
||||
VendorState _updateVendor(VendorState vendorState, SaveVendorSuccess action) {
|
||||
return vendorState.rebuild((b) => b
|
||||
..map[action.vendor.id] = action.vendor);
|
||||
return vendorState.rebuild((b) => b..map[action.vendor.id] = action.vendor);
|
||||
}
|
||||
|
||||
VendorState _setLoadedVendor(
|
||||
VendorState vendorState, LoadVendorSuccess action) {
|
||||
return vendorState.rebuild((b) => b
|
||||
..map[action.vendor.id] = action.vendor);
|
||||
return vendorState.rebuild((b) => b..map[action.vendor.id] = action.vendor);
|
||||
}
|
||||
|
||||
VendorState _setLoadedVendors(
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
||||
|
||||
var memoizedDropdownVendorList = memo3(
|
||||
(BuiltMap<int, VendorEntity> vendorMap, BuiltList<int> vendorList,
|
||||
int clientId) =>
|
||||
dropdownVendorsSelector(vendorMap, vendorList, clientId));
|
||||
var memoizedDropdownVendorList = memo3((BuiltMap<int, VendorEntity> vendorMap,
|
||||
BuiltList<int> vendorList, int clientId) =>
|
||||
dropdownVendorsSelector(vendorMap, vendorList, clientId));
|
||||
|
||||
List<int> dropdownVendorsSelector(BuiltMap<int, VendorEntity> vendorMap,
|
||||
BuiltList<int> vendorList, int clientId) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import 'package:invoiceninja_flutter/redux/ui/list_ui_state.dart';
|
|||
part 'vendor_state.g.dart';
|
||||
|
||||
abstract class VendorState implements Built<VendorState, VendorStateBuilder> {
|
||||
|
||||
factory VendorState() {
|
||||
return _$VendorState._(
|
||||
lastUpdated: 0,
|
||||
|
|
@ -26,11 +25,12 @@ abstract class VendorState implements Built<VendorState, VendorStateBuilder> {
|
|||
BuiltList<int> get list;
|
||||
|
||||
bool get isStale {
|
||||
if (! isLoaded) {
|
||||
if (!isLoaded) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated > kMillisecondsToRefreshData;
|
||||
return DateTime.now().millisecondsSinceEpoch - lastUpdated >
|
||||
kMillisecondsToRefreshData;
|
||||
}
|
||||
|
||||
bool get isLoaded => lastUpdated != null && lastUpdated > 0;
|
||||
|
|
@ -38,8 +38,9 @@ abstract class VendorState implements Built<VendorState, VendorStateBuilder> {
|
|||
static Serializer<VendorState> get serializer => _$vendorStateSerializer;
|
||||
}
|
||||
|
||||
abstract class VendorUIState extends Object with EntityUIState implements Built<VendorUIState, VendorUIStateBuilder> {
|
||||
|
||||
abstract class VendorUIState extends Object
|
||||
with EntityUIState
|
||||
implements Built<VendorUIState, VendorUIStateBuilder> {
|
||||
factory VendorUIState() {
|
||||
return _$VendorUIState._(
|
||||
listUIState: ListUIState(VendorFields.name),
|
||||
|
|
@ -56,4 +57,4 @@ abstract class VendorUIState extends Object with EntityUIState implements Built<
|
|||
bool get isCreatingNew => editing.isNew;
|
||||
|
||||
static Serializer<VendorUIState> get serializer => _$vendorUIStateSerializer;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
import 'package:redux/redux.dart';
|
||||
|
||||
class AppBottomBar extends StatefulWidget {
|
||||
|
||||
const AppBottomBar({
|
||||
this.sortFields,
|
||||
this.onSelectedSortField,
|
||||
|
|
@ -46,7 +45,6 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final _showFilterStateSheet = () {
|
||||
if (_filterStateController != null) {
|
||||
_filterStateController.close();
|
||||
|
|
@ -184,33 +182,33 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
|
||||
_filterCustom1Controller =
|
||||
Scaffold.of(context).showBottomSheet<StoreConnector>((context) {
|
||||
return StoreConnector<AppState, BuiltList<String>>(
|
||||
converter: (Store<AppState> store) =>
|
||||
return StoreConnector<AppState, BuiltList<String>>(
|
||||
converter: (Store<AppState> store) =>
|
||||
store.state.getListState(widget.entityType).custom1Filters,
|
||||
builder: (BuildContext context, customFilters) {
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Column(
|
||||
children: widget.customValues1.map<Widget>((customField) {
|
||||
return CheckboxListTile(
|
||||
key: Key(customField.toString()),
|
||||
title: Text(customField),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: customFilters.contains(customField),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
dense: true,
|
||||
onChanged: (value) {
|
||||
widget.onSelectedCustom1(customField);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
},
|
||||
builder: (BuildContext context, customFilters) {
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Column(
|
||||
children: widget.customValues1.map<Widget>((customField) {
|
||||
return CheckboxListTile(
|
||||
key: Key(customField.toString()),
|
||||
title: Text(customField),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: customFilters.contains(customField),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
dense: true,
|
||||
onChanged: (value) {
|
||||
widget.onSelectedCustom1(customField);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
_filterCustom1Controller.closed.whenComplete(() {
|
||||
_filterCustom1Controller = null;
|
||||
|
|
@ -225,33 +223,33 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
|
||||
_filterCustom2Controller =
|
||||
Scaffold.of(context).showBottomSheet<StoreConnector>((context) {
|
||||
return StoreConnector<AppState, BuiltList<String>>(
|
||||
converter: (Store<AppState> store) =>
|
||||
return StoreConnector<AppState, BuiltList<String>>(
|
||||
converter: (Store<AppState> store) =>
|
||||
store.state.getListState(widget.entityType).custom2Filters,
|
||||
builder: (BuildContext context, customFilters) {
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Column(
|
||||
children: widget.customValues2.map<Widget>((customField) {
|
||||
return CheckboxListTile(
|
||||
key: Key(customField.toString()),
|
||||
title: Text(customField),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: customFilters.contains(customField),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
dense: true,
|
||||
onChanged: (value) {
|
||||
widget.onSelectedCustom2(customField);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
},
|
||||
builder: (BuildContext context, customFilters) {
|
||||
return Container(
|
||||
color: Theme.of(context).backgroundColor,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Column(
|
||||
children: widget.customValues2.map<Widget>((customField) {
|
||||
return CheckboxListTile(
|
||||
key: Key(customField.toString()),
|
||||
title: Text(customField),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: customFilters.contains(customField),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
dense: true,
|
||||
onChanged: (value) {
|
||||
widget.onSelectedCustom2(customField);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
]),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
_filterCustom2Controller.closed.whenComplete(() {
|
||||
_filterCustom2Controller = null;
|
||||
|
|
@ -272,42 +270,46 @@ class _AppBottomBarState extends State<AppBottomBar> {
|
|||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.filter_list),
|
||||
onPressed: _showFilterStateSheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasStateFilters
|
||||
color: store.state.getListState(widget.entityType).hasStateFilters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
),
|
||||
widget.statuses.isNotEmpty ? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.filter),
|
||||
onPressed: _showFilterStatusSheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasStatusFilters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
) : SizedBox(width: 0.0),
|
||||
widget.customValues1.isNotEmpty ? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.looks_one),
|
||||
onPressed: _showFilterCustom1Sheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasCustom1Filters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
) : SizedBox(width: 0.0),
|
||||
widget.customValues2.isNotEmpty ? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.looks_two),
|
||||
onPressed: _showFilterCustom2Sheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasCustom2Filters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
) : SizedBox(width: 0.0),
|
||||
widget.statuses.isNotEmpty
|
||||
? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.filter),
|
||||
onPressed: _showFilterStatusSheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasStatusFilters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
)
|
||||
: SizedBox(width: 0.0),
|
||||
widget.customValues1.isNotEmpty
|
||||
? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.looks_one),
|
||||
onPressed: _showFilterCustom1Sheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasCustom1Filters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
)
|
||||
: SizedBox(width: 0.0),
|
||||
widget.customValues2.isNotEmpty
|
||||
? IconButton(
|
||||
tooltip: AppLocalization.of(context).filter,
|
||||
icon: Icon(Icons.looks_two),
|
||||
onPressed: _showFilterCustom2Sheet,
|
||||
color: store.state
|
||||
.getListState(widget.entityType)
|
||||
.hasCustom2Filters
|
||||
? Theme.of(context).accentColor
|
||||
: null,
|
||||
)
|
||||
: SizedBox(width: 0.0),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@ class AppDrawerVM {
|
|||
user: state.user,
|
||||
selectedCompany: state.selectedCompany,
|
||||
selectedCompanyIndex: state.uiState.selectedCompanyIndex.toString(),
|
||||
onCompanyChanged: (BuildContext context, String companyIndex, CompanyEntity company) {
|
||||
onCompanyChanged:
|
||||
(BuildContext context, String companyIndex, CompanyEntity company) {
|
||||
store.dispatch(SelectCompany(int.parse(companyIndex), company));
|
||||
AppBuilder.of(context).rebuild();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class EntityDropdown extends StatefulWidget {
|
|||
this.autoValidate = false,
|
||||
this.initialValue,
|
||||
this.onAddPressed,
|
||||
}) : super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
final EntityType entityType;
|
||||
final BuiltMap<int, SelectableEntity> entityMap;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class FormCard extends StatelessWidget {
|
|||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment:CrossAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: children,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomField extends StatelessWidget {
|
||||
|
||||
const CustomField({
|
||||
@required this.controller,
|
||||
@required this.labelText,
|
||||
|
|
@ -31,10 +30,12 @@ class CustomField extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
} else {
|
||||
final menuItems = options.map((option) => PopupMenuItem<String>(
|
||||
value: option,
|
||||
child: Text(option),
|
||||
)).toList();
|
||||
final menuItems = options
|
||||
.map((option) => PopupMenuItem<String>(
|
||||
value: option,
|
||||
child: Text(option),
|
||||
))
|
||||
.toList();
|
||||
|
||||
return PopupMenuButton<String>(
|
||||
padding: EdgeInsets.zero,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class IconMessage extends StatelessWidget {
|
||||
|
||||
const IconMessage(this.text);
|
||||
final String text;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class IconText extends StatelessWidget {
|
||||
|
||||
const IconText({this.text, this.icon});
|
||||
final String text;
|
||||
final IconData icon;
|
||||
|
|
|
|||
|
|
@ -37,12 +37,14 @@ class InvoiceItemListTile extends StatelessWidget {
|
|||
}
|
||||
|
||||
if (invoiceItem.taxRate1 != 0) {
|
||||
final taxRate1 = formatNumber(invoiceItem.taxRate1, context, formatNumberType: FormatNumberType.percent);
|
||||
final taxRate1 = formatNumber(invoiceItem.taxRate1, context,
|
||||
formatNumberType: FormatNumberType.percent);
|
||||
subtitle += ' • $taxRate1 ${invoiceItem.taxName1}';
|
||||
}
|
||||
|
||||
if (invoiceItem.taxRate2 != 0) {
|
||||
final taxRate2 = formatNumber(invoiceItem.taxRate2, context, formatNumberType: FormatNumberType.percent);
|
||||
final taxRate2 = formatNumber(invoiceItem.taxRate2, context,
|
||||
formatNumberType: FormatNumberType.percent);
|
||||
subtitle += ' • $taxRate2 ${invoiceItem.taxName2}';
|
||||
}
|
||||
|
||||
|
|
@ -67,21 +69,22 @@ class InvoiceItemListTile extends StatelessWidget {
|
|||
child: Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
onTap: onTap,
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: Text(invoiceItem.productKey)),
|
||||
Text(formatNumber(invoiceItem.total, context,
|
||||
clientId: invoice.clientId)),
|
||||
],
|
||||
),
|
||||
subtitle: Text(subtitle),
|
||||
trailing: onTap != null ? Icon(Icons.navigate_next) : null,
|
||||
onTap: onTap,
|
||||
title: Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: Text(invoiceItem.productKey)),
|
||||
Text(formatNumber(invoiceItem.total, context,
|
||||
clientId: invoice.clientId)),
|
||||
],
|
||||
),
|
||||
subtitle: Text(subtitle),
|
||||
trailing: onTap != null ? Icon(Icons.navigate_next) : null,
|
||||
),
|
||||
Divider(
|
||||
height: 1.0,
|
||||
),
|
||||
Divider(height: 1.0,),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,8 +53,7 @@ class _TaxRateDropdownState extends State<TaxRateDropdown> {
|
|||
}
|
||||
|
||||
String _formatTaxRate(TaxRateEntity taxRate) {
|
||||
return '${formatNumber(taxRate.rate, context,
|
||||
formatNumberType: FormatNumberType.percent)} ${taxRate.name}';
|
||||
return '${formatNumber(taxRate.rate, context, formatNumberType: FormatNumberType.percent)} ${taxRate.name}';
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ class ListFilter extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ListFilterState extends State<ListFilter> {
|
||||
|
||||
final _filterController = TextEditingController();
|
||||
|
||||
@override
|
||||
|
|
@ -55,7 +54,8 @@ class _ListFilterState extends State<ListFilter> {
|
|||
: state.uiState.filter;
|
||||
final bool enableDarkMode = state.uiState.enableDarkMode;
|
||||
return filter == null
|
||||
? Text(widget.title ?? localization.lookup(entityType.plural.toString()))
|
||||
? Text(widget.title ??
|
||||
localization.lookup(entityType.plural.toString()))
|
||||
: Container(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
height: 38.0,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class _LiveTextState extends State<LiveText> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
_timer = Timer.periodic(Duration(seconds: 1),
|
||||
(Timer timer) => mounted ? setState(() => false) : false);
|
||||
(Timer timer) => mounted ? setState(() => false) : false);
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ class OneValueHeader extends StatelessWidget {
|
|||
child: Card(
|
||||
elevation: 2.0,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: _value1(),
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: _value1(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ class LoginView extends StatefulWidget {
|
|||
|
||||
final LoginVM viewModel;
|
||||
|
||||
|
||||
@override
|
||||
_LoginState createState() => _LoginState();
|
||||
}
|
||||
|
|
@ -35,8 +34,7 @@ class _LoginState extends State<LoginView> {
|
|||
static final ValueKey _passwordKey = Key(LoginKeys.password);
|
||||
static final ValueKey _urlKey = Key(LoginKeys.url);
|
||||
static final ValueKey _secretKey = Key(LoginKeys.secret);
|
||||
static final ValueKey _oneTimePasswordKey =
|
||||
Key(LoginKeys.oneTimePassword);
|
||||
static final ValueKey _oneTimePasswordKey = Key(LoginKeys.oneTimePassword);
|
||||
|
||||
final FocusNode _focusNode1 = new FocusNode();
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class LoginVM {
|
|||
return;
|
||||
}
|
||||
|
||||
if (url.isNotEmpty && ! url.startsWith('http')) {
|
||||
if (url.isNotEmpty && !url.startsWith('http')) {
|
||||
url = 'https://' + url;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ class ClientListVM {
|
|||
final localization = AppLocalization.of(context);
|
||||
switch (action) {
|
||||
case EntityAction.edit:
|
||||
store.dispatch(
|
||||
EditClient(context: context, client: client));
|
||||
store.dispatch(EditClient(context: context, client: client));
|
||||
break;
|
||||
case EntityAction.newInvoice:
|
||||
store.dispatch(EditInvoice(
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ class _ClientEditState extends State<ClientEdit>
|
|||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(client.isNew
|
||||
? localization.newClient
|
||||
: localization.editClient),
|
||||
title: Text(
|
||||
client.isNew ? localization.newClient : localization.editClient),
|
||||
actions: <Widget>[
|
||||
ActionIconButton(
|
||||
icon: Icons.cloud_upload,
|
||||
|
|
@ -63,7 +62,7 @@ class _ClientEditState extends State<ClientEdit>
|
|||
isDirty: client.isNew || client != viewModel.origClient,
|
||||
isSaving: viewModel.isSaving,
|
||||
onPressed: () {
|
||||
if (! _formKey.currentState.validate()) {
|
||||
if (!_formKey.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
viewModel.onSavePressed(context);
|
||||
|
|
@ -122,4 +121,4 @@ class _ClientEditState extends State<ClientEdit>
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ class ClientEditDetails extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ClientEditDetailsState extends State<ClientEditDetails> {
|
||||
|
||||
final _nameController = TextEditingController();
|
||||
final _idNumberController = TextEditingController();
|
||||
final _vatNumberController = TextEditingController();
|
||||
|
|
@ -42,7 +41,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
_custom2Controller,
|
||||
];
|
||||
|
||||
_controllers.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||
_controllers
|
||||
.forEach((dynamic controller) => controller.removeListener(_onChanged));
|
||||
|
||||
final client = widget.viewModel.client;
|
||||
_nameController.text = client.name;
|
||||
|
|
@ -53,7 +53,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
_custom1Controller.text = client.customValue1;
|
||||
_custom2Controller.text = client.customValue2;
|
||||
|
||||
_controllers.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||
_controllers
|
||||
.forEach((dynamic controller) => controller.addListener(_onChanged));
|
||||
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
|
@ -71,14 +72,13 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
void _onChanged() {
|
||||
final viewModel = widget.viewModel;
|
||||
final client = viewModel.client.rebuild((b) => b
|
||||
..name = _nameController.text.trim()
|
||||
..idNumber = _idNumberController.text.trim()
|
||||
..vatNumber = _vatNumberController.text.trim()
|
||||
..website = _websiteController.text.trim()
|
||||
..workPhone = _phoneController.text.trim()
|
||||
..customValue1 = _custom1Controller.text.trim()
|
||||
..customValue2 = _custom2Controller.text.trim()
|
||||
);
|
||||
..name = _nameController.text.trim()
|
||||
..idNumber = _idNumberController.text.trim()
|
||||
..vatNumber = _vatNumberController.text.trim()
|
||||
..website = _websiteController.text.trim()
|
||||
..workPhone = _phoneController.text.trim()
|
||||
..customValue1 = _custom1Controller.text.trim()
|
||||
..customValue2 = _custom2Controller.text.trim());
|
||||
if (client != viewModel.client) {
|
||||
viewModel.onChanged(client);
|
||||
}
|
||||
|
|
@ -101,14 +101,15 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
decoration: InputDecoration(
|
||||
labelText: localization.name,
|
||||
),
|
||||
validator: (String val) => ! viewModel.client.hasNameSet
|
||||
validator: (String val) => !viewModel.client.hasNameSet
|
||||
? AppLocalization.of(context).pleaseEnterAClientOrContactName
|
||||
: null,
|
||||
),
|
||||
TextFormField(
|
||||
autocorrect: false,
|
||||
controller: _idNumberController,
|
||||
decoration: InputDecoration(labelText: localization.idNumber,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.idNumber,
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ class _ClientViewState extends State<ClientView>
|
|||
Navigator.of(context).pop();
|
||||
store.dispatch(EditTask(
|
||||
task: TaskEntity(
|
||||
isRunning:
|
||||
store.state.uiState.autoStartTasks)
|
||||
isRunning: store
|
||||
.state.uiState.autoStartTasks)
|
||||
.rebuild((b) => b.clientId = client.id),
|
||||
context: context));
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ class ClientViewActivity extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
final activities = client.activities;
|
||||
|
||||
if (activities.isEmpty) {
|
||||
|
|
@ -24,6 +23,5 @@ class ClientViewActivity extends StatelessWidget {
|
|||
return ActivityListTile(activity: activity);
|
||||
},
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,11 +157,10 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
}));
|
||||
}
|
||||
|
||||
listTiles
|
||||
.add(Padding(
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: FutureBuilder<Null>(future: _launched, builder: _launchStatus),
|
||||
));
|
||||
listTiles.add(Padding(
|
||||
padding: const EdgeInsets.all(14.0),
|
||||
child: FutureBuilder<Null>(future: _launched, builder: _launchStatus),
|
||||
));
|
||||
|
||||
return listTiles;
|
||||
}
|
||||
|
|
@ -203,8 +202,7 @@ class AppListTile extends StatelessWidget {
|
|||
onLongPress: () {
|
||||
Clipboard.setData(ClipboardData(text: copyValue ?? title));
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(AppLocalization
|
||||
.of(context)
|
||||
content: Text(AppLocalization.of(context)
|
||||
.copiedToClipboard
|
||||
.replaceFirst(':value', copyValue ?? title))));
|
||||
},
|
||||
|
|
|
|||
|
|
@ -28,4 +28,3 @@ class DashboardActivity extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ class _DashboardChartState extends State<DashboardChart> {
|
|||
},
|
||||
child: Container(
|
||||
color: isSelected ? Colors.blue : theme.cardColor,
|
||||
padding: EdgeInsets.only(left: 16, top: 16, right: 32, bottom: 8),
|
||||
padding:
|
||||
EdgeInsets.only(left: 16, top: 16, right: 32, bottom: 8),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
|
|
@ -189,13 +190,12 @@ class _DashboardChartState extends State<DashboardChart> {
|
|||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
localization.average +
|
||||
': ' +
|
||||
formatNumber(series.average, context,
|
||||
currencyId: widget.currencyId),
|
||||
style:
|
||||
theme.textTheme.subhead,
|
||||
),
|
||||
localization.average +
|
||||
': ' +
|
||||
formatNumber(series.average, context,
|
||||
currencyId: widget.currencyId),
|
||||
style: theme.textTheme.subhead,
|
||||
),
|
||||
),
|
||||
_selected != null
|
||||
? Text(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'package:invoiceninja_flutter/ui/app/loading_indicator.dart';
|
|||
import 'package:invoiceninja_flutter/ui/dashboard/dashboard_vm.dart';
|
||||
|
||||
class DashboardOverview extends StatelessWidget {
|
||||
|
||||
const DashboardOverview({
|
||||
Key key,
|
||||
@required this.viewModel,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:invoiceninja_flutter/ui/dashboard/dashboard_vm.dart';
|
||||
|
||||
class DashboardScreen extends StatelessWidget {
|
||||
|
||||
static const String route = '/dashboard';
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
decoration: InputDecoration(
|
||||
labelText: localization.discount,
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
|
@ -274,7 +275,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
labelText: company
|
||||
.getCustomFieldLabel(CustomFieldType.surcharge1),
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
)
|
||||
: Container(),
|
||||
company.getCustomFieldLabel(CustomFieldType.surcharge2).isNotEmpty
|
||||
|
|
@ -284,7 +286,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
labelText: company
|
||||
.getCustomFieldLabel(CustomFieldType.surcharge2),
|
||||
),
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
)
|
||||
: Container(),
|
||||
company.enableInvoiceTaxes
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ class InvoiceEditNotesVM extends EntityEditNotesVM {
|
|||
InvoiceEntity invoice,
|
||||
Function(InvoiceEntity) onChanged,
|
||||
}) : super(
|
||||
company: company,
|
||||
invoice: invoice,
|
||||
onChanged: onChanged,
|
||||
);
|
||||
company: company,
|
||||
invoice: invoice,
|
||||
onChanged: onChanged,
|
||||
);
|
||||
|
||||
factory InvoiceEditNotesVM.fromStore(Store<AppState> store) {
|
||||
final AppState state = store.state;
|
||||
|
|
|
|||
|
|
@ -140,8 +140,7 @@ class InvoiceListVM extends EntityListVM {
|
|||
final localization = AppLocalization.of(context);
|
||||
switch (action) {
|
||||
case EntityAction.edit:
|
||||
store.dispatch(
|
||||
EditInvoice(context: context, invoice: invoice));
|
||||
store.dispatch(EditInvoice(context: context, invoice: invoice));
|
||||
break;
|
||||
case EntityAction.pdf:
|
||||
viewPdf(invoice, context);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,8 @@ class _PaymentEditState extends State<PaymentEdit> {
|
|||
? TextFormField(
|
||||
controller: _amountController,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.amount,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -83,8 +83,7 @@ class PaymentListVM {
|
|||
final localization = AppLocalization.of(context);
|
||||
switch (action) {
|
||||
case EntityAction.edit:
|
||||
store.dispatch(
|
||||
EditPayment(context: context, payment: payment));
|
||||
store.dispatch(EditPayment(context: context, payment: payment));
|
||||
break;
|
||||
case EntityAction.sendEmail:
|
||||
store.dispatch(EmailPaymentRequest(
|
||||
|
|
|
|||
|
|
@ -184,7 +184,8 @@ class _ProductEditState extends State<ProductEdit> {
|
|||
TextFormField(
|
||||
key: Key(ProductKeys.cost),
|
||||
controller: _costController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.cost,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ class ProductEditVM {
|
|||
final localization = AppLocalization.of(context);
|
||||
switch (action) {
|
||||
case EntityAction.newInvoice:
|
||||
final item =
|
||||
convertProductToInvoiceItem(context: context, product: product);
|
||||
final item = convertProductToInvoiceItem(
|
||||
context: context, product: product);
|
||||
store.dispatch(EditInvoice(
|
||||
context: context,
|
||||
invoice: InvoiceEntity(company: state.selectedCompany)
|
||||
|
|
|
|||
|
|
@ -31,12 +31,14 @@ class ProductListItem extends StatelessWidget {
|
|||
child: ListTile(
|
||||
onTap: onTap,
|
||||
onLongPress: onLongPress,
|
||||
leading: onCheckboxChanged != null ? Checkbox(
|
||||
//key: NinjaKeys.productItemCheckbox(task.id),
|
||||
value: isChecked,
|
||||
onChanged: (value) => onCheckboxChanged(value),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
) : null,
|
||||
leading: onCheckboxChanged != null
|
||||
? Checkbox(
|
||||
//key: NinjaKeys.productItemCheckbox(task.id),
|
||||
value: isChecked,
|
||||
onChanged: (value) => onCheckboxChanged(value),
|
||||
activeColor: Theme.of(context).accentColor,
|
||||
)
|
||||
: null,
|
||||
title: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Row(
|
||||
|
|
|
|||
|
|
@ -186,14 +186,16 @@ class _ProjectEditState extends State<ProjectEdit> {
|
|||
},
|
||||
),
|
||||
TextFormField(
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
controller: _hoursController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.budgetedHours,
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
keyboardType:
|
||||
TextInputType.numberWithOptions(decimal: true),
|
||||
controller: _taskRateController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.taskRate,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
import 'package:invoiceninja_flutter/ui/app/dismissible_entity.dart';
|
||||
|
||||
class ProjectListItem extends StatelessWidget {
|
||||
|
||||
const ProjectListItem({
|
||||
@required this.user,
|
||||
@required this.onEntityAction,
|
||||
|
|
@ -72,12 +71,13 @@ class ProjectListItem extends StatelessWidget {
|
|||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
subtitle != null && subtitle.isNotEmpty ?
|
||||
Text(
|
||||
subtitle,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
) : Container(),
|
||||
subtitle != null && subtitle.isNotEmpty
|
||||
? Text(
|
||||
subtitle,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
: Container(),
|
||||
EntityStateLabel(project),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -87,8 +87,7 @@ class ProjectListVM {
|
|||
onEntityAction: (context, project, action) {
|
||||
switch (action) {
|
||||
case EntityAction.edit:
|
||||
store.dispatch(
|
||||
EditProject(context: context, project: project));
|
||||
store.dispatch(EditProject(context: context, project: project));
|
||||
break;
|
||||
case EntityAction.newInvoice:
|
||||
final items =
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class ProjectView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _ProjectViewState extends State<ProjectView> {
|
||||
|
||||
Timer _timer;
|
||||
|
||||
@override
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue