feat: Refactor code structure and optimize performance across multiple modules
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'invoice_decline_model.g.dart';
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class InvoiceDeclineModel{
|
||||
String id;
|
||||
String? reason;
|
||||
String? details;
|
||||
String? supportNote;
|
||||
|
||||
InvoiceDeclineModel({
|
||||
required this.id,
|
||||
required this.reason,
|
||||
this.details,
|
||||
this.supportNote,
|
||||
});
|
||||
factory InvoiceDeclineModel.fromJson(Map<String, dynamic> json) {
|
||||
return _$InvoiceDeclineModelFromJson(json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$InvoiceDeclineModelToJson(this);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:krow/core/data/models/shift/event_shift_position_model.dart';
|
||||
import 'package:krow/core/data/models/staff/staff_model.dart';
|
||||
import 'package:krow/core/entity/staff_contact_entity.dart';
|
||||
import 'package:krow/features/events/presentation/event_details/widgets/role/asigned_staff.dart';
|
||||
|
||||
part 'invoice_item_model.g.dart';
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class InvoiceItemModel {
|
||||
final String id;
|
||||
final StaffModel? staff;
|
||||
final EventShiftPositionModel? position;
|
||||
final double? workHours;
|
||||
final double? rate;
|
||||
final double? addonsAmount;
|
||||
final double? workAmount;
|
||||
final double? totalAmount;
|
||||
|
||||
InvoiceItemModel(
|
||||
{required this.id,
|
||||
required this.staff,
|
||||
required this.position,
|
||||
required this.workHours,
|
||||
required this.rate,
|
||||
required this.addonsAmount,
|
||||
required this.workAmount,
|
||||
required this.totalAmount});
|
||||
|
||||
factory InvoiceItemModel.fromJson(Map<String, dynamic> json) {
|
||||
return _$InvoiceItemModelFromJson(json);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => _$InvoiceItemModelToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:krow/core/data/models/event/business_model.dart';
|
||||
import 'package:krow/core/data/models/event/event_model.dart';
|
||||
import 'package:krow/features/invoice/data/models/invoice_decline_model.dart';
|
||||
import 'package:krow/features/invoice/data/models/invoice_item_model.dart';
|
||||
|
||||
part 'invoice_model.g.dart';
|
||||
|
||||
enum InvoiceStatus { open, disputed, resolved, paid, overdue, verified }
|
||||
|
||||
@JsonSerializable(fieldRename: FieldRename.snake)
|
||||
class InvoiceModel {
|
||||
final String id;
|
||||
final InvoiceStatus status;
|
||||
final BusinessModel? business;
|
||||
final EventModel? event;
|
||||
final String? contractType;
|
||||
final String? contractValue;
|
||||
final String? dueAt;
|
||||
final double? total;
|
||||
final double? addonsAmount;
|
||||
final double? workAmount;
|
||||
final List<InvoiceItemModel>? items;
|
||||
final InvoiceDeclineModel? dispute;
|
||||
|
||||
factory InvoiceModel.fromJson(Map<String, dynamic> json) {
|
||||
return _$InvoiceModelFromJson(json);
|
||||
}
|
||||
|
||||
InvoiceModel(
|
||||
{required this.id,
|
||||
required this.status,
|
||||
required this.business,
|
||||
required this.event,
|
||||
required this.contractType,
|
||||
required this.contractValue,
|
||||
required this.total,
|
||||
required this.addonsAmount,
|
||||
required this.dueAt,
|
||||
required this.workAmount,
|
||||
required this.items,
|
||||
required this.dispute});
|
||||
|
||||
Map<String, dynamic> toJson() => _$InvoiceModelToJson(this);
|
||||
|
||||
copyWith({
|
||||
String? id,
|
||||
InvoiceStatus? status,
|
||||
BusinessModel? business,
|
||||
EventModel? event,
|
||||
String? contractType,
|
||||
String? contractValue,
|
||||
String? dueAt,
|
||||
double? total,
|
||||
double? addonsAmount,
|
||||
double? workAmount,
|
||||
List<InvoiceItemModel>? items,
|
||||
InvoiceDeclineModel? dispute,
|
||||
}) {
|
||||
return InvoiceModel(
|
||||
id: id ?? this.id,
|
||||
status: status ?? this.status,
|
||||
business: business ?? this.business,
|
||||
event: event ?? this.event,
|
||||
contractType: contractType ?? this.contractType,
|
||||
contractValue: contractValue ?? this.contractValue,
|
||||
total: total ?? this.total,
|
||||
addonsAmount: addonsAmount ?? this.addonsAmount,
|
||||
workAmount: workAmount ?? this.workAmount,
|
||||
items: items ?? this.items,
|
||||
dueAt: dueAt ?? this.dueAt,
|
||||
dispute: dispute ?? this.dispute,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user