Implemented settings, new scan, enhanced UI/UX
This commit is contained in:
@ -1,27 +1,52 @@
|
||||
import 'package:hl_lieferservice/model/delivery.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'delivery_update.g.dart';
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class DeliveryOptionUpdateDTO {
|
||||
DeliveryOptionUpdateDTO({
|
||||
required this.numerical,
|
||||
required this.value,
|
||||
required this.key,
|
||||
});
|
||||
|
||||
bool numerical;
|
||||
String value;
|
||||
String key;
|
||||
|
||||
factory DeliveryOptionUpdateDTO.fromJson(Map<String, dynamic> json) =>
|
||||
_$DeliveryOptionUpdateDTOFromJson(json);
|
||||
|
||||
Map<dynamic, dynamic> toJson() => _$DeliveryOptionUpdateDTOToJson(this);
|
||||
|
||||
factory DeliveryOptionUpdateDTO.fromEntity(DeliveryOption option) {
|
||||
return DeliveryOptionUpdateDTO(
|
||||
numerical: option.numerical,
|
||||
value: option.value,
|
||||
key: option.key,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class DeliveryUpdateDTO {
|
||||
DeliveryUpdateDTO({
|
||||
required this.deliveryId,
|
||||
this.note,
|
||||
this.finishedDate,
|
||||
this.discount,
|
||||
this.selectedPaymentMethodId,
|
||||
this.options,
|
||||
this.state,
|
||||
this.carId,
|
||||
});
|
||||
|
||||
String deliveryId;
|
||||
String? note;
|
||||
String? finishedDate;
|
||||
String? state;
|
||||
int? carId;
|
||||
String? carId;
|
||||
String? selectedPaymentMethodId;
|
||||
double? discount;
|
||||
List<DeliveryOptionUpdateDTO>? options;
|
||||
|
||||
factory DeliveryUpdateDTO.fromJson(Map<String, dynamic> json) =>
|
||||
_$DeliveryUpdateDTOFromJson(json);
|
||||
@ -47,7 +72,10 @@ class DeliveryUpdateDTO {
|
||||
return DeliveryUpdateDTO(
|
||||
deliveryId: delivery.id,
|
||||
state: state,
|
||||
carId: delivery.carId,
|
||||
carId: delivery.carId?.toString() ,
|
||||
selectedPaymentMethodId: delivery.payment.id,
|
||||
options: delivery.options.map(DeliveryOptionUpdateDTO.fromEntity).toList(),
|
||||
finishedDate: DateTime.now().millisecondsSinceEpoch.toString()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user