64 lines
1.5 KiB
Dart
64 lines
1.5 KiB
Dart
import 'package:equatable/equatable.dart';
|
|
|
|
/// What a staff member is allowed to do.
|
|
enum StaffRole {
|
|
admin('Admin', 'Full access to every module'),
|
|
manager('Manager', 'Sales, inventory and reports'),
|
|
cashier('Cashier', 'Billing and customers only');
|
|
|
|
const StaffRole(this.label, this.description);
|
|
|
|
final String label;
|
|
final String description;
|
|
|
|
bool get canVoidSale => this != StaffRole.cashier;
|
|
bool get canEditPricing => this == StaffRole.admin;
|
|
bool get canViewReports => this != StaffRole.cashier;
|
|
}
|
|
|
|
/// A person who signs in at the terminal.
|
|
class StaffUser extends Equatable {
|
|
const StaffUser({
|
|
required this.id,
|
|
required this.name,
|
|
required this.role,
|
|
required this.pin,
|
|
});
|
|
|
|
final String id;
|
|
final String name;
|
|
final StaffRole role;
|
|
|
|
/// Four-digit quick-unlock code. Never rendered.
|
|
final String pin;
|
|
|
|
@override
|
|
List<Object?> get props => [id, name, role];
|
|
}
|
|
|
|
/// The registered outlet this terminal belongs to.
|
|
class StoreAccount extends Equatable {
|
|
const StoreAccount({
|
|
required this.id,
|
|
required this.name,
|
|
required this.email,
|
|
required this.address,
|
|
required this.gstin,
|
|
required this.phone,
|
|
required this.staff,
|
|
this.plan = 'Business',
|
|
});
|
|
|
|
final String id;
|
|
final String name;
|
|
final String email;
|
|
final String address;
|
|
final String gstin;
|
|
final String phone;
|
|
final List<StaffUser> staff;
|
|
final String plan;
|
|
|
|
@override
|
|
List<Object?> get props => [id, email];
|
|
}
|