Add order entities and mocks for client order feature
Introduces new domain entities for order types and one-time orders, along with their positions. Adds a mock OrderRepository to the data_connect package and wires it into the module. Updates localization files for new order flows and refactors Equatable usage for consistency. Also adds a minus icon to the design system.
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
/// It is pure Dart and has no dependencies on Flutter or Firebase.
|
||||
///
|
||||
/// Note: Repository Interfaces are now located in their respective Feature packages.
|
||||
library;
|
||||
|
||||
// Users & Membership
|
||||
export 'src/entities/users/user.dart';
|
||||
@@ -26,6 +27,11 @@ export 'src/entities/events/event_shift_position.dart';
|
||||
export 'src/entities/events/assignment.dart';
|
||||
export 'src/entities/events/work_session.dart';
|
||||
|
||||
// Orders & Requests
|
||||
export 'src/entities/orders/order_type.dart';
|
||||
export 'src/entities/orders/one_time_order.dart';
|
||||
export 'src/entities/orders/one_time_order_position.dart';
|
||||
|
||||
// Skills & Certs
|
||||
export 'src/entities/skills/skill.dart';
|
||||
export 'src/entities/skills/skill_category.dart';
|
||||
|
||||
@@ -4,6 +4,15 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Can be between a business and the platform, or a business and staff.
|
||||
class BizContract extends Equatable {
|
||||
|
||||
const BizContract({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.name,
|
||||
required this.startDate,
|
||||
this.endDate,
|
||||
required this.contentUrl,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -22,15 +31,6 @@ class BizContract extends Equatable {
|
||||
/// URL to the document content (PDF/HTML).
|
||||
final String contentUrl;
|
||||
|
||||
const BizContract({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.name,
|
||||
required this.startDate,
|
||||
this.endDate,
|
||||
required this.contentUrl,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, businessId, name, startDate, endDate, contentUrl];
|
||||
List<Object?> get props => <Object?>[id, businessId, name, startDate, endDate, contentUrl];
|
||||
}
|
||||
@@ -19,6 +19,14 @@ enum BusinessStatus {
|
||||
///
|
||||
/// This is the top-level organizational entity in the system.
|
||||
class Business extends Equatable {
|
||||
|
||||
const Business({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.registrationNumber,
|
||||
required this.status,
|
||||
this.avatar,
|
||||
});
|
||||
/// Unique identifier for the business.
|
||||
final String id;
|
||||
|
||||
@@ -34,14 +42,6 @@ class Business extends Equatable {
|
||||
/// URL to the business logo.
|
||||
final String? avatar;
|
||||
|
||||
const Business({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.registrationNumber,
|
||||
required this.status,
|
||||
this.avatar,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name, registrationNumber, status, avatar];
|
||||
List<Object?> get props => <Object?>[id, name, registrationNumber, status, avatar];
|
||||
}
|
||||
@@ -2,6 +2,15 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents payroll and operational configuration for a [Business].
|
||||
class BusinessSetting extends Equatable {
|
||||
|
||||
const BusinessSetting({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.prefix,
|
||||
required this.overtimeEnabled,
|
||||
this.clockInRequirement,
|
||||
this.clockOutRequirement,
|
||||
});
|
||||
/// Unique identifier for the settings record.
|
||||
final String id;
|
||||
|
||||
@@ -20,17 +29,8 @@ class BusinessSetting extends Equatable {
|
||||
/// Requirement method for clocking out.
|
||||
final String? clockOutRequirement;
|
||||
|
||||
const BusinessSetting({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.prefix,
|
||||
required this.overtimeEnabled,
|
||||
this.clockInRequirement,
|
||||
this.clockOutRequirement,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
businessId,
|
||||
prefix,
|
||||
|
||||
@@ -14,6 +14,15 @@ enum HubStatus {
|
||||
|
||||
/// Represents a branch location or operational unit within a [Business].
|
||||
class Hub extends Equatable {
|
||||
|
||||
const Hub({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.name,
|
||||
required this.address,
|
||||
this.nfcTagId,
|
||||
required this.status,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -32,15 +41,6 @@ class Hub extends Equatable {
|
||||
/// Operational status.
|
||||
final HubStatus status;
|
||||
|
||||
const Hub({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.name,
|
||||
required this.address,
|
||||
this.nfcTagId,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, businessId, name, address, nfcTagId, status];
|
||||
List<Object?> get props => <Object?>[id, businessId, name, address, nfcTagId, status];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Used for more granular organization of staff and events (e.g. "Kitchen", "Service").
|
||||
class HubDepartment extends Equatable {
|
||||
|
||||
const HubDepartment({
|
||||
required this.id,
|
||||
required this.hubId,
|
||||
required this.name,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -13,12 +19,6 @@ class HubDepartment extends Equatable {
|
||||
/// Name of the department.
|
||||
final String name;
|
||||
|
||||
const HubDepartment({
|
||||
required this.id,
|
||||
required this.hubId,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, hubId, name];
|
||||
List<Object?> get props => <Object?>[id, hubId, name];
|
||||
}
|
||||
@@ -26,6 +26,15 @@ enum AssignmentStatus {
|
||||
|
||||
/// Represents the link between a [Staff] member and an [EventShiftPosition].
|
||||
class Assignment extends Equatable {
|
||||
|
||||
const Assignment({
|
||||
required this.id,
|
||||
required this.positionId,
|
||||
required this.staffId,
|
||||
required this.status,
|
||||
this.clockIn,
|
||||
this.clockOut,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -44,15 +53,6 @@ class Assignment extends Equatable {
|
||||
/// Actual timestamp when staff clocked out.
|
||||
final DateTime? clockOut;
|
||||
|
||||
const Assignment({
|
||||
required this.id,
|
||||
required this.positionId,
|
||||
required this.staffId,
|
||||
required this.status,
|
||||
this.clockIn,
|
||||
this.clockOut,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, positionId, staffId, status, clockIn, clockOut];
|
||||
List<Object?> get props => <Object?>[id, positionId, staffId, status, clockIn, clockOut];
|
||||
}
|
||||
@@ -34,6 +34,16 @@ enum EventStatus {
|
||||
///
|
||||
/// This is the central entity for scheduling work. An Event contains [EventShift]s.
|
||||
class Event extends Equatable {
|
||||
|
||||
const Event({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.hubId,
|
||||
required this.name,
|
||||
required this.date,
|
||||
required this.status,
|
||||
required this.contractType,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -55,16 +65,6 @@ class Event extends Equatable {
|
||||
/// Type of employment contract (e.g., 'freelance', 'permanent').
|
||||
final String contractType;
|
||||
|
||||
const Event({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.hubId,
|
||||
required this.name,
|
||||
required this.date,
|
||||
required this.status,
|
||||
required this.contractType,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, businessId, hubId, name, date, status, contractType];
|
||||
List<Object?> get props => <Object?>[id, businessId, hubId, name, date, status, contractType];
|
||||
}
|
||||
@@ -4,6 +4,13 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// An Event can have multiple shifts (e.g. "Morning Shift", "Evening Shift").
|
||||
class EventShift extends Equatable {
|
||||
|
||||
const EventShift({
|
||||
required this.id,
|
||||
required this.eventId,
|
||||
required this.name,
|
||||
required this.address,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -16,13 +23,6 @@ class EventShift extends Equatable {
|
||||
/// Specific address for this shift (if different from Hub).
|
||||
final String address;
|
||||
|
||||
const EventShift({
|
||||
required this.id,
|
||||
required this.eventId,
|
||||
required this.name,
|
||||
required this.address,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, eventId, name, address];
|
||||
List<Object?> get props => <Object?>[id, eventId, name, address];
|
||||
}
|
||||
@@ -4,6 +4,17 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Defines the requirement for a specific [Skill], the quantity needed, and the pay.
|
||||
class EventShiftPosition extends Equatable {
|
||||
|
||||
const EventShiftPosition({
|
||||
required this.id,
|
||||
required this.shiftId,
|
||||
required this.skillId,
|
||||
required this.count,
|
||||
required this.rate,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.breakDurationMinutes,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -28,19 +39,8 @@ class EventShiftPosition extends Equatable {
|
||||
/// Deducted break duration in minutes.
|
||||
final int breakDurationMinutes;
|
||||
|
||||
const EventShiftPosition({
|
||||
required this.id,
|
||||
required this.shiftId,
|
||||
required this.skillId,
|
||||
required this.count,
|
||||
required this.rate,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
required this.breakDurationMinutes,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
shiftId,
|
||||
skillId,
|
||||
|
||||
@@ -4,6 +4,14 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Derived from [Assignment] clock-in/out times, used for payroll.
|
||||
class WorkSession extends Equatable {
|
||||
|
||||
const WorkSession({
|
||||
required this.id,
|
||||
required this.assignmentId,
|
||||
required this.startTime,
|
||||
this.endTime,
|
||||
required this.breakDurationMinutes,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -19,14 +27,6 @@ class WorkSession extends Equatable {
|
||||
/// Verified break duration.
|
||||
final int breakDurationMinutes;
|
||||
|
||||
const WorkSession({
|
||||
required this.id,
|
||||
required this.assignmentId,
|
||||
required this.startTime,
|
||||
this.endTime,
|
||||
required this.breakDurationMinutes,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, assignmentId, startTime, endTime, breakDurationMinutes];
|
||||
List<Object?> get props => <Object?>[id, assignmentId, startTime, endTime, breakDurationMinutes];
|
||||
}
|
||||
@@ -26,6 +26,16 @@ enum InvoiceStatus {
|
||||
|
||||
/// Represents a bill sent to a [Business] for services rendered.
|
||||
class Invoice extends Equatable {
|
||||
|
||||
const Invoice({
|
||||
required this.id,
|
||||
required this.eventId,
|
||||
required this.businessId,
|
||||
required this.status,
|
||||
required this.totalAmount,
|
||||
required this.workAmount,
|
||||
required this.addonsAmount,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -47,18 +57,8 @@ class Invoice extends Equatable {
|
||||
/// Total amount for addons/extras.
|
||||
final double addonsAmount;
|
||||
|
||||
const Invoice({
|
||||
required this.id,
|
||||
required this.eventId,
|
||||
required this.businessId,
|
||||
required this.status,
|
||||
required this.totalAmount,
|
||||
required this.workAmount,
|
||||
required this.addonsAmount,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
eventId,
|
||||
businessId,
|
||||
|
||||
@@ -2,6 +2,13 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a reason or log for a declined [Invoice].
|
||||
class InvoiceDecline extends Equatable {
|
||||
|
||||
const InvoiceDecline({
|
||||
required this.id,
|
||||
required this.invoiceId,
|
||||
required this.reason,
|
||||
required this.declinedAt,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -14,13 +21,6 @@ class InvoiceDecline extends Equatable {
|
||||
/// When the decline happened.
|
||||
final DateTime declinedAt;
|
||||
|
||||
const InvoiceDecline({
|
||||
required this.id,
|
||||
required this.invoiceId,
|
||||
required this.reason,
|
||||
required this.declinedAt,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, invoiceId, reason, declinedAt];
|
||||
List<Object?> get props => <Object?>[id, invoiceId, reason, declinedAt];
|
||||
}
|
||||
@@ -4,6 +4,15 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Corresponds to the work done by one [Staff] member.
|
||||
class InvoiceItem extends Equatable {
|
||||
|
||||
const InvoiceItem({
|
||||
required this.id,
|
||||
required this.invoiceId,
|
||||
required this.staffId,
|
||||
required this.workHours,
|
||||
required this.rate,
|
||||
required this.amount,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -22,15 +31,6 @@ class InvoiceItem extends Equatable {
|
||||
/// Total line item amount (workHours * rate).
|
||||
final double amount;
|
||||
|
||||
const InvoiceItem({
|
||||
required this.id,
|
||||
required this.invoiceId,
|
||||
required this.staffId,
|
||||
required this.workHours,
|
||||
required this.rate,
|
||||
required this.amount,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, invoiceId, staffId, workHours, rate, amount];
|
||||
List<Object?> get props => <Object?>[id, invoiceId, staffId, workHours, rate, amount];
|
||||
}
|
||||
@@ -17,6 +17,15 @@ enum PaymentStatus {
|
||||
|
||||
/// Represents a payout to a [Staff] member for a completed [Assignment].
|
||||
class StaffPayment extends Equatable {
|
||||
|
||||
const StaffPayment({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.assignmentId,
|
||||
required this.amount,
|
||||
required this.status,
|
||||
this.paidAt,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -35,15 +44,6 @@ class StaffPayment extends Equatable {
|
||||
/// When the payment was successfully processed.
|
||||
final DateTime? paidAt;
|
||||
|
||||
const StaffPayment({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.assignmentId,
|
||||
required this.amount,
|
||||
required this.status,
|
||||
this.paidAt,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, staffId, assignmentId, amount, status, paidAt];
|
||||
List<Object?> get props => <Object?>[id, staffId, assignmentId, amount, status, paidAt];
|
||||
}
|
||||
@@ -5,6 +5,16 @@ import 'package:equatable/equatable.dart';
|
||||
/// This entity provides aggregated metrics such as spending and shift counts
|
||||
/// for both the current week and the upcoming 7 days.
|
||||
class HomeDashboardData extends Equatable {
|
||||
|
||||
/// Creates a [HomeDashboardData] instance.
|
||||
const HomeDashboardData({
|
||||
required this.weeklySpending,
|
||||
required this.next7DaysSpending,
|
||||
required this.weeklyShifts,
|
||||
required this.next7DaysScheduled,
|
||||
required this.totalNeeded,
|
||||
required this.totalFilled,
|
||||
});
|
||||
/// Total spending for the current week.
|
||||
final double weeklySpending;
|
||||
|
||||
@@ -23,18 +33,8 @@ class HomeDashboardData extends Equatable {
|
||||
/// Total workers filled for today's shifts.
|
||||
final int totalFilled;
|
||||
|
||||
/// Creates a [HomeDashboardData] instance.
|
||||
const HomeDashboardData({
|
||||
required this.weeklySpending,
|
||||
required this.next7DaysSpending,
|
||||
required this.weeklyShifts,
|
||||
required this.next7DaysScheduled,
|
||||
required this.totalNeeded,
|
||||
required this.totalFilled,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
weeklySpending,
|
||||
next7DaysSpending,
|
||||
weeklyShifts,
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'one_time_order_position.dart';
|
||||
|
||||
/// Represents a customer's request for a single event or shift.
|
||||
///
|
||||
/// Encapsulates the date, primary location, and a list of specific [OneTimeOrderPosition] requirements.
|
||||
class OneTimeOrder extends Equatable {
|
||||
|
||||
const OneTimeOrder({
|
||||
required this.date,
|
||||
required this.location,
|
||||
required this.positions,
|
||||
});
|
||||
/// The specific date for the shift or event.
|
||||
final DateTime date;
|
||||
|
||||
/// The primary location where the work will take place.
|
||||
final String location;
|
||||
|
||||
/// The list of positions and headcounts required for this order.
|
||||
final List<OneTimeOrderPosition> positions;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[date, location, positions];
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a specific position requirement within a [OneTimeOrder].
|
||||
///
|
||||
/// Defines the role, headcount, and scheduling details for a single staffing requirement.
|
||||
class OneTimeOrderPosition extends Equatable {
|
||||
|
||||
const OneTimeOrderPosition({
|
||||
required this.role,
|
||||
required this.count,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
this.lunchBreak = 30,
|
||||
this.location,
|
||||
});
|
||||
/// The job role or title required.
|
||||
final String role;
|
||||
|
||||
/// The number of workers required for this position.
|
||||
final int count;
|
||||
|
||||
/// The scheduled start time (e.g., "09:00 AM").
|
||||
final String startTime;
|
||||
|
||||
/// The scheduled end time (e.g., "05:00 PM").
|
||||
final String endTime;
|
||||
|
||||
/// The duration of the lunch break in minutes. Defaults to 30.
|
||||
final int lunchBreak;
|
||||
|
||||
/// Optional specific location for this position, if different from the order's main location.
|
||||
final String? location;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[
|
||||
role,
|
||||
count,
|
||||
startTime,
|
||||
endTime,
|
||||
lunchBreak,
|
||||
location,
|
||||
];
|
||||
|
||||
/// Creates a copy of this position with the given fields replaced.
|
||||
OneTimeOrderPosition copyWith({
|
||||
String? role,
|
||||
int? count,
|
||||
String? startTime,
|
||||
String? endTime,
|
||||
int? lunchBreak,
|
||||
String? location,
|
||||
}) {
|
||||
return OneTimeOrderPosition(
|
||||
role: role ?? this.role,
|
||||
count: count ?? this.count,
|
||||
startTime: startTime ?? this.startTime,
|
||||
endTime: endTime ?? this.endTime,
|
||||
lunchBreak: lunchBreak ?? this.lunchBreak,
|
||||
location: location ?? this.location,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a type of order that can be created (e.g., Rapid, One-Time).
|
||||
///
|
||||
/// This entity defines the identity and display metadata (keys) for the order type.
|
||||
/// UI-specific properties like colors and icons are handled by the presentation layer.
|
||||
class OrderType extends Equatable {
|
||||
|
||||
const OrderType({
|
||||
required this.id,
|
||||
required this.titleKey,
|
||||
required this.descriptionKey,
|
||||
});
|
||||
/// Unique identifier for the order type.
|
||||
final String id;
|
||||
|
||||
/// Translation key for the title.
|
||||
final String titleKey;
|
||||
|
||||
/// Translation key for the description.
|
||||
final String descriptionKey;
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[id, titleKey, descriptionKey];
|
||||
}
|
||||
@@ -4,17 +4,17 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Can apply to Staff (needs) or Events (provision).
|
||||
class Accessibility extends Equatable {
|
||||
|
||||
const Accessibility({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
/// Description (e.g. "Wheelchair Access").
|
||||
final String name;
|
||||
|
||||
const Accessibility({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name];
|
||||
List<Object?> get props => <Object?>[id, name];
|
||||
}
|
||||
@@ -2,6 +2,15 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents bank account details for payroll.
|
||||
class BankAccount extends Equatable {
|
||||
|
||||
const BankAccount({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.bankName,
|
||||
required this.accountNumber,
|
||||
required this.accountName,
|
||||
this.sortCode,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -20,15 +29,6 @@ class BankAccount extends Equatable {
|
||||
/// Sort code (if applicable).
|
||||
final String? sortCode;
|
||||
|
||||
const BankAccount({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.bankName,
|
||||
required this.accountNumber,
|
||||
required this.accountName,
|
||||
this.sortCode,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, userId, bankName, accountNumber, accountName, sortCode];
|
||||
List<Object?> get props => <Object?>[id, userId, bankName, accountNumber, accountName, sortCode];
|
||||
}
|
||||
@@ -4,6 +4,12 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Critical for staff safety during shifts.
|
||||
class EmergencyContact extends Equatable {
|
||||
|
||||
const EmergencyContact({
|
||||
required this.name,
|
||||
required this.relationship,
|
||||
required this.phone,
|
||||
});
|
||||
/// Full name of the contact.
|
||||
final String name;
|
||||
|
||||
@@ -13,12 +19,6 @@ class EmergencyContact extends Equatable {
|
||||
/// Phone number.
|
||||
final String phone;
|
||||
|
||||
const EmergencyContact({
|
||||
required this.name,
|
||||
required this.relationship,
|
||||
required this.phone,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name, relationship, phone];
|
||||
List<Object?> get props => <Object?>[name, relationship, phone];
|
||||
}
|
||||
@@ -4,6 +4,14 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Defines recurring availability (e.g., "Mondays 9-5").
|
||||
class Schedule extends Equatable {
|
||||
|
||||
const Schedule({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.dayOfWeek,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -19,14 +27,6 @@ class Schedule extends Equatable {
|
||||
/// End time of availability.
|
||||
final DateTime endTime;
|
||||
|
||||
const Schedule({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.dayOfWeek,
|
||||
required this.startTime,
|
||||
required this.endTime,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, staffId, dayOfWeek, startTime, endTime];
|
||||
List<Object?> get props => <Object?>[id, staffId, dayOfWeek, startTime, endTime];
|
||||
}
|
||||
@@ -11,6 +11,13 @@ enum PreferenceType {
|
||||
|
||||
/// Represents a business's specific preference for a staff member.
|
||||
class BusinessStaffPreference extends Equatable {
|
||||
|
||||
const BusinessStaffPreference({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.staffId,
|
||||
required this.type,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -23,13 +30,6 @@ class BusinessStaffPreference extends Equatable {
|
||||
/// Whether they are a favorite or blocked.
|
||||
final PreferenceType type;
|
||||
|
||||
const BusinessStaffPreference({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.staffId,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, businessId, staffId, type];
|
||||
List<Object?> get props => <Object?>[id, businessId, staffId, type];
|
||||
}
|
||||
@@ -4,6 +4,15 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Penalties are issued for no-shows, cancellations, or poor conduct.
|
||||
class PenaltyLog extends Equatable {
|
||||
|
||||
const PenaltyLog({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.assignmentId,
|
||||
required this.reason,
|
||||
required this.points,
|
||||
required this.issuedAt,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -22,15 +31,6 @@ class PenaltyLog extends Equatable {
|
||||
/// When the penalty was issued.
|
||||
final DateTime issuedAt;
|
||||
|
||||
const PenaltyLog({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.assignmentId,
|
||||
required this.reason,
|
||||
required this.points,
|
||||
required this.issuedAt,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, staffId, assignmentId, reason, points, issuedAt];
|
||||
List<Object?> get props => <Object?>[id, staffId, assignmentId, reason, points, issuedAt];
|
||||
}
|
||||
@@ -2,6 +2,15 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a rating given to a staff member by a client.
|
||||
class StaffRating extends Equatable {
|
||||
|
||||
const StaffRating({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.eventId,
|
||||
required this.businessId,
|
||||
required this.rating,
|
||||
this.comment,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -20,15 +29,6 @@ class StaffRating extends Equatable {
|
||||
/// Optional feedback text.
|
||||
final String? comment;
|
||||
|
||||
const StaffRating({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.eventId,
|
||||
required this.businessId,
|
||||
required this.rating,
|
||||
this.comment,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, staffId, eventId, businessId, rating, comment];
|
||||
List<Object?> get props => <Object?>[id, staffId, eventId, businessId, rating, comment];
|
||||
}
|
||||
@@ -4,6 +4,12 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Examples: "Food Hygiene Level 2", "SIA Badge".
|
||||
class Certificate extends Equatable {
|
||||
|
||||
const Certificate({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.isRequired,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -13,12 +19,6 @@ class Certificate extends Equatable {
|
||||
/// Whether this certificate is mandatory for platform access or specific roles.
|
||||
final bool isRequired;
|
||||
|
||||
const Certificate({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.isRequired,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name, isRequired];
|
||||
List<Object?> get props => <Object?>[id, name, isRequired];
|
||||
}
|
||||
@@ -5,6 +5,13 @@ import 'package:equatable/equatable.dart';
|
||||
/// Examples: "Waiter", "Security Guard", "Bartender".
|
||||
/// Linked to a [SkillCategory].
|
||||
class Skill extends Equatable {
|
||||
|
||||
const Skill({
|
||||
required this.id,
|
||||
required this.categoryId,
|
||||
required this.name,
|
||||
required this.basePrice,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -17,13 +24,6 @@ class Skill extends Equatable {
|
||||
/// Default hourly rate suggested for this skill.
|
||||
final double basePrice;
|
||||
|
||||
const Skill({
|
||||
required this.id,
|
||||
required this.categoryId,
|
||||
required this.name,
|
||||
required this.basePrice,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, categoryId, name, basePrice];
|
||||
List<Object?> get props => <Object?>[id, categoryId, name, basePrice];
|
||||
}
|
||||
@@ -2,17 +2,17 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a broad category of skills (e.g. "Hospitality", "Logistics").
|
||||
class SkillCategory extends Equatable {
|
||||
|
||||
const SkillCategory({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
/// Display name.
|
||||
final String name;
|
||||
|
||||
const SkillCategory({
|
||||
required this.id,
|
||||
required this.name,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name];
|
||||
List<Object?> get props => <Object?>[id, name];
|
||||
}
|
||||
@@ -4,6 +4,14 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Examples: "Black Shirt" (Uniform), "Safety Boots" (Equipment).
|
||||
class SkillKit extends Equatable {
|
||||
|
||||
const SkillKit({
|
||||
required this.id,
|
||||
required this.skillId,
|
||||
required this.name,
|
||||
required this.isRequired,
|
||||
required this.type,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -19,14 +27,6 @@ class SkillKit extends Equatable {
|
||||
/// Type of kit ('uniform' or 'equipment').
|
||||
final String type;
|
||||
|
||||
const SkillKit({
|
||||
required this.id,
|
||||
required this.skillId,
|
||||
required this.name,
|
||||
required this.isRequired,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, skillId, name, isRequired, type];
|
||||
List<Object?> get props => <Object?>[id, skillId, name, isRequired, type];
|
||||
}
|
||||
@@ -26,6 +26,15 @@ enum StaffSkillStatus {
|
||||
|
||||
/// Represents a staff member's qualification in a specific [Skill].
|
||||
class StaffSkill extends Equatable {
|
||||
|
||||
const StaffSkill({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.skillId,
|
||||
required this.level,
|
||||
required this.experienceYears,
|
||||
required this.status,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -44,15 +53,6 @@ class StaffSkill extends Equatable {
|
||||
/// Verification status.
|
||||
final StaffSkillStatus status;
|
||||
|
||||
const StaffSkill({
|
||||
required this.id,
|
||||
required this.staffId,
|
||||
required this.skillId,
|
||||
required this.level,
|
||||
required this.experienceYears,
|
||||
required this.status,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, staffId, skillId, level, experienceYears, status];
|
||||
List<Object?> get props => <Object?>[id, staffId, skillId, level, experienceYears, status];
|
||||
}
|
||||
@@ -2,6 +2,13 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a financial addon/bonus/deduction applied to an Invoice or Payment.
|
||||
class Addon extends Equatable {
|
||||
|
||||
const Addon({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.amount,
|
||||
required this.type,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -14,13 +21,6 @@ class Addon extends Equatable {
|
||||
/// Type ('credit' or 'debit').
|
||||
final String type;
|
||||
|
||||
const Addon({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.amount,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name, amount, type];
|
||||
List<Object?> get props => <Object?>[id, name, amount, type];
|
||||
}
|
||||
@@ -4,6 +4,12 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Used for avatars, certificates, or event photos.
|
||||
class Media extends Equatable {
|
||||
|
||||
const Media({
|
||||
required this.id,
|
||||
required this.url,
|
||||
required this.type,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -13,12 +19,6 @@ class Media extends Equatable {
|
||||
/// MIME type or general type (image, pdf).
|
||||
final String type;
|
||||
|
||||
const Media({
|
||||
required this.id,
|
||||
required this.url,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, url, type];
|
||||
List<Object?> get props => <Object?>[id, url, type];
|
||||
}
|
||||
@@ -2,17 +2,17 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a descriptive tag used for categorizing events or staff.
|
||||
class Tag extends Equatable {
|
||||
|
||||
const Tag({
|
||||
required this.id,
|
||||
required this.label,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
/// Text label.
|
||||
final String label;
|
||||
|
||||
const Tag({
|
||||
required this.id,
|
||||
required this.label,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, label];
|
||||
List<Object?> get props => <Object?>[id, label];
|
||||
}
|
||||
@@ -2,6 +2,14 @@ import 'package:equatable/equatable.dart';
|
||||
|
||||
/// Represents a geographical area where a [Staff] member is willing to work.
|
||||
class WorkingArea extends Equatable {
|
||||
|
||||
const WorkingArea({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.centerLat,
|
||||
required this.centerLng,
|
||||
required this.radiusKm,
|
||||
});
|
||||
/// Unique identifier.
|
||||
final String id;
|
||||
|
||||
@@ -17,14 +25,6 @@ class WorkingArea extends Equatable {
|
||||
/// Radius in Kilometers.
|
||||
final double radiusKm;
|
||||
|
||||
const WorkingArea({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.centerLat,
|
||||
required this.centerLng,
|
||||
required this.radiusKm,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, name, centerLat, centerLng, radiusKm];
|
||||
List<Object?> get props => <Object?>[id, name, centerLat, centerLng, radiusKm];
|
||||
}
|
||||
@@ -4,6 +4,13 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Grants a user access to business-level operations.
|
||||
class BizMember extends Equatable {
|
||||
|
||||
const BizMember({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.userId,
|
||||
required this.role,
|
||||
});
|
||||
/// Unique identifier for this membership.
|
||||
final String id;
|
||||
|
||||
@@ -16,13 +23,6 @@ class BizMember extends Equatable {
|
||||
/// The role within the business.
|
||||
final String role;
|
||||
|
||||
const BizMember({
|
||||
required this.id,
|
||||
required this.businessId,
|
||||
required this.userId,
|
||||
required this.role,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, businessId, userId, role];
|
||||
List<Object?> get props => <Object?>[id, businessId, userId, role];
|
||||
}
|
||||
@@ -4,6 +4,13 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Grants a user access to specific [Hub] operations, distinct from [BizMember].
|
||||
class HubMember extends Equatable {
|
||||
|
||||
const HubMember({
|
||||
required this.id,
|
||||
required this.hubId,
|
||||
required this.userId,
|
||||
required this.role,
|
||||
});
|
||||
/// Unique identifier for this membership.
|
||||
final String id;
|
||||
|
||||
@@ -16,13 +23,6 @@ class HubMember extends Equatable {
|
||||
/// The role within the hub.
|
||||
final String role;
|
||||
|
||||
const HubMember({
|
||||
required this.id,
|
||||
required this.hubId,
|
||||
required this.userId,
|
||||
required this.role,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, hubId, userId, role];
|
||||
List<Object?> get props => <Object?>[id, hubId, userId, role];
|
||||
}
|
||||
@@ -4,6 +4,14 @@ import 'package:equatable/equatable.dart';
|
||||
///
|
||||
/// Allows a [User] to be a member of either a [Business] or a [Hub].
|
||||
class Membership extends Equatable {
|
||||
|
||||
const Membership({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.memberableId,
|
||||
required this.memberableType,
|
||||
required this.role,
|
||||
});
|
||||
/// Unique identifier for the membership record.
|
||||
final String id;
|
||||
|
||||
@@ -19,14 +27,6 @@ class Membership extends Equatable {
|
||||
/// The role within that organization (e.g., 'manager', 'viewer').
|
||||
final String role;
|
||||
|
||||
const Membership({
|
||||
required this.id,
|
||||
required this.userId,
|
||||
required this.memberableId,
|
||||
required this.memberableType,
|
||||
required this.role,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, userId, memberableId, memberableType, role];
|
||||
List<Object?> get props => <Object?>[id, userId, memberableId, memberableType, role];
|
||||
}
|
||||
@@ -29,6 +29,18 @@ enum StaffStatus {
|
||||
/// Contains all personal and professional details of a staff member.
|
||||
/// Linked to a [User] via [authProviderId].
|
||||
class Staff extends Equatable {
|
||||
|
||||
const Staff({
|
||||
required this.id,
|
||||
required this.authProviderId,
|
||||
required this.name,
|
||||
required this.email,
|
||||
this.phone,
|
||||
required this.status,
|
||||
this.address,
|
||||
this.avatar,
|
||||
this.livePhoto,
|
||||
});
|
||||
/// Unique identifier for the staff profile.
|
||||
final String id;
|
||||
|
||||
@@ -56,20 +68,8 @@ class Staff extends Equatable {
|
||||
/// URL to a verified live photo for identity verification.
|
||||
final String? livePhoto;
|
||||
|
||||
const Staff({
|
||||
required this.id,
|
||||
required this.authProviderId,
|
||||
required this.name,
|
||||
required this.email,
|
||||
this.phone,
|
||||
required this.status,
|
||||
this.address,
|
||||
this.avatar,
|
||||
this.livePhoto,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
id,
|
||||
authProviderId,
|
||||
name,
|
||||
|
||||
@@ -5,6 +5,13 @@ import 'package:equatable/equatable.dart';
|
||||
/// This entity corresponds to the Firebase Auth user record and acts as the
|
||||
/// linkage between the authentication system and the specific [Staff] or Client profiles.
|
||||
class User extends Equatable {
|
||||
|
||||
const User({
|
||||
required this.id,
|
||||
required this.email,
|
||||
this.phone,
|
||||
required this.role,
|
||||
});
|
||||
/// The unique identifier from the authentication provider (e.g., Firebase UID).
|
||||
final String id;
|
||||
|
||||
@@ -18,13 +25,6 @@ class User extends Equatable {
|
||||
/// This determines the initial routing and permissions.
|
||||
final String role;
|
||||
|
||||
const User({
|
||||
required this.id,
|
||||
required this.email,
|
||||
this.phone,
|
||||
required this.role,
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [id, email, phone, role];
|
||||
List<Object?> get props => <Object?>[id, email, phone, role];
|
||||
}
|
||||
Reference in New Issue
Block a user