Skip to content

Commit

Permalink
Hide schedule report feature if not yet supported
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jan 23, 2024
1 parent 16e1ff7 commit a51fbf3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
33 changes: 18 additions & 15 deletions lib/ui/reports/reports_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,14 @@ class ReportsScreen extends StatelessWidget {
viewModel.onExportPressed(context);
},
),
AppTextButton(
label: localization.schedule,
isInHeader: true,
onPressed: () {
viewModel.onSchedulePressed(context);
},
),
if (supportsLatestFeatures('5.8.0'))
AppTextButton(
label: localization.schedule,
isInHeader: true,
onPressed: () {
viewModel.onSchedulePressed(context);
},
),
],
Padding(
padding: const EdgeInsets.only(right: 8),
Expand Down Expand Up @@ -545,15 +546,17 @@ class ReportsScreen extends StatelessWidget {
},
),
),
SizedBox(width: kGutterWidth),
Expanded(
child: AppButton(
label: localization.schedule,
onPressed: () {
viewModel.onSchedulePressed(context);
},
if (supportsLatestFeatures('5.8.0')) ...[
SizedBox(width: kGutterWidth),
Expanded(
child: AppButton(
label: localization.schedule,
onPressed: () {
viewModel.onSchedulePressed(context);
},
),
),
),
],
],
),
),
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/schedule/edit/schedule_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:invoiceninja_flutter/ui/schedule/edit/schedule_edit_vm.dart';
import 'package:invoiceninja_flutter/utils/localization.dart';
import 'package:invoiceninja_flutter/utils/completers.dart';
import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart';
import 'package:invoiceninja_flutter/utils/platforms.dart';
import 'package:invoiceninja_flutter/utils/strings.dart';

class ScheduleEdit extends StatefulWidget {
Expand Down Expand Up @@ -163,6 +164,9 @@ class _ScheduleEditState extends State<ScheduleEdit> {
);
},
items: ScheduleEntity.TEMPLATES
.where((entry) =>
supportsLatestFeatures('5.8.0') ||
entry != ScheduleEntity.TEMPLATE_EMAIL_REPORT)
.map((entry) => DropdownMenuItem(
value: entry,
child: Text(localization.lookup(entry)),
Expand Down
30 changes: 16 additions & 14 deletions lib/ui/settings/import_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -356,20 +356,22 @@ class _ImportExportState extends State<ImportExport> {
},
),
),
SizedBox(width: kGutterWidth),
Expanded(
child: AppButton(
label: localization.schedule,
iconData: Icons.schedule,
onPressed: () {
createEntity(
entity: ScheduleEntity(
ScheduleEntity.TEMPLATE_EMAIL_REPORT)
.rebuild((b) => b
..parameters.reportName =
_exportType.name));
},
))
if (supportsLatestFeatures('5.8.0')) ...[
SizedBox(width: kGutterWidth),
Expanded(
child: AppButton(
label: localization.schedule,
iconData: Icons.schedule,
onPressed: () {
createEntity(
entity: ScheduleEntity(
ScheduleEntity.TEMPLATE_EMAIL_REPORT)
.rebuild((b) => b
..parameters.reportName =
_exportType.name));
},
))
],
],
)
],
Expand Down

0 comments on commit a51fbf3

Please sign in to comment.