Settings
This commit is contained in:
parent
c0a55672ca
commit
074f71e2a1
|
|
@ -162,7 +162,9 @@ abstract class BaseEntity implements SelectableEntity {
|
|||
bool includeEdit = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
if (userCompany.canEditEntity(this) && (isArchived || isDeleted)) {
|
||||
// TODO remove ?? check
|
||||
if (userCompany.canEditEntity(this) &&
|
||||
(isArchived || (isDeleted ?? false))) {
|
||||
actions.add(EntityAction.restore);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,8 @@ abstract class GroupEntity extends Object
|
|||
bool includeEdit = false}) {
|
||||
final actions = <EntityAction>[];
|
||||
|
||||
if (!isDeleted) {
|
||||
// TODO remove ??
|
||||
if (!(isDeleted ?? false)) {
|
||||
if (includeEdit && userCompany.canEditEntity(this)) {
|
||||
actions.add(EntityAction.edit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/edit_icon_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/group/view/group_view_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/entities/entity_state_title.dart';
|
||||
|
|
@ -21,26 +22,26 @@ class _GroupViewState extends State<GroupView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = widget.viewModel;
|
||||
final userCompany = viewModel.state.userCompany;
|
||||
final group = viewModel.group;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: EntityStateTitle(entity: group),
|
||||
actions: group.isNew
|
||||
? []
|
||||
: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
viewModel.onEditPressed(context);
|
||||
},
|
||||
),
|
||||
ActionMenuButton(
|
||||
isSaving: viewModel.isSaving,
|
||||
entity: group,
|
||||
onSelected: viewModel.onEntityAction,
|
||||
),
|
||||
],
|
||||
actions: [
|
||||
userCompany.canEditEntity(group)
|
||||
? EditIconButton(
|
||||
isVisible: !(group.isDeleted ?? false), // TODO remove this
|
||||
onPressed: () => viewModel.onEditPressed(context),
|
||||
)
|
||||
: Container(),
|
||||
ActionMenuButton(
|
||||
entityActions: group.getActions(userCompany: userCompany),
|
||||
isSaving: viewModel.isSaving,
|
||||
entity: group,
|
||||
onSelected: viewModel.onEntityAction,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: FormCard(children: [
|
||||
// STARTER: widgets - do not remove comment
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/buttons/edit_icon_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||
import 'package:invoiceninja_flutter/ui/stub/view/stub_view_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
|
|
@ -22,27 +23,26 @@ class _StubViewState extends State<StubView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final viewModel = widget.viewModel;
|
||||
final userCompany = viewModel.state.userCompany;
|
||||
final stub = viewModel.stub;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: EntityStateTitle(entity: stub),
|
||||
actions: stub.isNew
|
||||
? []
|
||||
: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.edit),
|
||||
onPressed: () {
|
||||
viewModel.onEditPressed(context);
|
||||
},
|
||||
),
|
||||
ActionMenuButton(
|
||||
user: viewModel.company.user,
|
||||
isSaving: viewModel.isSaving,
|
||||
entity: stub,
|
||||
onSelected: viewModel.onEntityAction,
|
||||
),
|
||||
],
|
||||
actions: [
|
||||
userCompany.canEditEntity(stub)
|
||||
? EditIconButton(
|
||||
isVisible: !stub.isDeleted,
|
||||
onPressed: () => viewModel.onEditPressed(context),
|
||||
)
|
||||
: Container(),
|
||||
ActionMenuButton(
|
||||
entityActions: stub.getActions(userCompany: userCompany),
|
||||
isSaving: viewModel.isSaving,
|
||||
entity: stub,
|
||||
onSelected: viewModel.onEntityAction,
|
||||
)
|
||||
],
|
||||
),
|
||||
body: FormCard(
|
||||
children: [
|
||||
|
|
|
|||
Loading…
Reference in New Issue