Client portal settings

This commit is contained in:
Hillel Coren 2020-11-30 14:06:18 +02:00
parent aca92999b9
commit 6b11e8a2bc
3 changed files with 146 additions and 24 deletions

View File

@ -1950,6 +1950,22 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'use_credits_payment')
String get useCreditsPayment;
@nullable
@BuiltValueField(wireName: 'portal_custom_head')
String get clientPortalCustomHeader;
@nullable
@BuiltValueField(wireName: 'portal_custom_css')
String get clientPortalCustomCss;
@nullable
@BuiltValueField(wireName: 'portal_custom_footer')
String get clientPortalCustomFooter;
@nullable
@BuiltValueField(wireName: 'portal_custom_js')
String get clientPortalCustomJs;
// TODO remove this field
@nullable
@BuiltValueField(wireName: 'custom_payment_terms')

File diff suppressed because one or more lines are too long

View File

@ -46,6 +46,8 @@ class _ClientPortalState extends State<ClientPortal>
final _portalDomainController = TextEditingController();
final _customCssController = TextEditingController();
final _customJavaScriptController = TextEditingController();
final _customHeaderController = TextEditingController();
final _customFooterController = TextEditingController();
final _customMessageDashboard = TextEditingController();
final _customMessageUnpaidInvoice = TextEditingController();
@ -63,7 +65,7 @@ class _ClientPortalState extends State<ClientPortal>
final settingsUIState = widget.viewModel.state.settingsUIState;
_controller = TabController(
vsync: this, length: 3, initialIndex: settingsUIState.tabIndex);
vsync: this, length: 4, initialIndex: settingsUIState.tabIndex);
_controller.addListener(_onTabChanged);
}
@ -96,6 +98,8 @@ class _ClientPortalState extends State<ClientPortal>
_customMessageUnapprovedQuote,
_termsController,
_privacyController,
_customHeaderController,
_customFooterController,
];
_controllers
@ -111,6 +115,10 @@ class _ClientPortalState extends State<ClientPortal>
_customMessageUnapprovedQuote.text = settings.customMessageUnapprovedQuote;
_privacyController.text = settings.clientPortalPrivacy;
_termsController.text = settings.clientPortalTerms;
_customHeaderController.text = settings.clientPortalCustomHeader;
_customFooterController.text = settings.clientPortalCustomFooter;
_customCssController.text = settings.clientPortalCustomCss;
_customJavaScriptController.text = settings.clientPortalCustomJs;
_controllers
.forEach((dynamic controller) => controller.addListener(_onChanged));
@ -135,7 +143,11 @@ class _ClientPortalState extends State<ClientPortal>
..customMessageUnapprovedQuote =
_customMessageUnapprovedQuote.text.trim()
..clientPortalTerms = _termsController.text.trim()
..clientPortalPrivacy = _privacyController.text.trim());
..clientPortalPrivacy = _privacyController.text.trim()
..clientPortalCustomJs = _customJavaScriptController.text.trim()
..clientPortalCustomCss = _customCssController.text.trim()
..clientPortalCustomHeader = _customHeaderController.text.trim()
..clientPortalCustomFooter = _customFooterController.text.trim());
if (settings != widget.viewModel.settings) {
widget.viewModel.onSettingsChanged(settings);
}
@ -181,11 +193,9 @@ class _ClientPortalState extends State<ClientPortal>
Tab(
text: localization.messages,
),
/*
Tab(
text: localization.customize,
),
*/
],
),
body: AppTabForm(
@ -416,27 +426,35 @@ class _ClientPortalState extends State<ClientPortal>
),
],
),
/*
ListView(
children: <Widget>[
FormCard(
children: <Widget>[
DecoratedFormField(
label: localization.header,
controller: _customHeaderController,
maxLines: 6,
),
DecoratedFormField(
label: localization.footer,
controller: _customFooterController,
maxLines: 6,
),
DecoratedFormField(
label: localization.customCss,
controller: _customCssController,
maxLines: 8,
maxLines: 6,
),
if (isSelfHosted(context))
DecoratedFormField(
label: localization.customJavascript,
controller: _customJavaScriptController,
maxLines: 8,
maxLines: 6,
),
],
)
],
),
*/
],
),
);