Tweaking cusomter list
This commit is contained in:
@@ -17,13 +17,13 @@ import marketing.heyday.hartmann.fotodocumentation.core.model.Picture;
|
||||
*/
|
||||
|
||||
@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) {
|
||||
if (customer == null) {
|
||||
return 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ class CustomerListDto {
|
||||
final int id;
|
||||
final String name;
|
||||
final String customerNumber;
|
||||
final String? zip;
|
||||
final String? city;
|
||||
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
|
||||
factory CustomerListDto.fromJson(Map<String, dynamic> json) {
|
||||
@@ -15,6 +17,8 @@ class CustomerListDto {
|
||||
id: json['id'] as int,
|
||||
name: json['name'] as String,
|
||||
customerNumber: json['customerNumber'] as String,
|
||||
zip: json['zip'] as String?,
|
||||
city: json['city'] as String?,
|
||||
lastUpdateDate: DateTimeUtils.toDateTime(json['lastUpdateDate']),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"errorWidget": "Fehler: {name}",
|
||||
"@errorWidget": {
|
||||
"description": "Error widget text",
|
||||
@@ -80,7 +79,7 @@
|
||||
"@customerListHeaderName": {
|
||||
"description": "Customer list table header for name"
|
||||
},
|
||||
"customerListHeaderLastDate": "Datum Bilder",
|
||||
"customerListHeaderLastDate": "Datum",
|
||||
"@customerListHeaderLastDate": {
|
||||
"description": "Customer list table header for last date"
|
||||
},
|
||||
|
||||
@@ -199,7 +199,7 @@ abstract class AppLocalizations {
|
||||
/// Customer list table header for last date
|
||||
///
|
||||
/// In de, this message translates to:
|
||||
/// **'Datum Bilder'**
|
||||
/// **'Datum'**
|
||||
String get customerListHeaderLastDate;
|
||||
|
||||
/// Customer list table header for ladt date
|
||||
|
||||
@@ -65,7 +65,7 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||
String get customerListHeaderName => 'Apothekenname';
|
||||
|
||||
@override
|
||||
String get customerListHeaderLastDate => 'Datum Bilder';
|
||||
String get customerListHeaderLastDate => 'Datum';
|
||||
|
||||
@override
|
||||
String get customerListHeaderLastDateSuffix => ' (zuletzt aktualisiert)';
|
||||
|
||||
@@ -138,12 +138,6 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
|
||||
color: _generalStyle.secondaryWidgetBackgroundColor,
|
||||
);
|
||||
|
||||
final headerStyleSuffix = TextStyle(
|
||||
fontFamily: _generalStyle.fontFamily,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 20,
|
||||
color: _generalStyle.secondaryWidgetBackgroundColor,
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Row(
|
||||
@@ -164,18 +158,32 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
|
||||
style: headerStyle,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
"PLZ/Ort",
|
||||
style: headerStyle,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
"Ort",
|
||||
style: headerStyle,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: Wrap(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8.0),
|
||||
child: Icon(Icons.calendar_month, color: _generalStyle.secondaryWidgetBackgroundColor),
|
||||
),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.customerListHeaderLastDate,
|
||||
style: headerStyle,
|
||||
),
|
||||
Text(
|
||||
AppLocalizations.of(context)!.customerListHeaderLastDateSuffix,
|
||||
style: headerStyleSuffix,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -211,6 +219,14 @@ class _CustomerListWidgetState extends State<CustomerListWidget> {
|
||||
flex: 3,
|
||||
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(
|
||||
flex: 2,
|
||||
child: Text(dateStr, style: dataStyle),
|
||||
|
||||
Reference in New Issue
Block a user