Schedule reports
This commit is contained in:
parent
96b41d217c
commit
c11754b099
|
|
@ -3,6 +3,7 @@ import 'package:built_collection/built_collection.dart';
|
|||
import 'package:built_value/serializer.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/dashboard_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/import_model.dart';
|
||||
import 'package:invoiceninja_flutter/main_app.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
|
|
@ -84,8 +85,8 @@ abstract class ScheduleEntity extends Object
|
|||
|
||||
static const TEMPLATES = [
|
||||
TEMPLATE_EMAIL_STATEMENT,
|
||||
TEMPLATE_EMAIL_RECORD,
|
||||
TEMPLATE_EMAIL_REPORT,
|
||||
TEMPLATE_EMAIL_RECORD,
|
||||
];
|
||||
|
||||
@override
|
||||
|
|
@ -218,6 +219,9 @@ abstract class ScheduleParameters
|
|||
? EntityType.invoice.toString()
|
||||
: null,
|
||||
entityId: action == ScheduleEntity.TEMPLATE_EMAIL_RECORD ? '' : null,
|
||||
reportName: action == ScheduleEntity.TEMPLATE_EMAIL_REPORT
|
||||
? ExportType.invoices.name
|
||||
: null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -252,6 +256,9 @@ abstract class ScheduleParameters
|
|||
@BuiltValueField(wireName: 'entity_id')
|
||||
String? get entityId;
|
||||
|
||||
@BuiltValueField(wireName: 'report_name')
|
||||
String? get reportName;
|
||||
|
||||
static Serializer<ScheduleParameters> get serializer =>
|
||||
_$scheduleParametersSerializer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,6 +337,13 @@ class _$ScheduleParametersSerializer
|
|||
..add(serializers.serialize(value,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
value = object.reportName;
|
||||
if (value != null) {
|
||||
result
|
||||
..add('report_name')
|
||||
..add(serializers.serialize(value,
|
||||
specifiedType: const FullType(String)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -390,6 +397,10 @@ class _$ScheduleParametersSerializer
|
|||
result.entityId = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String?;
|
||||
break;
|
||||
case 'report_name':
|
||||
result.reportName = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -904,6 +915,8 @@ class _$ScheduleParameters extends ScheduleParameters {
|
|||
final String? entityType;
|
||||
@override
|
||||
final String? entityId;
|
||||
@override
|
||||
final String? reportName;
|
||||
|
||||
factory _$ScheduleParameters(
|
||||
[void Function(ScheduleParametersBuilder)? updates]) =>
|
||||
|
|
@ -918,7 +931,8 @@ class _$ScheduleParameters extends ScheduleParameters {
|
|||
this.status,
|
||||
this.clients,
|
||||
this.entityType,
|
||||
this.entityId})
|
||||
this.entityId,
|
||||
this.reportName})
|
||||
: super._();
|
||||
|
||||
@override
|
||||
|
|
@ -942,7 +956,8 @@ class _$ScheduleParameters extends ScheduleParameters {
|
|||
status == other.status &&
|
||||
clients == other.clients &&
|
||||
entityType == other.entityType &&
|
||||
entityId == other.entityId;
|
||||
entityId == other.entityId &&
|
||||
reportName == other.reportName;
|
||||
}
|
||||
|
||||
int? __hashCode;
|
||||
|
|
@ -959,6 +974,7 @@ class _$ScheduleParameters extends ScheduleParameters {
|
|||
_$hash = $jc(_$hash, clients.hashCode);
|
||||
_$hash = $jc(_$hash, entityType.hashCode);
|
||||
_$hash = $jc(_$hash, entityId.hashCode);
|
||||
_$hash = $jc(_$hash, reportName.hashCode);
|
||||
_$hash = $jf(_$hash);
|
||||
return __hashCode ??= _$hash;
|
||||
}
|
||||
|
|
@ -974,7 +990,8 @@ class _$ScheduleParameters extends ScheduleParameters {
|
|||
..add('status', status)
|
||||
..add('clients', clients)
|
||||
..add('entityType', entityType)
|
||||
..add('entityId', entityId))
|
||||
..add('entityId', entityId)
|
||||
..add('reportName', reportName))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1024,6 +1041,10 @@ class ScheduleParametersBuilder
|
|||
String? get entityId => _$this._entityId;
|
||||
set entityId(String? entityId) => _$this._entityId = entityId;
|
||||
|
||||
String? _reportName;
|
||||
String? get reportName => _$this._reportName;
|
||||
set reportName(String? reportName) => _$this._reportName = reportName;
|
||||
|
||||
ScheduleParametersBuilder();
|
||||
|
||||
ScheduleParametersBuilder get _$this {
|
||||
|
|
@ -1038,6 +1059,7 @@ class ScheduleParametersBuilder
|
|||
_clients = $v.clients?.toBuilder();
|
||||
_entityType = $v.entityType;
|
||||
_entityId = $v.entityId;
|
||||
_reportName = $v.reportName;
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
|
|
@ -1070,7 +1092,8 @@ class ScheduleParametersBuilder
|
|||
status: status,
|
||||
clients: _clients?.build(),
|
||||
entityType: entityType,
|
||||
entityId: entityId);
|
||||
entityId: entityId,
|
||||
reportName: reportName);
|
||||
} catch (_) {
|
||||
late String _$failedField;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/dashboard_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/import_model.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
import 'package:invoiceninja_flutter/redux/credit/credit_selectors.dart';
|
||||
import 'package:invoiceninja_flutter/redux/invoice/invoice_selectors.dart';
|
||||
|
|
@ -232,7 +233,26 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
|||
),
|
||||
if (schedule.template ==
|
||||
ScheduleEntity.TEMPLATE_EMAIL_REPORT) ...[
|
||||
//
|
||||
FormCard(
|
||||
isLast: true,
|
||||
children: [
|
||||
AppDropdownButton<String>(
|
||||
value: schedule.parameters.reportName,
|
||||
labelText: localization.report,
|
||||
onChanged: (dynamic value) {
|
||||
setState(() {
|
||||
viewModel.onChanged(schedule.rebuild(
|
||||
(b) => b..parameters.reportName = value));
|
||||
});
|
||||
},
|
||||
items: ExportType.values
|
||||
.map((importType) => DropdownMenuItem<String>(
|
||||
value: importType.name,
|
||||
child:
|
||||
Text(localization.lookup('$importType'))))
|
||||
.toList()),
|
||||
],
|
||||
),
|
||||
] else if (schedule.template ==
|
||||
ScheduleEntity.TEMPLATE_EMAIL_STATEMENT) ...[
|
||||
FormCard(children: [
|
||||
|
|
@ -342,6 +362,7 @@ class _ScheduleEditState extends State<ScheduleEdit> {
|
|||
] else if (schedule.template ==
|
||||
ScheduleEntity.TEMPLATE_EMAIL_RECORD) ...[
|
||||
FormCard(
|
||||
isLast: true,
|
||||
children: [
|
||||
AppDropdownButton<String>(
|
||||
labelText: localization.type,
|
||||
|
|
|
|||
Loading…
Reference in New Issue