CSV export
This commit is contained in:
parent
22f8856732
commit
21755fa14c
|
|
@ -170,3 +170,28 @@ class ImportType extends EnumClass {
|
||||||
|
|
||||||
static ImportType valueOf(String name) => _$typeValueOf(name);
|
static ImportType valueOf(String name) => _$typeValueOf(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ExportType extends EnumClass {
|
||||||
|
const ExportType._(String name) : super(name);
|
||||||
|
|
||||||
|
static Serializer<ExportType> get serializer => _$exportTypeSerializer;
|
||||||
|
|
||||||
|
static const ExportType clients = _$clients;
|
||||||
|
static const ExportType contacts = _$contacts;
|
||||||
|
static const ExportType credits = _$credits;
|
||||||
|
static const ExportType documents = _$documents;
|
||||||
|
static const ExportType expenses = _$expenses;
|
||||||
|
static const ExportType invoices = _$invoices;
|
||||||
|
static const ExportType invoice_items = _$invoice_items;
|
||||||
|
static const ExportType quotes = _$quotes;
|
||||||
|
static const ExportType quote_items = _$quote_items;
|
||||||
|
static const ExportType recurring_invoices = _$recurring_invoices;
|
||||||
|
static const ExportType payments = _$payments;
|
||||||
|
static const ExportType products = _$products;
|
||||||
|
static const ExportType tasks = _$tasks;
|
||||||
|
static const ExportType profitloss = _$profitloss;
|
||||||
|
|
||||||
|
static BuiltSet<ExportType> get values => _$exportValues;
|
||||||
|
|
||||||
|
static ExportType valueOf(String name) => _$exportValueOf(name);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,75 @@ final BuiltSet<ImportType> _$typeValues =
|
||||||
_$zoho,
|
_$zoho,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const ExportType _$clients = const ExportType._('clients');
|
||||||
|
const ExportType _$contacts = const ExportType._('contacts');
|
||||||
|
const ExportType _$credits = const ExportType._('credits');
|
||||||
|
const ExportType _$documents = const ExportType._('documents');
|
||||||
|
const ExportType _$expenses = const ExportType._('expenses');
|
||||||
|
const ExportType _$invoices = const ExportType._('invoices');
|
||||||
|
const ExportType _$invoice_items = const ExportType._('invoice_items');
|
||||||
|
const ExportType _$quotes = const ExportType._('quotes');
|
||||||
|
const ExportType _$quote_items = const ExportType._('quote_items');
|
||||||
|
const ExportType _$recurring_invoices =
|
||||||
|
const ExportType._('recurring_invoices');
|
||||||
|
const ExportType _$payments = const ExportType._('payments');
|
||||||
|
const ExportType _$products = const ExportType._('products');
|
||||||
|
const ExportType _$tasks = const ExportType._('tasks');
|
||||||
|
const ExportType _$profitloss = const ExportType._('profitloss');
|
||||||
|
|
||||||
|
ExportType _$exportValueOf(String name) {
|
||||||
|
switch (name) {
|
||||||
|
case 'clients':
|
||||||
|
return _$clients;
|
||||||
|
case 'contacts':
|
||||||
|
return _$contacts;
|
||||||
|
case 'credits':
|
||||||
|
return _$credits;
|
||||||
|
case 'documents':
|
||||||
|
return _$documents;
|
||||||
|
case 'expenses':
|
||||||
|
return _$expenses;
|
||||||
|
case 'invoices':
|
||||||
|
return _$invoices;
|
||||||
|
case 'invoice_items':
|
||||||
|
return _$invoice_items;
|
||||||
|
case 'quotes':
|
||||||
|
return _$quotes;
|
||||||
|
case 'quote_items':
|
||||||
|
return _$quote_items;
|
||||||
|
case 'recurring_invoices':
|
||||||
|
return _$recurring_invoices;
|
||||||
|
case 'payments':
|
||||||
|
return _$payments;
|
||||||
|
case 'products':
|
||||||
|
return _$products;
|
||||||
|
case 'tasks':
|
||||||
|
return _$tasks;
|
||||||
|
case 'profitloss':
|
||||||
|
return _$profitloss;
|
||||||
|
default:
|
||||||
|
throw new ArgumentError(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final BuiltSet<ExportType> _$exportValues =
|
||||||
|
new BuiltSet<ExportType>(const <ExportType>[
|
||||||
|
_$clients,
|
||||||
|
_$contacts,
|
||||||
|
_$credits,
|
||||||
|
_$documents,
|
||||||
|
_$expenses,
|
||||||
|
_$invoices,
|
||||||
|
_$invoice_items,
|
||||||
|
_$quotes,
|
||||||
|
_$quote_items,
|
||||||
|
_$recurring_invoices,
|
||||||
|
_$payments,
|
||||||
|
_$products,
|
||||||
|
_$tasks,
|
||||||
|
_$profitloss,
|
||||||
|
]);
|
||||||
|
|
||||||
Serializer<PreImportResponse> _$preImportResponseSerializer =
|
Serializer<PreImportResponse> _$preImportResponseSerializer =
|
||||||
new _$PreImportResponseSerializer();
|
new _$PreImportResponseSerializer();
|
||||||
Serializer<PreImportResponseEntityDetails>
|
Serializer<PreImportResponseEntityDetails>
|
||||||
|
|
@ -56,6 +125,7 @@ Serializer<ImportRequest> _$importRequestSerializer =
|
||||||
Serializer<ImportRequestMapping> _$importRequestMappingSerializer =
|
Serializer<ImportRequestMapping> _$importRequestMappingSerializer =
|
||||||
new _$ImportRequestMappingSerializer();
|
new _$ImportRequestMappingSerializer();
|
||||||
Serializer<ImportType> _$importTypeSerializer = new _$ImportTypeSerializer();
|
Serializer<ImportType> _$importTypeSerializer = new _$ImportTypeSerializer();
|
||||||
|
Serializer<ExportType> _$exportTypeSerializer = new _$ExportTypeSerializer();
|
||||||
|
|
||||||
class _$PreImportResponseSerializer
|
class _$PreImportResponseSerializer
|
||||||
implements StructuredSerializer<PreImportResponse> {
|
implements StructuredSerializer<PreImportResponse> {
|
||||||
|
|
@ -303,6 +373,23 @@ class _$ImportTypeSerializer implements PrimitiveSerializer<ImportType> {
|
||||||
ImportType.valueOf(serialized as String);
|
ImportType.valueOf(serialized as String);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _$ExportTypeSerializer implements PrimitiveSerializer<ExportType> {
|
||||||
|
@override
|
||||||
|
final Iterable<Type> types = const <Type>[ExportType];
|
||||||
|
@override
|
||||||
|
final String wireName = 'ExportType';
|
||||||
|
|
||||||
|
@override
|
||||||
|
Object serialize(Serializers serializers, ExportType object,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) =>
|
||||||
|
object.name;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ExportType deserialize(Serializers serializers, Object serialized,
|
||||||
|
{FullType specifiedType = FullType.unspecified}) =>
|
||||||
|
ExportType.valueOf(serialized as String);
|
||||||
|
}
|
||||||
|
|
||||||
class _$PreImportResponse extends PreImportResponse {
|
class _$PreImportResponse extends PreImportResponse {
|
||||||
@override
|
@override
|
||||||
final String hash;
|
final String hash;
|
||||||
|
|
|
||||||
|
|
@ -48,8 +48,9 @@ class _ImportExportState extends State<ImportExport> {
|
||||||
FocusScopeNode _focusNode;
|
FocusScopeNode _focusNode;
|
||||||
bool autoValidate = false;
|
bool autoValidate = false;
|
||||||
PreImportResponse _response;
|
PreImportResponse _response;
|
||||||
var _importType = ImportType.csv;
|
var _importFormat = ImportType.csv;
|
||||||
var _exportType = ImportType.csv;
|
var _exportFormat = ImportType.csv;
|
||||||
|
var _exportType = ExportType.clients;
|
||||||
bool _isExporting = false;
|
bool _isExporting = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -82,9 +83,9 @@ class _ImportExportState extends State<ImportExport> {
|
||||||
children: [
|
children: [
|
||||||
if (_response == null)
|
if (_response == null)
|
||||||
_FileImport(
|
_FileImport(
|
||||||
importType: _importType,
|
importType: _importFormat,
|
||||||
onUploaded: (response) => {
|
onUploaded: (response) => {
|
||||||
if (_importType == ImportType.csv)
|
if (_importFormat == ImportType.csv)
|
||||||
{
|
{
|
||||||
setState(() => _response = response),
|
setState(() => _response = response),
|
||||||
}
|
}
|
||||||
|
|
@ -94,12 +95,12 @@ class _ImportExportState extends State<ImportExport> {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onImportTypeChanged: (importType) =>
|
onImportTypeChanged: (importType) =>
|
||||||
setState(() => _importType = importType),
|
setState(() => _importFormat = importType),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
_FileMapper(
|
_FileMapper(
|
||||||
key: ValueKey(_response.hash),
|
key: ValueKey(_response.hash),
|
||||||
importType: _importType,
|
importType: _importFormat,
|
||||||
formKey: _formKey,
|
formKey: _formKey,
|
||||||
response: _response,
|
response: _response,
|
||||||
onCancelPressed: () => setState(() => _response = null),
|
onCancelPressed: () => setState(() => _response = null),
|
||||||
|
|
@ -117,10 +118,10 @@ class _ImportExportState extends State<ImportExport> {
|
||||||
child: DropdownButtonHideUnderline(
|
child: DropdownButtonHideUnderline(
|
||||||
child: DropdownButton<ImportType>(
|
child: DropdownButton<ImportType>(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
value: _exportType,
|
value: _exportFormat,
|
||||||
onChanged: (dynamic value) {
|
onChanged: (dynamic value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_exportType = value;
|
_exportFormat = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
items: [
|
items: [
|
||||||
|
|
@ -134,6 +135,26 @@ class _ImportExportState extends State<ImportExport> {
|
||||||
.toList()),
|
.toList()),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
InputDecorator(
|
||||||
|
decoration:
|
||||||
|
InputDecoration(labelText: localization.exportType),
|
||||||
|
child: DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton<ExportType>(
|
||||||
|
isDense: true,
|
||||||
|
value: _exportType,
|
||||||
|
onChanged: (dynamic value) {
|
||||||
|
setState(() {
|
||||||
|
_exportType = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
items: ExportType.values
|
||||||
|
.map((importType) => DropdownMenuItem<ExportType>(
|
||||||
|
value: importType,
|
||||||
|
child:
|
||||||
|
Text(localization.lookup('$importType'))))
|
||||||
|
.toList()),
|
||||||
|
),
|
||||||
|
),
|
||||||
AppButton(
|
AppButton(
|
||||||
iconData: MdiIcons.export,
|
iconData: MdiIcons.export,
|
||||||
label: localization.export.toUpperCase(),
|
label: localization.export.toUpperCase(),
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ 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
|
||||||
|
'invoice_items': 'Invoice Items',
|
||||||
|
'quote_items': 'Quote Items',
|
||||||
|
'profitloss': 'Profit and Loss',
|
||||||
'import_format': 'Import Format',
|
'import_format': 'Import Format',
|
||||||
'export_format': 'Export Format',
|
'export_format': 'Export Format',
|
||||||
'export_type': 'Export Type',
|
'export_type': 'Export Type',
|
||||||
|
|
@ -69693,6 +69696,18 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
_localizedValues[localeCode]['export_format'] ??
|
_localizedValues[localeCode]['export_format'] ??
|
||||||
_localizedValues[localeCode]['export_format'];
|
_localizedValues[localeCode]['export_format'];
|
||||||
|
|
||||||
|
String get invoiceItems =>
|
||||||
|
_localizedValues[localeCode]['invoice_items'] ??
|
||||||
|
_localizedValues[localeCode]['invoice_items'];
|
||||||
|
|
||||||
|
String get quoteItems =>
|
||||||
|
_localizedValues[localeCode]['quote_items'] ??
|
||||||
|
_localizedValues[localeCode]['quote_items'];
|
||||||
|
|
||||||
|
String get profitloss =>
|
||||||
|
_localizedValues[localeCode]['profitloss'] ??
|
||||||
|
_localizedValues[localeCode]['profitloss'];
|
||||||
|
|
||||||
// STARTER: lang field - do not remove comment
|
// STARTER: lang field - do not remove comment
|
||||||
|
|
||||||
String lookup(String key) {
|
String lookup(String key) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue