Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Dec 4, 2024
2 parents b2f60fd + 0e09806 commit 4ea86cd
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 16 deletions.
10 changes: 10 additions & 0 deletions lib/data/models/tax_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ abstract class TaxConfigEntity
return _$TaxConfigEntity._(
version: '',
sellerSubregion: '',
actsAsSender: false,
actsAsReceiver: false,
regions: BuiltMap<String, TaxConfigRegionEntity>(),
);
}
Expand All @@ -147,12 +149,20 @@ abstract class TaxConfigEntity
@BuiltValueField(wireName: 'seller_subregion')
String get sellerSubregion;

@BuiltValueField(wireName: 'acts_as_sender')
bool get actsAsSender;

@BuiltValueField(wireName: 'acts_as_receiver')
bool get actsAsReceiver;

BuiltMap<String, TaxConfigRegionEntity> get regions;

// ignore: unused_element
static void _initializeBuilder(TaxConfigEntityBuilder builder) => builder
..version = ''
..sellerSubregion = ''
..actsAsSender = false
..actsAsReceiver = false
..regions.replace(BuiltMap<String, TaxConfigRegionEntity>());

static Serializer<TaxConfigEntity> get serializer =>
Expand Down
45 changes: 45 additions & 0 deletions lib/data/models/tax_model.g.dart

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

20 changes: 4 additions & 16 deletions lib/ui/settings/tax_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ class _EditSubregionDialog extends StatefulWidget {

class __EditSubregionDialogState extends State<_EditSubregionDialog> {
String _taxName = '';
String _vatNumber = '';
double? _taxRate = 0;
double? _reducedTaxRate = 0;

Expand All @@ -407,7 +406,6 @@ class __EditSubregionDialogState extends State<_EditSubregionDialog> {
_taxName = subregionConfig.taxName;
_taxRate = subregionConfig.taxRate;
_reducedTaxRate = subregionConfig.reducedTaxRate;
_vatNumber = subregionConfig.vatNumber;
}

void _onDone() {
Expand All @@ -421,13 +419,10 @@ class __EditSubregionDialogState extends State<_EditSubregionDialog> {
viewModel.onCompanyChanged(company.rebuild((b) => b
..taxConfig.replace(taxConfig.rebuild((b) => b
..regions[widget.region] = taxConfigRegion.rebuild((b) => b
..subregions[widget.subregion] = taxConfigSubregion!.rebuild(
(b) => b
..taxName = _taxName
..taxRate = _taxRate
..reducedTaxRate = _reducedTaxRate
..vatNumber = _vatNumber,
))))));
..subregions[widget.subregion] = taxConfigSubregion!.rebuild((b) => b
..taxName = _taxName
..taxRate = _taxRate
..reducedTaxRate = _reducedTaxRate))))));

Navigator.of(context).pop();
}
Expand Down Expand Up @@ -475,13 +470,6 @@ class __EditSubregionDialogState extends State<_EditSubregionDialog> {
onChanged: (value) => _reducedTaxRate = parseDouble(value),
onSavePressed: (context) => _onDone(),
),
DecoratedFormField(
label: localization.vatNumber,
keyboardType: TextInputType.text,
initialValue: subregionData.vatNumber,
onChanged: (value) => _vatNumber = value.trim(),
onSavePressed: (context) => _onDone(),
),
],
)),
);
Expand Down

0 comments on commit 4ea86cd

Please sign in to comment.