attendence records, extra hours , rewards and punishment funnctionality have been added
This commit is contained in:
49
lib/data/dto/extra_payment_dto.dart
Normal file
49
lib/data/dto/extra_payment_dto.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
class ExtraPaymentDto {
|
||||
final String id;
|
||||
final DateTime date;
|
||||
final double amount;
|
||||
final String? reason;
|
||||
final String? note;
|
||||
final String employeeId;
|
||||
final bool isDeleted;
|
||||
|
||||
ExtraPaymentDto({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.amount,
|
||||
this.reason,
|
||||
this.note,
|
||||
required this.employeeId,
|
||||
required this.isDeleted,
|
||||
});
|
||||
|
||||
factory ExtraPaymentDto.fromJson(Map<String, dynamic> json) {
|
||||
return ExtraPaymentDto(
|
||||
id: json['id']?.toString() ?? '',
|
||||
date:
|
||||
json['date'] != null ? DateTime.parse(json['date']) : DateTime.now(),
|
||||
amount: (json['amount'] as num?)?.toDouble() ?? 0.0,
|
||||
reason: json['reason'],
|
||||
note: json['note'],
|
||||
employeeId: json['employeeId']?.toString() ?? '',
|
||||
isDeleted: json['isDeleted'] ?? false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ExtraPaymentListResponseDto {
|
||||
final List<ExtraPaymentDto> items;
|
||||
|
||||
ExtraPaymentListResponseDto({required this.items});
|
||||
|
||||
factory ExtraPaymentListResponseDto.fromJson(Map<String, dynamic> json) {
|
||||
final data = json['data'];
|
||||
if (data == null || data is! Map<String, dynamic>) {
|
||||
return ExtraPaymentListResponseDto(items: []);
|
||||
}
|
||||
final itemsJson = data['items'] as List? ?? [];
|
||||
return ExtraPaymentListResponseDto(
|
||||
items: itemsJson.map((e) => ExtraPaymentDto.fromJson(e)).toList(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user