Schedules
This commit is contained in:
parent
5073214ef4
commit
d7af7bd0bc
|
|
@ -23,6 +23,7 @@ class ClientPicker extends StatelessWidget {
|
||||||
this.onAddPressed,
|
this.onAddPressed,
|
||||||
this.autofocus,
|
this.autofocus,
|
||||||
this.excludeIds = const [],
|
this.excludeIds = const [],
|
||||||
|
this.isRequired = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
final String clientId;
|
final String clientId;
|
||||||
|
|
@ -31,6 +32,7 @@ class ClientPicker extends StatelessWidget {
|
||||||
final Function(Completer<SelectableEntity> completer) onAddPressed;
|
final Function(Completer<SelectableEntity> completer) onAddPressed;
|
||||||
final bool autofocus;
|
final bool autofocus;
|
||||||
final List<String> excludeIds;
|
final List<String> excludeIds;
|
||||||
|
final bool isRequired;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -46,7 +48,7 @@ class ClientPicker extends StatelessWidget {
|
||||||
entityList: memoizedDropdownClientList(clientState.map, clientState.list,
|
entityList: memoizedDropdownClientList(clientState.map, clientState.list,
|
||||||
state.userState.map, state.staticState),
|
state.userState.map, state.staticState),
|
||||||
entityMap: clientState.map,
|
entityMap: clientState.map,
|
||||||
validator: (String val) => val.trim().isEmpty
|
validator: (String val) => isRequired && val.trim().isEmpty
|
||||||
? AppLocalization.of(context).pleaseSelectAClient
|
? AppLocalization.of(context).pleaseSelectAClient
|
||||||
: null,
|
: null,
|
||||||
onSelected: onSelected,
|
onSelected: onSelected,
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,15 @@ import 'package:invoiceninja_flutter/data/models/dashboard_model.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/app_dropdown_button.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/bool_dropdown_button.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/forms/client_picker.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/date_picker.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/schedule/edit/schedule_edit_vm.dart';
|
import 'package:invoiceninja_flutter/ui/schedule/edit/schedule_edit_vm.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/completers.dart';
|
import 'package:invoiceninja_flutter/utils/completers.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart';
|
import 'package:invoiceninja_flutter/ui/app/scrollable_listview.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||||
|
|
||||||
class ScheduleEdit extends StatefulWidget {
|
class ScheduleEdit extends StatefulWidget {
|
||||||
const ScheduleEdit({
|
const ScheduleEdit({
|
||||||
|
|
@ -36,14 +39,12 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
_controllers = [
|
_controllers = [
|
||||||
// STARTER: array - do not remove comment
|
|
||||||
_nameController,
|
_nameController,
|
||||||
];
|
];
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
_controllers.forEach((controller) => controller.removeListener(_onChanged));
|
||||||
|
|
||||||
final schedule = widget.viewModel.schedule;
|
final schedule = widget.viewModel.schedule;
|
||||||
// STARTER: read value - do not remove comment
|
|
||||||
_nameController.text = schedule.name;
|
_nameController.text = schedule.name;
|
||||||
|
|
||||||
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
_controllers.forEach((controller) => controller.addListener(_onChanged));
|
||||||
|
|
@ -75,6 +76,7 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final viewModel = widget.viewModel;
|
final viewModel = widget.viewModel;
|
||||||
|
final state = viewModel.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
final schedule = viewModel.schedule;
|
final schedule = viewModel.schedule;
|
||||||
final parameters = schedule.parameters;
|
final parameters = schedule.parameters;
|
||||||
|
|
@ -137,6 +139,7 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormCard(
|
FormCard(
|
||||||
|
isLast: true,
|
||||||
children: [
|
children: [
|
||||||
DatePicker(
|
DatePicker(
|
||||||
labelText: localization.nextSendDate,
|
labelText: localization.nextSendDate,
|
||||||
|
|
@ -185,6 +188,35 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
BoolDropdownButton(
|
||||||
|
label: localization.showAgingTable,
|
||||||
|
value: parameters.showAgingTable,
|
||||||
|
onChanged: (value) {
|
||||||
|
viewModel.onChanged(schedule.rebuild(
|
||||||
|
(b) => b..parameters.showAgingTable = value));
|
||||||
|
}),
|
||||||
|
BoolDropdownButton(
|
||||||
|
label: localization.showPaymentsTable,
|
||||||
|
value: parameters.showPaymentsTable,
|
||||||
|
onChanged: (value) {
|
||||||
|
viewModel.onChanged(schedule.rebuild(
|
||||||
|
(b) => b..parameters.showPaymentsTable = value));
|
||||||
|
}),
|
||||||
|
SizedBox(height: 20),
|
||||||
|
ClientPicker(
|
||||||
|
isRequired: false,
|
||||||
|
clientId: null,
|
||||||
|
clientState: state.clientState,
|
||||||
|
onSelected: (value) {
|
||||||
|
viewModel.onChanged(schedule.rebuild(
|
||||||
|
(b) => b..parameters.clients.add(value.id)));
|
||||||
|
print('## SELECTED: $value');
|
||||||
|
}),
|
||||||
|
for (var clientId in parameters.clients)
|
||||||
|
ListTile(
|
||||||
|
title: Text(clientId),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'en': {
|
||||||
// STARTER: lang key - do not remove comment
|
// STARTER: lang key - do not remove comment
|
||||||
|
'show_aging_table': 'Show Aging Table',
|
||||||
|
'show_payments_table': 'Show Payments Table',
|
||||||
'email_statement': 'Email Statement',
|
'email_statement': 'Email Statement',
|
||||||
'once': 'Once',
|
'once': 'Once',
|
||||||
'schedule': 'Schedule',
|
'schedule': 'Schedule',
|
||||||
|
|
@ -94514,6 +94516,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['email_statement'] ??
|
_localizedValues[localeCode]['email_statement'] ??
|
||||||
_localizedValues['en']['email_statement'];
|
_localizedValues['en']['email_statement'];
|
||||||
|
|
||||||
|
String get showAgingTable =>
|
||||||
|
_localizedValues[localeCode]['show_aging_table'] ??
|
||||||
|
_localizedValues['en']['show_aging_table'];
|
||||||
|
|
||||||
|
String get showPaymentsTable =>
|
||||||
|
_localizedValues[localeCode]['show_payments_table'] ??
|
||||||
|
_localizedValues['en']['show_payments_table'];
|
||||||
|
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue