Fix share product/quote columns option

This commit is contained in:
Hillel Coren 2023-03-23 09:09:49 +02:00
parent 15e9287c5f
commit b347791bbe
4 changed files with 54 additions and 45 deletions

View File

@ -57,6 +57,8 @@ class UpdateSettingsTab implements PersistUI {
class UpdatedSetting implements PersistUI {} class UpdatedSetting implements PersistUI {}
class UpdatedSettingUI implements PersistUI {}
class UpdateSettingsTemplate implements PersistUI { class UpdateSettingsTemplate implements PersistUI {
UpdateSettingsTemplate({@required this.selectedTemplate}); UpdateSettingsTemplate({@required this.selectedTemplate});

View File

@ -119,7 +119,7 @@ Reducer<SettingsUIState> settingsUIReducer = combineReducers([
TypedReducer<SettingsUIState, UpdateSettingsTemplate>((state, action) { TypedReducer<SettingsUIState, UpdateSettingsTemplate>((state, action) {
return state.rebuild((b) => b..selectedTemplate = action.selectedTemplate); return state.rebuild((b) => b..selectedTemplate = action.selectedTemplate);
}), }),
TypedReducer<SettingsUIState, UpdatedSetting>((state, action) { TypedReducer<SettingsUIState, UpdatedSettingUI>((state, action) {
return state return state
.rebuild((b) => b..updatedAt = DateTime.now().millisecondsSinceEpoch); .rebuild((b) => b..updatedAt = DateTime.now().millisecondsSinceEpoch);
}), }),

View File

@ -1086,8 +1086,8 @@ class _InvoiceDesignState extends State<InvoiceDesign>
], ],
), ),
if (settings.shareInvoiceQuoteColumns == false) if (settings.shareInvoiceQuoteColumns == false)
Expanded( FormCard(
child: FormCard( isLast: true,
child: MultiSelectList( child: MultiSelectList(
options: [ options: [
ProductItemFields.item, ProductItemFields.item,
@ -1131,7 +1131,6 @@ class _InvoiceDesignState extends State<InvoiceDesign>
prefix: 'product', prefix: 'product',
), ),
), ),
),
if (company.isModuleEnabled(EntityType.task)) if (company.isModuleEnabled(EntityType.task))
FormCard( FormCard(
isLast: true, isLast: true,

View File

@ -62,6 +62,14 @@ class InvoiceDesignVM {
company: state.uiState.settingsUIState.company, company: state.uiState.settingsUIState.company,
onSettingsChanged: (settings) { onSettingsChanged: (settings) {
store.dispatch(UpdateSettings(settings: settings)); store.dispatch(UpdateSettings(settings: settings));
final newSetting = settings.shareInvoiceQuoteColumns ?? true;
final oldSetting =
state.uiState.settingsUIState.settings.shareInvoiceQuoteColumns ??
true;
if (newSetting != oldSetting) {
// Need to force update the UI to show the new tabs
store.dispatch(UpdatedSettingUI());
}
}, },
onSavePressed: (context, entityTypes) { onSavePressed: (context, entityTypes) {
if (!state.isProPlan && !state.isTrial) { if (!state.isProPlan && !state.isTrial) {