Improve auto-taxes

This commit is contained in:
Hillel Coren 2023-07-27 16:51:40 +03:00
parent ceeba71cdd
commit de58c3f80d
3 changed files with 18 additions and 12 deletions

View File

@ -287,23 +287,24 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
value: client.customValue4, value: client.customValue4,
onSavePressed: _onSavePressed, onSavePressed: _onSavePressed,
), ),
if (state.company.settings.enableEInvoice == true) ...[ if (state.company.settings.enableEInvoice == true)
DecoratedFormField( DecoratedFormField(
label: localization.routingId, label: localization.routingId,
controller: _routingIdController, controller: _routingIdController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
onSavePressed: _onSavePressed, onSavePressed: _onSavePressed,
), ),
if (state.company.calculateTaxes) ...[
SizedBox(height: 20), SizedBox(height: 20),
SwitchListTile( SwitchListTile(
title: Text(localization.taxExempt), title: Text(localization.isTaxExempt),
value: client.isTaxExempt, value: client.isTaxExempt,
onChanged: (value) { onChanged: (value) {
viewModel viewModel
.onChanged(client.rebuild((b) => b..isTaxExempt = value)); .onChanged(client.rebuild((b) => b..isTaxExempt = value));
}, },
) )
] ],
], ],
), ),
); );

View File

@ -154,15 +154,6 @@ class ClientEditSettingsState extends State<ClientEditSettings> {
numDays == null ? null : '$numDays')); numDays == null ? null : '$numDays'));
}, },
), ),
if (company.isModuleEnabled(EntityType.task))
DecoratedFormField(
controller: _taskRateController,
isMoney: true,
label: localization.taskRate,
onSavePressed: viewModel.onSavePressed,
keyboardType:
TextInputType.numberWithOptions(decimal: true, signed: true),
),
if (company.isModuleEnabled(EntityType.invoice)) ...[ if (company.isModuleEnabled(EntityType.invoice)) ...[
AppDropdownButton<bool>( AppDropdownButton<bool>(
blankValue: null, blankValue: null,
@ -185,6 +176,15 @@ class ClientEditSettingsState extends State<ClientEditSettings> {
), ),
], ],
), ),
if (company.isModuleEnabled(EntityType.task))
DecoratedFormField(
controller: _taskRateController,
isMoney: true,
label: localization.taskRate,
onSavePressed: viewModel.onSavePressed,
keyboardType:
TextInputType.numberWithOptions(decimal: true, signed: true),
),
], ],
], ],
); );

View File

@ -18,6 +18,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = { static final Map<String, Map<String, String>> _localizedValues = {
'en': { 'en': {
// STARTER: lang key - do not remove comment // STARTER: lang key - do not remove comment
'is_tax_exempt': 'Tax Exempt',
'district': 'District', 'district': 'District',
'region': 'Region', 'region': 'Region',
'county': 'County', 'county': 'County',
@ -105944,6 +105945,10 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['district'] ?? _localizedValues[localeCode]['district'] ??
_localizedValues['en']['district']; _localizedValues['en']['district'];
String get isTaxExempt =>
_localizedValues[localeCode]['is_tax_exempt'] ??
_localizedValues['en']['is_tax_exempt'];
// STARTER: lang field - do not remove comment // STARTER: lang field - do not remove comment
String lookup(String key) { String lookup(String key) {