Don't show restore options for payments
This commit is contained in:
parent
76fa354b25
commit
6458dd398f
|
|
@ -367,6 +367,8 @@ abstract class BaseEntity implements SelectableEntity {
|
|||
|
||||
bool get isEditable => !isDeleted;
|
||||
|
||||
bool get isRestorable => true;
|
||||
|
||||
bool userCanAccess(String userId) =>
|
||||
createdUserId == userId || assignedUserId == userId;
|
||||
|
||||
|
|
|
|||
|
|
@ -471,6 +471,9 @@ abstract class PaymentEntity extends Object
|
|||
kPaymentStatusPartiallyRefunded
|
||||
].contains(statusId);
|
||||
|
||||
@override
|
||||
bool get isRestorable => false;
|
||||
|
||||
@override
|
||||
FormatNumberType get listDisplayAmountType => FormatNumberType.money;
|
||||
|
||||
|
|
|
|||
|
|
@ -85,23 +85,24 @@ class DismissibleEntity extends StatelessWidget {
|
|||
endActionPane: ActionPane(
|
||||
motion: const DrawerMotion(),
|
||||
children: [
|
||||
entity.isActive
|
||||
? SlidableAction(
|
||||
label: localization.archive,
|
||||
backgroundColor: Colors.orange,
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.archive,
|
||||
onPressed: (context) =>
|
||||
handleEntityAction(entity, EntityAction.archive),
|
||||
)
|
||||
: SlidableAction(
|
||||
label: localization.restore,
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.restore,
|
||||
onPressed: (context) =>
|
||||
handleEntityAction(entity, EntityAction.restore),
|
||||
),
|
||||
if (entity.isActive)
|
||||
SlidableAction(
|
||||
label: localization.archive,
|
||||
backgroundColor: Colors.orange,
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.archive,
|
||||
onPressed: (context) =>
|
||||
handleEntityAction(entity, EntityAction.archive),
|
||||
)
|
||||
else if (entity.isRestorable)
|
||||
SlidableAction(
|
||||
label: localization.restore,
|
||||
backgroundColor: Colors.blue,
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.restore,
|
||||
onPressed: (context) =>
|
||||
handleEntityAction(entity, EntityAction.restore),
|
||||
),
|
||||
if (!entity.isDeleted)
|
||||
SlidableAction(
|
||||
label: localization.delete,
|
||||
|
|
|
|||
Loading…
Reference in New Issue