Client/product documents

This commit is contained in:
Hillel Coren 2020-08-06 17:46:05 +03:00
parent e8d0ffbbb4
commit af726ea3f7
4 changed files with 49 additions and 6 deletions

View File

@ -275,8 +275,8 @@ abstract class BaseEntity implements SelectableEntity {
ReportStringValue getReportString({String value}) => ReportStringValue getReportString({String value}) =>
ReportStringValue(entityId: id, entityType: entityType, value: value); ReportStringValue(entityId: id, entityType: entityType, value: value);
ReportEntityTypeValue getReportEntityType() => ReportEntityTypeValue getReportEntityType() => ReportEntityTypeValue(
ReportEntityTypeValue(entityId: id, entityType: entityType, value: entityType); entityId: id, entityType: entityType, value: entityType);
ReportBoolValue getReportBool({bool value}) => ReportBoolValue getReportBool({bool value}) =>
ReportBoolValue(entityId: id, entityType: entityType, value: value); ReportBoolValue(entityId: id, entityType: entityType, value: value);
@ -298,6 +298,16 @@ abstract class BaseEntity implements SelectableEntity {
currencyId: currencyId, currencyId: currencyId,
formatNumberType: formatNumberType); formatNumberType: formatNumberType);
ReportIntValue getReportInt(
{int value,
String currencyId,
FormatNumberType formatNumberType}) =>
ReportIntValue(
entityId: id,
entityType: entityType,
value: value,
);
List<EntityAction> getActions( List<EntityAction> getActions(
{UserCompanyEntity userCompany, {UserCompanyEntity userCompany,
ClientEntity client, ClientEntity client,

View File

@ -13,6 +13,9 @@ import 'package:memoize/memoize.dart';
enum DocumentReportFields { enum DocumentReportFields {
name, name,
size,
width,
height,
file_type, file_type,
record_type, record_type,
record_name, record_name,
@ -117,6 +120,15 @@ ReportResult documentReport(
case DocumentReportFields.updated_at: case DocumentReportFields.updated_at:
value = convertTimestampToDateString(document.updatedAt); value = convertTimestampToDateString(document.updatedAt);
break; break;
case DocumentReportFields.size:
value = document.size;
break;
case DocumentReportFields.width:
value = document.width;
break;
case DocumentReportFields.height:
value = document.height;
break;
} }
if (!ReportResult.matchField( if (!ReportResult.matchField(
@ -131,7 +143,9 @@ ReportResult documentReport(
if (value.runtimeType == bool) { if (value.runtimeType == bool) {
row.add(entity.getReportBool(value: value)); row.add(entity.getReportBool(value: value));
} else if (value.runtimeType == double || value.runtimeType == int) { } else if (value.runtimeType == int) {
row.add(entity.getReportInt(value: value));
} else if (value.runtimeType == double) {
row.add(entity.getReportNumber(value: value)); row.add(entity.getReportNumber(value: value));
} else if (value.runtimeType == EntityType) { } else if (value.runtimeType == EntityType) {
row.add(entity.getReportEntityType()); row.add(entity.getReportEntityType());

View File

@ -1320,6 +1320,25 @@ class ReportAgeValue extends ReportElement {
} }
} }
class ReportIntValue extends ReportElement {
ReportIntValue({
dynamic value,
EntityType entityType,
String entityId,
}) : super(value: value, entityType: entityType, entityId: entityId);
@override
Widget renderWidget(BuildContext context, String column) {
return Text(renderText(context, column));
}
@override
String renderText(BuildContext context, String column) {
return formatNumber((value as int).toDouble(), context,
formatNumberType: FormatNumberType.int);
}
}
class ReportNumberValue extends ReportElement { class ReportNumberValue extends ReportElement {
ReportNumberValue({ ReportNumberValue({
dynamic value, dynamic value,

View File

@ -66,10 +66,10 @@ bool isValidDate(String input) {
} }
void printWrapped(String text) { void printWrapped(String text) {
print(text); //print(text);
//final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk final pattern = RegExp('.{1,800}'); // 800 is the size of each chunk
//pattern.allMatches(text).forEach((match) => print(match.group(0))); pattern.allMatches(text).forEach((match) => print(match.group(0)));
} }
bool matchesStrings({ bool matchesStrings({