Show deactivated like debug and support re-deactivating

This commit is contained in:
Hillel Coren 2021-03-16 10:19:15 +02:00
parent f169dffc53
commit 1ddb7bb7de
2 changed files with 39 additions and 25 deletions

View File

@ -232,7 +232,7 @@ class MenuDrawer extends StatelessWidget {
color: Theme.of(context).cardColor,
child: ScrollableListView(
children: <Widget>[
if (kReleaseMode && state.account.debugEnabled)
if (state.account.debugEnabled && kReleaseMode)
if (state.isMenuCollapsed)
Tooltip(
message: localization.debugModeIsEnabled,
@ -261,6 +261,43 @@ class MenuDrawer extends StatelessWidget {
),
onTap: () => launch(kDebugModeUrl),
),
if (state.company.isDisabled)
if (state.isMenuCollapsed)
Tooltip(
message: localization.companyDisabledWarning,
child: ListTile(
contentPadding:
const EdgeInsets.only(left: 20),
onTap: () {
store.dispatch(ViewSettings(
navigator: Navigator.of(context),
section: kSettingsAccountManagement));
},
leading:
Icon(Icons.warning, color: Colors.orange),
),
)
else
ListTile(
tileColor: Colors.orange.shade800,
title: Padding(
padding: const EdgeInsets.only(bottom: 6),
child: IconText(
icon: Icons.warning,
text: localization.warning,
style: TextStyle(color: Colors.white),
),
),
subtitle: Text(
localization.companyDisabledWarning,
style: TextStyle(color: Colors.white),
),
onTap: () {
store.dispatch(ViewSettings(
navigator: Navigator.of(context),
section: kSettingsAccountManagement));
},
),
DrawerTile(
company: company,
icon: getEntityIcon(EntityType.dashboard),
@ -604,28 +641,6 @@ class SidebarFooter extends StatelessWidget {
),
]),
)
else if (state.company.isDisabled)
IconButton(
tooltip: localization.warning,
icon: Icon(
Icons.warning,
color: Colors.orange,
),
onPressed: () => showMessageDialog(
context: context,
message: localization.companyDisabledWarning,
secondaryActions: [
TextButton(
child: Text(localization.viewSettings.toUpperCase()),
onPressed: () {
store.dispatch(ViewSettings(
navigator: Navigator.of(context),
section: kSettingsAccountManagement));
Navigator.of(context).pop();
},
),
]),
)
else if (state.credentials.token.isEmpty)
IconButton(
tooltip: localization.error,

View File

@ -157,8 +157,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
'project_name': 'Project Name',
'warning': 'Warning',
'view_settings': 'View Settings',
'company_disabled_warning':
'Warning: this company has not yet been activated',
'company_disabled_warning': 'Company is not activated',
'late_invoice': 'Late Invoice',
'expired_quote': 'Expired Quote',
'remind_invoice': 'Remind Invoice',