feat: implement staff documents feature with localization and navigation updates

This commit is contained in:
Achintha Isuru
2026-01-25 03:01:54 -05:00
parent 753a93c24a
commit b3e156ebbe
11 changed files with 38 additions and 120 deletions

View File

@@ -580,5 +580,24 @@
} }
} }
} }
},
"staff_documents": {
"title": "Documents",
"verification_card": {
"title": "Document Verification",
"progress": "$completed/$total Complete"
},
"list": {
"empty": "No documents found",
"error": "Error: $message"
},
"card": {
"view": "View",
"upload": "Upload",
"verified": "Verified",
"pending": "Pending",
"missing": "Missing",
"rejected": "Rejected"
}
} }
} }

View File

@@ -28,7 +28,7 @@ extension ProfileNavigator on IModularNavigator {
/// Navigates to the documents page. /// Navigates to the documents page.
void pushDocuments() { void pushDocuments() {
pushNamed('/documents'); pushNamed('../documents');
} }
/// Navigates to the certificates page. /// Navigates to the certificates page.

View File

@@ -1,46 +0,0 @@
import 'package:krow_domain/krow_domain.dart';
import '../../domain/repositories/documents_repository.dart';
class DocumentsRepositoryMock implements DocumentsRepository {
@override
Future<List<StaffDocument>> getDocuments() async {
const List<StaffDocument> documents = <StaffDocument>[
StaffDocument(
id: '1',
documentId: 'gov_id_1',
staffId: 'current_user',
name: 'Government ID',
description: 'Passport, Driver\'s License, or State ID',
status: DocumentStatus.verified,
),
StaffDocument(
id: '2',
documentId: 'ssn_1',
staffId: 'current_user',
name: 'Social Security Card',
description: 'Or W-9 Form',
status: DocumentStatus.pending,
),
StaffDocument(
id: '3',
documentId: 'work_auth_1',
staffId: 'current_user',
name: 'Work Authorization',
description: 'I-9 or Work Permit',
status: DocumentStatus.verified,
),
StaffDocument(
id: '4',
documentId: 'address_1',
staffId: 'current_user',
name: 'Proof of Address',
description: 'Utility bill or bank statement',
status: DocumentStatus.missing,
),
];
await Future<void>.delayed(const Duration(seconds: 1)); // Simulate network delay
return documents;
}
}

View File

@@ -1,12 +0,0 @@
import 'package:krow_core/core.dart';
/// Arguments for the [GetDocumentsUseCase].
class GetDocumentsArguments extends UseCaseArgument {
/// The ID of the staff member to fetch documents for.
final String staffId;
const GetDocumentsArguments({required this.staffId});
@override
List<Object?> get props => <Object?>[staffId];
}

View File

@@ -23,9 +23,7 @@ class DocumentsPage extends StatelessWidget {
} }
return Scaffold( return Scaffold(
backgroundColor: UiColors.background,
appBar: AppBar( appBar: AppBar(
backgroundColor: UiColors.bgPopup,
elevation: 0, elevation: 0,
leading: IconButton( leading: IconButton(
icon: const Icon(UiIcons.arrowLeft, color: UiColors.iconSecondary), icon: const Icon(UiIcons.arrowLeft, color: UiColors.iconSecondary),

View File

@@ -12,7 +12,7 @@ class StaffDocumentsModule extends Module {
void binds(Injector i) { void binds(Injector i) {
i.addLazySingleton<DocumentsRepository>( i.addLazySingleton<DocumentsRepository>(
() => DocumentsRepositoryImpl( () => DocumentsRepositoryImpl(
dataConnect: i.get<ExampleConnector>(), dataConnect: ExampleConnector.instance,
firebaseAuth: FirebaseAuth.instance, firebaseAuth: FirebaseAuth.instance,
), ),
); );

View File

@@ -0,0 +1,3 @@
library staff_documents;
export 'src/staff_documents_module.dart';

View File

@@ -1,58 +0,0 @@
import 'package:staff_tax_forms/src/domain/entities/tax_form_entity.dart';
import 'package:staff_tax_forms/src/domain/repositories/tax_forms_repository.dart';
class TaxFormsRepositoryMock implements TaxFormsRepository {
final List<TaxFormEntity> _forms = [
const TaxFormEntity(
type: TaxFormType.i9,
title: 'Form I-9',
subtitle: 'Employment Eligibility Verification',
description: 'Required to verify your identity and work authorization',
status: TaxFormStatus.submitted,
),
const TaxFormEntity(
type: TaxFormType.w4,
title: 'Form W-4',
subtitle: 'Employee\'s Withholding Certificate',
description: 'Set up your federal tax withholding',
status: TaxFormStatus.notStarted,
),
];
@override
Future<List<TaxFormEntity>> getTaxForms() async {
await Future.delayed(const Duration(milliseconds: 800)); // Simulating network
return _forms;
}
@override
Future<void> submitForm(TaxFormType type, Map<String, dynamic> data) async {
await Future.delayed(const Duration(seconds: 1));
final index = _forms.indexWhere((f) => f.type == type);
if (index != -1) {
_forms[index] = TaxFormEntity(
type: _forms[index].type,
title: _forms[index].title,
subtitle: _forms[index].subtitle,
description: _forms[index].description,
status: TaxFormStatus.submitted,
lastUpdated: DateTime.now(),
);
}
}
@override
Future<void> updateFormStatus(TaxFormType type, TaxFormStatus status) async {
final index = _forms.indexWhere((f) => f.type == type);
if (index != -1) {
_forms[index] = TaxFormEntity(
type: _forms[index].type,
title: _forms[index].title,
subtitle: _forms[index].subtitle,
description: _forms[index].description,
status: status,
lastUpdated: DateTime.now(),
);
}
}
}

View File

@@ -7,6 +7,7 @@ import 'package:staff_emergency_contact/staff_emergency_contact.dart';
import 'package:staff_profile_experience/staff_profile_experience.dart'; import 'package:staff_profile_experience/staff_profile_experience.dart';
import 'package:staff_bank_account/staff_bank_account.dart'; import 'package:staff_bank_account/staff_bank_account.dart';
import 'package:staff_tax_forms/staff_tax_forms.dart'; import 'package:staff_tax_forms/staff_tax_forms.dart';
import 'package:staff_documents/staff_documents.dart';
import 'package:staff_main/src/presentation/blocs/staff_main_cubit.dart'; import 'package:staff_main/src/presentation/blocs/staff_main_cubit.dart';
import 'package:staff_main/src/presentation/constants/staff_main_routes.dart'; import 'package:staff_main/src/presentation/constants/staff_main_routes.dart';
@@ -55,5 +56,9 @@ class StaffMainModule extends Module {
r.module('/experience', module: StaffProfileExperienceModule()); r.module('/experience', module: StaffProfileExperienceModule());
r.module('/bank-account', module: StaffBankAccountModule()); r.module('/bank-account', module: StaffBankAccountModule());
r.module('/tax-forms', module: StaffTaxFormsModule()); r.module('/tax-forms', module: StaffTaxFormsModule());
r.module(
'/documents',
module: StaffDocumentsModule(),
);
} }
} }

View File

@@ -37,6 +37,8 @@ dependencies:
path: ../profile_sections/finances/staff_bank_account path: ../profile_sections/finances/staff_bank_account
staff_tax_forms: staff_tax_forms:
path: ../profile_sections/compliance/tax_forms path: ../profile_sections/compliance/tax_forms
staff_documents:
path: ../profile_sections/compliance/documents
# staff_shifts: # staff_shifts:
# path: ../shifts # path: ../shifts
# staff_payments: # staff_payments:

View File

@@ -1071,6 +1071,13 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.1" version: "0.0.1"
staff_documents:
dependency: transitive
description:
path: "packages/features/staff/profile_sections/compliance/documents"
relative: true
source: path
version: "0.0.1"
staff_tax_forms: staff_tax_forms:
dependency: transitive dependency: transitive
description: description: