add option to add more than one service
parent
10b8cf95a2
commit
be9c9bceae
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import 'package:mc_common_app/models/services_models/item_model.dart';
|
||||||
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
||||||
|
|
||||||
|
class SelectedAppointmentServiceModel {
|
||||||
|
final DropValue category;
|
||||||
|
final DropValue service;
|
||||||
|
final List<ItemData> items;
|
||||||
|
|
||||||
|
SelectedAppointmentServiceModel({
|
||||||
|
required this.category,
|
||||||
|
required this.service,
|
||||||
|
required this.items,
|
||||||
|
});
|
||||||
|
|
||||||
|
double get totalPrice => items.fold<double>(
|
||||||
|
0,
|
||||||
|
(sum, item) => sum + (double.tryParse(item.price ?? '0') ?? 0),
|
||||||
|
);
|
||||||
|
|
||||||
|
List<int> get itemIds => items
|
||||||
|
.map((item) => item.id)
|
||||||
|
.whereType<int>()
|
||||||
|
.where((id) => id > 0)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue