Tweaking cusomter list

This commit is contained in:
verboomp
2026-02-10 11:13:16 +01:00
parent a6216f6e81
commit 168fc986f2
6 changed files with 37 additions and 18 deletions

View File

@@ -17,13 +17,13 @@ import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
*/ */
@Schema(name = "CustomerList") @Schema(name = "CustomerList")
public record CustomerListValue(Long id, String name, String customerNumber, Date lastUpdateDate) { public record CustomerListValue(Long id, String name, String customerNumber, String zip, String city, Date lastUpdateDate) {
public static CustomerListValue builder(Customer customer) { public static CustomerListValue builder(Customer customer) {
if (customer == null) { if (customer == null) {
return null; return null;
} }
Date date = customer.getPictures().stream().map(Picture::getPictureDate).sorted((p1, p2) -> p2.compareTo(p1)).findFirst().orElse(null); Date date = customer.getPictures().stream().map(Picture::getPictureDate).sorted((p1, p2) -> p2.compareTo(p1)).findFirst().orElse(null);
return new CustomerListValue(customer.getCustomerId(), customer.getName(), customer.getCustomerNumber(), date); return new CustomerListValue(customer.getCustomerId(), customer.getName(), customer.getCustomerNumber(), customer.getZip(), customer.getCity(), date);
} }
} }

View File

@@ -5,9 +5,11 @@ class CustomerListDto {
final int id; final int id;
final String name; final String name;
final String customerNumber; final String customerNumber;
final String? zip;
final String? city;
final DateTime? lastUpdateDate; final DateTime? lastUpdateDate;
CustomerListDto({required this.id, required this.name, required this.customerNumber, this.lastUpdateDate}); CustomerListDto({required this.id, required this.name, required this.customerNumber, this.zip, this.city, this.lastUpdateDate});
/// Create from JSON response /// Create from JSON response
factory CustomerListDto.fromJson(Map<String, dynamic> json) { factory CustomerListDto.fromJson(Map<String, dynamic> json) {
@@ -15,6 +17,8 @@ class CustomerListDto {
id: json['id'] as int, id: json['id'] as int,
name: json['name'] as String, name: json['name'] as String,
customerNumber: json['customerNumber'] as String, customerNumber: json['customerNumber'] as String,
zip: json['zip'] as String?,
city: json['city'] as String?,
lastUpdateDate: DateTimeUtils.toDateTime(json['lastUpdateDate']), lastUpdateDate: DateTimeUtils.toDateTime(json['lastUpdateDate']),
); );
} }

View File

@@ -33,7 +33,6 @@
} }
} }
}, },
"errorWidget": "Fehler: {name}", "errorWidget": "Fehler: {name}",
"@errorWidget": { "@errorWidget": {
"description": "Error widget text", "description": "Error widget text",
@@ -80,7 +79,7 @@
"@customerListHeaderName": { "@customerListHeaderName": {
"description": "Customer list table header for name" "description": "Customer list table header for name"
}, },
"customerListHeaderLastDate": "Datum Bilder", "customerListHeaderLastDate": "Datum",
"@customerListHeaderLastDate": { "@customerListHeaderLastDate": {
"description": "Customer list table header for last date" "description": "Customer list table header for last date"
}, },

View File

@@ -199,7 +199,7 @@ abstract class AppLocalizations {
/// Customer list table header for last date /// Customer list table header for last date
/// ///
/// In de, this message translates to: /// In de, this message translates to:
/// **'Datum Bilder'** /// **'Datum'**
String get customerListHeaderLastDate; String get customerListHeaderLastDate;
/// Customer list table header for ladt date /// Customer list table header for ladt date

View File

@@ -65,7 +65,7 @@ class AppLocalizationsDe extends AppLocalizations {
String get customerListHeaderName => 'Apothekenname'; String get customerListHeaderName => 'Apothekenname';
@override @override
String get customerListHeaderLastDate => 'Datum Bilder'; String get customerListHeaderLastDate => 'Datum';
@override @override
String get customerListHeaderLastDateSuffix => ' (zuletzt aktualisiert)'; String get customerListHeaderLastDateSuffix => ' (zuletzt aktualisiert)';

View File

@@ -138,12 +138,6 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
color: _generalStyle.secondaryWidgetBackgroundColor, color: _generalStyle.secondaryWidgetBackgroundColor,
); );
final headerStyleSuffix = TextStyle(
fontFamily: _generalStyle.fontFamily,
fontWeight: FontWeight.normal,
fontSize: 20,
color: _generalStyle.secondaryWidgetBackgroundColor,
);
return Padding( return Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Row( child: Row(
@@ -164,18 +158,32 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
style: headerStyle, style: headerStyle,
), ),
), ),
Expanded(
flex: 1,
child: Text(
"PLZ/Ort",
style: headerStyle,
),
),
Expanded(
flex: 2,
child: Text(
"Ort",
style: headerStyle,
),
),
Expanded( Expanded(
flex: 2, flex: 2,
child: Wrap( child: Wrap(
children: [ children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Icon(Icons.calendar_month, color: _generalStyle.secondaryWidgetBackgroundColor),
),
Text( Text(
AppLocalizations.of(context)!.customerListHeaderLastDate, AppLocalizations.of(context)!.customerListHeaderLastDate,
style: headerStyle, style: headerStyle,
), ),
Text(
AppLocalizations.of(context)!.customerListHeaderLastDateSuffix,
style: headerStyleSuffix,
),
], ],
), ),
), ),
@@ -211,6 +219,14 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
flex: 3, flex: 3,
child: Text(dto.name, style: dataStyle), child: Text(dto.name, style: dataStyle),
), ),
Expanded(
flex: 1,
child: Text(dto.zip ?? "", style: dataStyle),
),
Expanded(
flex: 2,
child: Text(dto.city ?? "", style: dataStyle),
),
Expanded( Expanded(
flex: 2, flex: 2,
child: Text(dateStr, style: dataStyle), child: Text(dateStr, style: dataStyle),