Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Oct 25, 2023
2 parents b3e120d + f937acd commit 1eb028e
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 36 deletions.
5 changes: 3 additions & 2 deletions lib/data/models/invoice_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,8 @@ class TaskItemFields {

abstract class InvoiceItemEntity
implements Built<InvoiceItemEntity, InvoiceItemEntityBuilder> {
factory InvoiceItemEntity({String? productKey, double? quantity}) {
factory InvoiceItemEntity(
{String? productKey, double? quantity, String? typeId}) {
return _$InvoiceItemEntity._(
productKey: productKey ?? '',
notes: '',
Expand All @@ -1565,7 +1566,7 @@ abstract class InvoiceItemEntity
taxRate2: 0,
taxName3: '',
taxRate3: 0,
typeId: TYPE_STANDARD,
typeId: typeId ?? TYPE_STANDARD,
customValue1: '',
customValue2: '',
customValue3: '',
Expand Down
8 changes: 7 additions & 1 deletion lib/data/models/vendor_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ abstract class VendorEntity extends Object
number: '',
isChanged: false,
name: '',
displayName: '',
address1: '',
address2: '',
city: '',
Expand Down Expand Up @@ -164,6 +165,9 @@ abstract class VendorEntity extends Object

String get name;

@BuiltValueField(wireName: 'display_name')
String get displayName;

String get address1;

String get address2;
Expand Down Expand Up @@ -469,7 +473,8 @@ abstract class VendorEntity extends Object

@override
String get listDisplayName {
return name;
// TODO simplify once not needed any more
return displayName.isNotEmpty ? displayName : calculateDisplayName;
}

@override
Expand Down Expand Up @@ -520,6 +525,7 @@ abstract class VendorEntity extends Object
..activities.replace(BuiltList<ActivityEntity>())
..lastLogin = 0
..languageId = ''
..displayName = ''
..classification = '';

static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer;
Expand Down
32 changes: 26 additions & 6 deletions lib/data/models/vendor_model.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/ui/app/pinput.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AppPinput extends StatelessWidget {

@override
Widget build(BuildContext context) {
final localization = AppLocalization.of(context);
final localization = AppLocalization.of(context)!;

return Pinput(
onCompleted: onCompleted,
Expand All @@ -18,7 +18,7 @@ class AppPinput extends StatelessWidget {
showCursor: true,
androidSmsAutofillMethod: AndroidSmsAutofillMethod.smsUserConsentApi,
validator: (value) =>
value!.isEmpty ? localization!.pleaseEnterACode : null,
value!.isEmpty ? localization.pleaseEnterACode : null,
);
}
}
6 changes: 3 additions & 3 deletions lib/ui/app/pinput.dart.foss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';

class AppPinput extends StatelessWidget {
const AppPinput({Key key, this.onCompleted}) : super(key: key);
const AppPinput({Key? key, this.onCompleted}) : super(key: key);

final ValueChanged<String> onCompleted;
final ValueChanged<String>? onCompleted;

@override
Widget build(BuildContext context) {
final localization = AppLocalization.of(context);
final localization = AppLocalization.of(context)!;

return DecoratedFormField(
label: localization.code,
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/invoice/edit/invoice_edit_desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ class InvoiceEditDesktopState extends State<InvoiceEditDesktop>
vendorId: invoice.vendorId,
vendorState: state.vendorState,
onSelected: (vendor) {
viewModel.onVendorChanged!(
context, invoice, vendor as VendorEntity);
viewModel.onVendorChanged!(context, invoice,
vendor as VendorEntity?);
},
onAddPressed: (completer) => viewModel
.onAddVendorPressed!(context, completer),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/invoice/edit/invoice_edit_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
vendorState: state.vendorState,
onSelected: (vendor) {
viewModel.onVendorChanged!(
context, invoice, vendor as VendorEntity);
context, invoice, vendor as VendorEntity?);
},
onAddPressed: (completer) =>
viewModel.onAddVendorPressed!(context, completer),
Expand Down
12 changes: 9 additions & 3 deletions lib/ui/invoice/edit/invoice_edit_items.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,9 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
child: Column(
children: <Widget>[
DecoratedFormField(
label: localization.product,
label: widget.invoiceItem.isTask
? localization.service
: localization.product,
controller: _productKeyController,
onSavePressed: widget.entityViewModel.onSavePressed,
keyboardType: TextInputType.text,
Expand Down Expand Up @@ -296,15 +298,19 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
value: _custom4Controller.text,
),
DecoratedFormField(
label: localization.unitCost,
label: widget.invoiceItem.isTask
? localization.rate
: localization.unitCost,
controller: _costController,
keyboardType:
TextInputType.numberWithOptions(decimal: true, signed: true),
onSavePressed: widget.entityViewModel.onSavePressed,
),
company.enableProductQuantity
? DecoratedFormField(
label: localization.quantity,
label: widget.invoiceItem.isTask
? localization.hours
: localization.quantity,
controller: _qtyController,
keyboardType: TextInputType.numberWithOptions(
decimal: true, signed: true),
Expand Down
10 changes: 6 additions & 4 deletions lib/ui/invoice/edit/invoice_item_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
with SingleTickerProviderStateMixin {
String? _filter;
String? _filterClientId;
TabController? _tabController;
late TabController _tabController;
final List<BaseEntity> _selected = [];

final _textController = TextEditingController();
Expand All @@ -57,15 +57,17 @@ class _InvoiceItemSelectorState extends State<InvoiceItemSelector>
@override
void dispose() {
_textController.dispose();
_tabController!.dispose();
_tabController.dispose();
super.dispose();
}

void _addBlankItem(CompanyEntity company) {
widget.onItemsSelected!([
InvoiceItemEntity(
quantity:
company.defaultQuantity || !company.enableProductQuantity ? 1 : 0)
quantity:
company.defaultQuantity || !company.enableProductQuantity ? 1 : 0,
typeId: _tabController.index == 1 ? InvoiceItemEntity.TYPE_TASK : null,
)
]);
Navigator.pop(context);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/vendor/edit/vendor_edit_footer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class VendorEditFooter extends StatelessWidget {
padding: const EdgeInsets.only(left: 16, top: 8),
child: Text(
vendor.number.isEmpty
? vendor.name
: '${vendor.number} • ${vendor.name}',
? vendor.calculateDisplayName
: '${vendor.number} • ${vendor.calculateDisplayName}',
style: TextStyle(
color: state.prefState.enableDarkMode
? Colors.white
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/app_review.dart.foss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class AppReview {

static void requestReview() => null;

static void openStoreListing() =>
launch(getRateAppURL(navigatorKey.currentContext));
static void openStoreListing() => launchUrl(
Uri.dataFromString(getRateAppURL(navigatorKey.currentContext!)));
}
16 changes: 8 additions & 8 deletions lib/utils/oauth.dart.foss
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
class GoogleOAuth {

static bool get isEnabled => false;

static Future<bool> signIn(Function(String, String) callback, {bool isSilent = false}) async {
//
static Future<bool> signIn(Function(String, String) callback,
{bool isSilent = false}) async {
return false;
}

static Future<bool> signUp(Function(String, String) callback) async {
//
return false;
}

static Future<bool> requestGmailScope() async {
//
return false;
}

/*
Expand All @@ -20,11 +20,11 @@ class GoogleOAuth {
}
*/

static void signOut() async {
static Future<Null> signOut() async {
//
}

static void disconnect() async {
static Future<Null> disconnect() async {
//
}
}
}

0 comments on commit 1eb028e

Please sign in to comment.