Add run_template action
This commit is contained in:
parent
0269667785
commit
81d3fed9b8
|
|
@ -540,6 +540,15 @@ void handleClientAction(BuildContext? context, List<BaseEntity> clients,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case EntityAction.runTemplate:
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => RunTemplateDialog(
|
||||||
|
entityType: EntityType.client,
|
||||||
|
entities: clients,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('## Error: action $action not handled in client_actions');
|
print('## Error: action $action not handled in client_actions');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import 'package:flutter_redux/flutter_redux.dart';
|
||||||
import 'package:invoiceninja_flutter/main_app.dart';
|
import 'package:invoiceninja_flutter/main_app.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
import 'package:invoiceninja_flutter/redux/task/task_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/task_status/task_status_selectors.dart';
|
import 'package:invoiceninja_flutter/redux/task_status/task_status_selectors.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/design_picker.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
import 'package:invoiceninja_flutter/utils/formatting.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||||
|
|
@ -606,3 +607,69 @@ void addToInvoiceDialog({
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RunTemplateDialog extends StatefulWidget {
|
||||||
|
const RunTemplateDialog({
|
||||||
|
super.key,
|
||||||
|
required this.entityType,
|
||||||
|
required this.entities,
|
||||||
|
});
|
||||||
|
|
||||||
|
final EntityType entityType;
|
||||||
|
final List<BaseEntity> entities;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<RunTemplateDialog> createState() => _RunTemplateDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RunTemplateDialogState extends State<RunTemplateDialog> {
|
||||||
|
String _designId = '';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final localization = AppLocalization.of(context)!;
|
||||||
|
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(localization.runTemplate),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(localization.close.toUpperCase()),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
//
|
||||||
|
},
|
||||||
|
child: Text(localization.start.toUpperCase()),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: [
|
||||||
|
DesignPicker(
|
||||||
|
entityType: widget.entityType,
|
||||||
|
label: localization.template,
|
||||||
|
onSelected: (design) {
|
||||||
|
_designId = design?.id ?? '';
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
localization.lookup(widget.entities.length == 1
|
||||||
|
? widget.entityType.snakeCase
|
||||||
|
: widget.entityType.plural),
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
...widget.entities
|
||||||
|
.map((entity) => Text(entity.listDisplayName))
|
||||||
|
.toList(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ IconData? getEntityActionIcon(EntityAction? entityAction) {
|
||||||
case EntityAction.unlink:
|
case EntityAction.unlink:
|
||||||
return MdiIcons.pipeDisconnected;
|
return MdiIcons.pipeDisconnected;
|
||||||
case EntityAction.runTemplate:
|
case EntityAction.runTemplate:
|
||||||
return MdiIcons.arrowRightBoldCircleOutline;
|
return MdiIcons.arrowRightCircleOutline;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue