Refunds
This commit is contained in:
parent
54534d55b9
commit
291984b684
|
|
@ -61,6 +61,7 @@ class EntityAction extends EnumClass {
|
||||||
static const EntityAction clientPortal = _$clientPortal;
|
static const EntityAction clientPortal = _$clientPortal;
|
||||||
static const EntityAction newPayment = _$newPayment;
|
static const EntityAction newPayment = _$newPayment;
|
||||||
static const EntityAction settings = _$settings;
|
static const EntityAction settings = _$settings;
|
||||||
|
static const EntityAction refund = _$refund;
|
||||||
static const EntityAction pdf = _$pdf;
|
static const EntityAction pdf = _$pdf;
|
||||||
static const EntityAction more = _$more;
|
static const EntityAction more = _$more;
|
||||||
static const EntityAction start = _$start;
|
static const EntityAction start = _$start;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ const EntityAction _$viewQuote = const EntityAction._('viewQuote');
|
||||||
const EntityAction _$clientPortal = const EntityAction._('clientPortal');
|
const EntityAction _$clientPortal = const EntityAction._('clientPortal');
|
||||||
const EntityAction _$newPayment = const EntityAction._('newPayment');
|
const EntityAction _$newPayment = const EntityAction._('newPayment');
|
||||||
const EntityAction _$settings = const EntityAction._('settings');
|
const EntityAction _$settings = const EntityAction._('settings');
|
||||||
|
const EntityAction _$refund = const EntityAction._('refund');
|
||||||
const EntityAction _$pdf = const EntityAction._('pdf');
|
const EntityAction _$pdf = const EntityAction._('pdf');
|
||||||
const EntityAction _$more = const EntityAction._('more');
|
const EntityAction _$more = const EntityAction._('more');
|
||||||
const EntityAction _$start = const EntityAction._('start');
|
const EntityAction _$start = const EntityAction._('start');
|
||||||
|
|
@ -88,6 +89,8 @@ EntityAction _$valueOf(String name) {
|
||||||
return _$newPayment;
|
return _$newPayment;
|
||||||
case 'settings':
|
case 'settings':
|
||||||
return _$settings;
|
return _$settings;
|
||||||
|
case 'refund':
|
||||||
|
return _$refund;
|
||||||
case 'pdf':
|
case 'pdf':
|
||||||
return _$pdf;
|
return _$pdf;
|
||||||
case 'more':
|
case 'more':
|
||||||
|
|
@ -131,6 +134,7 @@ final BuiltSet<EntityAction> _$values =
|
||||||
_$clientPortal,
|
_$clientPortal,
|
||||||
_$newPayment,
|
_$newPayment,
|
||||||
_$settings,
|
_$settings,
|
||||||
|
_$refund,
|
||||||
_$pdf,
|
_$pdf,
|
||||||
_$more,
|
_$more,
|
||||||
_$start,
|
_$start,
|
||||||
|
|
|
||||||
|
|
@ -301,10 +301,13 @@ abstract class PaymentEntity extends Object
|
||||||
actions.add(EntityAction.edit);
|
actions.add(EntityAction.edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userCompany.canEditEntity(this) &&
|
if (userCompany.canEditEntity(this)) {
|
||||||
client != null &&
|
if (client != null &&
|
||||||
client.hasEmailAddress) {
|
client.hasEmailAddress) {
|
||||||
actions.add(EntityAction.sendEmail);
|
actions.add(EntityAction.sendEmail);
|
||||||
|
}
|
||||||
|
|
||||||
|
actions.add(EntityAction.refund);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,16 +266,6 @@ class FilterPaymentsByEntity implements PersistUI {
|
||||||
|
|
||||||
void handlePaymentAction(
|
void handlePaymentAction(
|
||||||
BuildContext context, List<BaseEntity> payments, EntityAction action) {
|
BuildContext context, List<BaseEntity> payments, EntityAction action) {
|
||||||
assert(
|
|
||||||
[
|
|
||||||
EntityAction.restore,
|
|
||||||
EntityAction.archive,
|
|
||||||
EntityAction.delete,
|
|
||||||
EntityAction.toggleMultiselect
|
|
||||||
].contains(action) ||
|
|
||||||
payments.length == 1,
|
|
||||||
'Cannot perform this action on more than one payment');
|
|
||||||
|
|
||||||
if (payments.isEmpty) {
|
if (payments.isEmpty) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,12 @@ class EntityDataTableSource extends DataTableSource {
|
||||||
),
|
),
|
||||||
ActionMenuButton(
|
ActionMenuButton(
|
||||||
entityActions: entity.getActions(
|
entityActions: entity.getActions(
|
||||||
userCompany: state.userCompany, includeEdit: true),
|
userCompany: state.userCompany,
|
||||||
|
includeEdit: true,
|
||||||
|
client: entity is BelongsToClient
|
||||||
|
? state.clientState
|
||||||
|
.map[(entity as BelongsToClient)?.clientId]
|
||||||
|
: null),
|
||||||
isSaving: false,
|
isSaving: false,
|
||||||
entity: entity,
|
entity: entity,
|
||||||
onSelected: (context, action) =>
|
onSelected: (context, action) =>
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
||||||
return Icons.stop;
|
return Icons.stop;
|
||||||
case EntityAction.settings:
|
case EntityAction.settings:
|
||||||
return Icons.settings;
|
return Icons.settings;
|
||||||
|
case EntityAction.refund:
|
||||||
|
return Icons.remove_circle_outline;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue