fix: add ignore_for_file to data connect Repos and modify CI to avoid analyzing deleted files
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'package:firebase_data_connect/src/core/ref.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart';
|
||||
import 'package:krow_domain/krow_domain.dart' as domain;
|
||||
@@ -10,11 +11,11 @@ import '../../domain/repositories/certificates_repository.dart';
|
||||
/// It maps raw generated data types to clean [domain.StaffDocument] entities.
|
||||
class CertificatesRepositoryImpl
|
||||
implements CertificatesRepository {
|
||||
/// The Data Connect service instance.
|
||||
final DataConnectService _service;
|
||||
|
||||
/// Creates a [CertificatesRepositoryImpl].
|
||||
CertificatesRepositoryImpl() : _service = DataConnectService.instance;
|
||||
/// The Data Connect service instance.
|
||||
final DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<List<domain.StaffDocument>> getCertificates() async {
|
||||
@@ -22,7 +23,7 @@ class CertificatesRepositoryImpl
|
||||
final String staffId = await _service.getStaffId();
|
||||
|
||||
// Execute the query via DataConnect generated SDK
|
||||
final result =
|
||||
final QueryResult<ListStaffDocumentsByStaffIdData, ListStaffDocumentsByStaffIdVariables> result =
|
||||
await _service.connector
|
||||
.listStaffDocumentsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
|
||||
@@ -7,12 +7,12 @@ import '../repositories/certificates_repository.dart';
|
||||
/// Delegates the data retrieval to the [CertificatesRepository].
|
||||
/// Follows the strict one-to-one mapping between action and use case.
|
||||
class GetCertificatesUseCase extends NoInputUseCase<List<StaffDocument>> {
|
||||
final CertificatesRepository _repository;
|
||||
|
||||
/// Creates a [GetCertificatesUseCase].
|
||||
///
|
||||
/// Requires a [CertificatesRepository] to access the certificates data source.
|
||||
GetCertificatesUseCase(this._repository);
|
||||
final CertificatesRepository _repository;
|
||||
|
||||
@override
|
||||
Future<List<StaffDocument>> call() {
|
||||
|
||||
@@ -6,12 +6,12 @@ import 'certificates_state.dart';
|
||||
|
||||
class CertificatesCubit extends Cubit<CertificatesState>
|
||||
with BlocErrorHandler<CertificatesState> {
|
||||
final GetCertificatesUseCase _getCertificatesUseCase;
|
||||
|
||||
CertificatesCubit(this._getCertificatesUseCase)
|
||||
: super(const CertificatesState()) {
|
||||
loadCertificates();
|
||||
}
|
||||
final GetCertificatesUseCase _getCertificatesUseCase;
|
||||
|
||||
Future<void> loadCertificates() async {
|
||||
emit(state.copyWith(status: CertificatesStatus.loading));
|
||||
|
||||
@@ -4,15 +4,15 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
enum CertificatesStatus { initial, loading, success, failure }
|
||||
|
||||
class CertificatesState extends Equatable {
|
||||
final CertificatesStatus status;
|
||||
final List<StaffDocument> certificates;
|
||||
final String? errorMessage;
|
||||
|
||||
const CertificatesState({
|
||||
this.status = CertificatesStatus.initial,
|
||||
List<StaffDocument>? certificates,
|
||||
this.errorMessage,
|
||||
}) : certificates = certificates ?? const <StaffDocument>[];
|
||||
final CertificatesStatus status;
|
||||
final List<StaffDocument> certificates;
|
||||
final String? errorMessage;
|
||||
|
||||
CertificatesState copyWith({
|
||||
CertificatesStatus? status,
|
||||
@@ -27,11 +27,11 @@ class CertificatesState extends Equatable {
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [status, certificates, errorMessage];
|
||||
List<Object?> get props => <Object?>[status, certificates, errorMessage];
|
||||
|
||||
/// The number of verified certificates.
|
||||
int get completedCount => certificates
|
||||
.where((doc) => doc.status == DocumentStatus.verified)
|
||||
.where((StaffDocument doc) => doc.status == DocumentStatus.verified)
|
||||
.length;
|
||||
|
||||
/// The total number of certificates.
|
||||
|
||||
@@ -3,9 +3,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
|
||||
class AddCertificateCard extends StatelessWidget {
|
||||
final VoidCallback onTap;
|
||||
|
||||
const AddCertificateCard({super.key, required this.onTap});
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,11 +5,6 @@ import 'package:intl/intl.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
class CertificateCard extends StatelessWidget {
|
||||
final StaffDocument document;
|
||||
final VoidCallback? onUpload;
|
||||
final VoidCallback? onEditExpiry;
|
||||
final VoidCallback? onRemove;
|
||||
final VoidCallback? onView;
|
||||
|
||||
const CertificateCard({
|
||||
super.key,
|
||||
@@ -19,6 +14,11 @@ class CertificateCard extends StatelessWidget {
|
||||
this.onRemove,
|
||||
this.onView,
|
||||
});
|
||||
final StaffDocument document;
|
||||
final VoidCallback? onUpload;
|
||||
final VoidCallback? onEditExpiry;
|
||||
final VoidCallback? onRemove;
|
||||
final VoidCallback? onView;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -412,7 +412,7 @@ class CertificateCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
class _CertificateUiProps {
|
||||
_CertificateUiProps(this.icon, this.color);
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
_CertificateUiProps(this.icon, this.color);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,13 @@ import 'package:flutter/material.dart';
|
||||
|
||||
/// Modal for uploading or editing a certificate expiry.
|
||||
class CertificateUploadModal extends StatelessWidget {
|
||||
|
||||
const CertificateUploadModal({
|
||||
super.key,
|
||||
this.document,
|
||||
required this.onSave,
|
||||
required this.onCancel,
|
||||
});
|
||||
/// The document being edited, or null for a new upload.
|
||||
// ignore: unused_field
|
||||
final dynamic
|
||||
@@ -13,13 +20,6 @@ class CertificateUploadModal extends StatelessWidget {
|
||||
final VoidCallback onSave;
|
||||
final VoidCallback onCancel;
|
||||
|
||||
const CertificateUploadModal({
|
||||
super.key,
|
||||
this.document,
|
||||
required this.onSave,
|
||||
required this.onCancel,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -100,7 +100,7 @@ class CertificateUploadModal extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: UiColors.tagActive,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
|
||||
@@ -4,14 +4,14 @@ import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
|
||||
class CertificatesHeader extends StatelessWidget {
|
||||
final int completedCount;
|
||||
final int totalCount;
|
||||
|
||||
const CertificatesHeader({
|
||||
super.key,
|
||||
required this.completedCount,
|
||||
required this.totalCount,
|
||||
});
|
||||
final int completedCount;
|
||||
final int totalCount;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
library staff_certificates;
|
||||
library;
|
||||
|
||||
export 'src/staff_certificates_module.dart';
|
||||
|
||||
@@ -7,21 +7,21 @@ import '../../domain/repositories/documents_repository.dart';
|
||||
/// Implementation of [DocumentsRepository] using Data Connect.
|
||||
class DocumentsRepositoryImpl
|
||||
implements DocumentsRepository {
|
||||
final DataConnectService _service;
|
||||
|
||||
DocumentsRepositoryImpl() : _service = DataConnectService.instance;
|
||||
final DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<List<domain.StaffDocument>> getDocuments() async {
|
||||
return _service.run(() async {
|
||||
final String? staffId = await _service.getStaffId();
|
||||
final String staffId = await _service.getStaffId();
|
||||
|
||||
/// MOCK IMPLEMENTATION
|
||||
/// To be replaced with real data connect query when available
|
||||
return [
|
||||
return <domain.StaffDocument>[
|
||||
domain.StaffDocument(
|
||||
id: 'doc1',
|
||||
staffId: staffId!,
|
||||
staffId: staffId,
|
||||
documentId: 'd1',
|
||||
name: 'Work Permit',
|
||||
description: 'Valid work permit document',
|
||||
@@ -31,7 +31,7 @@ class DocumentsRepositoryImpl
|
||||
),
|
||||
domain.StaffDocument(
|
||||
id: 'doc2',
|
||||
staffId: staffId!,
|
||||
staffId: staffId,
|
||||
documentId: 'd2',
|
||||
name: 'Health and Safety Training',
|
||||
description: 'Certificate of completion for health and safety training',
|
||||
|
||||
@@ -6,9 +6,9 @@ import '../repositories/documents_repository.dart';
|
||||
///
|
||||
/// Delegates to [DocumentsRepository].
|
||||
class GetDocumentsUseCase implements NoInputUseCase<List<StaffDocument>> {
|
||||
final DocumentsRepository _repository;
|
||||
|
||||
GetDocumentsUseCase(this._repository);
|
||||
final DocumentsRepository _repository;
|
||||
|
||||
@override
|
||||
Future<List<StaffDocument>> call() {
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'documents_state.dart';
|
||||
|
||||
class DocumentsCubit extends Cubit<DocumentsState>
|
||||
with BlocErrorHandler<DocumentsState> {
|
||||
final GetDocumentsUseCase _getDocumentsUseCase;
|
||||
|
||||
DocumentsCubit(this._getDocumentsUseCase) : super(const DocumentsState());
|
||||
final GetDocumentsUseCase _getDocumentsUseCase;
|
||||
|
||||
Future<void> loadDocuments() async {
|
||||
emit(state.copyWith(status: DocumentsStatus.loading));
|
||||
|
||||
@@ -4,15 +4,15 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
enum DocumentsStatus { initial, loading, success, failure }
|
||||
|
||||
class DocumentsState extends Equatable {
|
||||
final DocumentsStatus status;
|
||||
final List<StaffDocument> documents;
|
||||
final String? errorMessage;
|
||||
|
||||
const DocumentsState({
|
||||
this.status = DocumentsStatus.initial,
|
||||
List<StaffDocument>? documents,
|
||||
this.errorMessage,
|
||||
}) : documents = documents ?? const <StaffDocument>[];
|
||||
final DocumentsStatus status;
|
||||
final List<StaffDocument> documents;
|
||||
final String? errorMessage;
|
||||
|
||||
DocumentsState copyWith({
|
||||
DocumentsStatus? status,
|
||||
|
||||
@@ -8,11 +8,12 @@ import 'package:core_localization/core_localization.dart';
|
||||
|
||||
import '../blocs/documents/documents_cubit.dart';
|
||||
import '../blocs/documents/documents_state.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import '../widgets/document_card.dart';
|
||||
import '../widgets/documents_progress_card.dart';
|
||||
|
||||
class DocumentsPage extends StatelessWidget {
|
||||
const DocumentsPage({super.key});
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,14 +5,14 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import 'package:core_localization/core_localization.dart';
|
||||
|
||||
class DocumentCard extends StatelessWidget {
|
||||
final StaffDocument document;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const DocumentCard({
|
||||
super.key,
|
||||
required this.document,
|
||||
this.onTap,
|
||||
});
|
||||
final StaffDocument document;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -5,6 +5,13 @@ import 'package:core_localization/core_localization.dart';
|
||||
|
||||
/// A card displaying the overall verification progress of documents.
|
||||
class DocumentsProgressCard extends StatelessWidget {
|
||||
|
||||
const DocumentsProgressCard({
|
||||
super.key,
|
||||
required this.completedCount,
|
||||
required this.totalCount,
|
||||
required this.progress,
|
||||
});
|
||||
/// The number of verified documents.
|
||||
final int completedCount;
|
||||
|
||||
@@ -14,13 +21,6 @@ class DocumentsProgressCard extends StatelessWidget {
|
||||
/// The progress ratio (0.0 to 1.0).
|
||||
final double progress;
|
||||
|
||||
const DocumentsProgressCard({
|
||||
super.key,
|
||||
required this.completedCount,
|
||||
required this.totalCount,
|
||||
required this.progress,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
|
||||
@@ -18,7 +18,7 @@ class StaffDocumentsModule extends Module {
|
||||
void routes(RouteManager r) {
|
||||
r.child(
|
||||
StaffPaths.childRoute(StaffPaths.documents, StaffPaths.documents),
|
||||
child: (_) => DocumentsPage(),
|
||||
child: (_) => const DocumentsPage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
library staff_documents;
|
||||
library;
|
||||
|
||||
export 'src/staff_documents_module.dart';
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
class TaxFormMapper {
|
||||
static TaxForm fromDataConnect(dc.GetTaxFormsByStaffIdTaxForms form) {
|
||||
// Construct the legacy map for the entity
|
||||
final Map<String, dynamic> formData = {
|
||||
final Map<String, dynamic> formData = <String, dynamic>{
|
||||
'firstName': form.firstName,
|
||||
'lastName': form.lastName,
|
||||
'middleInitial': form.mInitial,
|
||||
|
||||
@@ -17,7 +17,7 @@ class TaxFormsRepositoryImpl
|
||||
Future<List<TaxForm>> getTaxForms() async {
|
||||
return _service.run(() async {
|
||||
final String staffId = await _service.getStaffId();
|
||||
final response = await _service.connector
|
||||
final QueryResult<dc.GetTaxFormsByStaffIdData, dc.GetTaxFormsByStaffIdVariables> response = await _service.connector
|
||||
.getTaxFormsByStaffId(staffId: staffId)
|
||||
.execute();
|
||||
|
||||
@@ -39,7 +39,7 @@ class TaxFormsRepositoryImpl
|
||||
}
|
||||
|
||||
if (createdNew) {
|
||||
final response2 =
|
||||
final QueryResult<dc.GetTaxFormsByStaffIdData, dc.GetTaxFormsByStaffIdVariables> response2 =
|
||||
await _service.connector.getTaxFormsByStaffId(staffId: staffId).execute();
|
||||
return response2.data.taxForms
|
||||
.map(TaxFormMapper.fromDataConnect)
|
||||
@@ -115,14 +115,18 @@ class TaxFormsRepositoryImpl
|
||||
|
||||
void _mapCommonFields(
|
||||
dc.UpdateTaxFormVariablesBuilder builder, Map<String, dynamic> data) {
|
||||
if (data.containsKey('firstName'))
|
||||
if (data.containsKey('firstName')) {
|
||||
builder.firstName(data['firstName'] as String?);
|
||||
if (data.containsKey('lastName'))
|
||||
}
|
||||
if (data.containsKey('lastName')) {
|
||||
builder.lastName(data['lastName'] as String?);
|
||||
if (data.containsKey('middleInitial'))
|
||||
}
|
||||
if (data.containsKey('middleInitial')) {
|
||||
builder.mInitial(data['middleInitial'] as String?);
|
||||
if (data.containsKey('otherLastNames'))
|
||||
}
|
||||
if (data.containsKey('otherLastNames')) {
|
||||
builder.oLastName(data['otherLastNames'] as String?);
|
||||
}
|
||||
if (data.containsKey('dob')) {
|
||||
final String dob = data['dob'] as String;
|
||||
// Handle both ISO string and MM/dd/yyyy manual entry
|
||||
@@ -155,14 +159,17 @@ class TaxFormsRepositoryImpl
|
||||
}
|
||||
if (data.containsKey('email')) builder.email(data['email'] as String?);
|
||||
if (data.containsKey('phone')) builder.phone(data['phone'] as String?);
|
||||
if (data.containsKey('address'))
|
||||
if (data.containsKey('address')) {
|
||||
builder.address(data['address'] as String?);
|
||||
if (data.containsKey('aptNumber'))
|
||||
}
|
||||
if (data.containsKey('aptNumber')) {
|
||||
builder.apt(data['aptNumber'] as String?);
|
||||
}
|
||||
if (data.containsKey('city')) builder.city(data['city'] as String?);
|
||||
if (data.containsKey('state')) builder.state(data['state'] as String?);
|
||||
if (data.containsKey('zipCode'))
|
||||
if (data.containsKey('zipCode')) {
|
||||
builder.zipCode(data['zipCode'] as String?);
|
||||
}
|
||||
}
|
||||
|
||||
void _mapI9Fields(
|
||||
@@ -176,16 +183,21 @@ class TaxFormsRepositoryImpl
|
||||
dc.CitizenshipStatus.values.byName(status.toUpperCase()));
|
||||
} catch (_) {}
|
||||
}
|
||||
if (data.containsKey('uscisNumber'))
|
||||
if (data.containsKey('uscisNumber')) {
|
||||
builder.uscis(data['uscisNumber'] as String?);
|
||||
if (data.containsKey('passportNumber'))
|
||||
}
|
||||
if (data.containsKey('passportNumber')) {
|
||||
builder.passportNumber(data['passportNumber'] as String?);
|
||||
if (data.containsKey('countryIssuance'))
|
||||
}
|
||||
if (data.containsKey('countryIssuance')) {
|
||||
builder.countryIssue(data['countryIssuance'] as String?);
|
||||
if (data.containsKey('preparerUsed'))
|
||||
}
|
||||
if (data.containsKey('preparerUsed')) {
|
||||
builder.prepartorOrTranslator(data['preparerUsed'] as bool?);
|
||||
if (data.containsKey('signature'))
|
||||
}
|
||||
if (data.containsKey('signature')) {
|
||||
builder.signature(data['signature'] as String?);
|
||||
}
|
||||
// Note: admissionNumber not in builder based on file read
|
||||
}
|
||||
|
||||
@@ -208,19 +220,23 @@ class TaxFormsRepositoryImpl
|
||||
try {
|
||||
final String status = data['filingStatus'] as String;
|
||||
// Simple mapping assumptions:
|
||||
if (status.contains('single')) builder.marital(dc.MaritalStatus.SINGLE);
|
||||
else if (status.contains('married'))
|
||||
if (status.contains('single')) {
|
||||
builder.marital(dc.MaritalStatus.SINGLE);
|
||||
} else if (status.contains('married'))
|
||||
builder.marital(dc.MaritalStatus.MARRIED);
|
||||
else if (status.contains('head'))
|
||||
builder.marital(dc.MaritalStatus.HEAD);
|
||||
} catch (_) {}
|
||||
}
|
||||
if (data.containsKey('multipleJobs'))
|
||||
if (data.containsKey('multipleJobs')) {
|
||||
builder.multipleJob(data['multipleJobs'] as bool?);
|
||||
if (data.containsKey('qualifyingChildren'))
|
||||
}
|
||||
if (data.containsKey('qualifyingChildren')) {
|
||||
builder.childrens(data['qualifyingChildren'] as int?);
|
||||
if (data.containsKey('otherDependents'))
|
||||
}
|
||||
if (data.containsKey('otherDependents')) {
|
||||
builder.otherDeps(data['otherDependents'] as int?);
|
||||
}
|
||||
if (data.containsKey('otherIncome')) {
|
||||
builder.otherInconme(double.tryParse(data['otherIncome'].toString()));
|
||||
}
|
||||
@@ -231,8 +247,9 @@ class TaxFormsRepositoryImpl
|
||||
builder.extraWithholding(
|
||||
double.tryParse(data['extraWithholding'].toString()));
|
||||
}
|
||||
if (data.containsKey('signature'))
|
||||
if (data.containsKey('signature')) {
|
||||
builder.signature(data['signature'] as String?);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/tax_forms_repository.dart';
|
||||
|
||||
class GetTaxFormsUseCase {
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
GetTaxFormsUseCase(this._repository);
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
Future<List<TaxForm>> call() async {
|
||||
return _repository.getTaxForms();
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/tax_forms_repository.dart';
|
||||
|
||||
class SaveI9FormUseCase {
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
SaveI9FormUseCase(this._repository);
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
Future<void> call(I9TaxForm form) async {
|
||||
return _repository.updateI9Form(form);
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/tax_forms_repository.dart';
|
||||
|
||||
class SaveW4FormUseCase {
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
SaveW4FormUseCase(this._repository);
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
Future<void> call(W4TaxForm form) async {
|
||||
return _repository.updateW4Form(form);
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/tax_forms_repository.dart';
|
||||
|
||||
class SubmitI9FormUseCase {
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
SubmitI9FormUseCase(this._repository);
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
Future<void> call(I9TaxForm form) async {
|
||||
return _repository.submitI9Form(form);
|
||||
|
||||
@@ -2,9 +2,9 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
import '../repositories/tax_forms_repository.dart';
|
||||
|
||||
class SubmitW4FormUseCase {
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
SubmitW4FormUseCase(this._repository);
|
||||
final TaxFormsRepository _repository;
|
||||
|
||||
Future<void> call(W4TaxForm form) async {
|
||||
return _repository.submitW4Form(form);
|
||||
|
||||
@@ -7,10 +7,10 @@ import '../../../domain/usecases/submit_i9_form_usecase.dart';
|
||||
import 'form_i9_state.dart';
|
||||
|
||||
class FormI9Cubit extends Cubit<FormI9State> with BlocErrorHandler<FormI9State> {
|
||||
final SubmitI9FormUseCase _submitI9FormUseCase;
|
||||
String _formId = '';
|
||||
|
||||
FormI9Cubit(this._submitI9FormUseCase) : super(const FormI9State());
|
||||
final SubmitI9FormUseCase _submitI9FormUseCase;
|
||||
String _formId = '';
|
||||
|
||||
void initialize(TaxForm? form) {
|
||||
if (form == null || form.formData.isEmpty) {
|
||||
@@ -99,7 +99,7 @@ class FormI9Cubit extends Cubit<FormI9State> with BlocErrorHandler<FormI9State>
|
||||
await handleError(
|
||||
emit: emit,
|
||||
action: () async {
|
||||
final Map<String, dynamic> formData = {
|
||||
final Map<String, dynamic> formData = <String, dynamic>{
|
||||
'firstName': state.firstName,
|
||||
'lastName': state.lastName,
|
||||
'middleInitial': state.middleInitial,
|
||||
|
||||
@@ -3,6 +3,32 @@ import 'package:equatable/equatable.dart';
|
||||
enum FormI9Status { initial, submitting, success, failure }
|
||||
|
||||
class FormI9State extends Equatable {
|
||||
|
||||
const FormI9State({
|
||||
this.currentStep = 0,
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.middleInitial = '',
|
||||
this.otherLastNames = '',
|
||||
this.dob = '',
|
||||
this.ssn = '',
|
||||
this.email = '',
|
||||
this.phone = '',
|
||||
this.address = '',
|
||||
this.aptNumber = '',
|
||||
this.city = '',
|
||||
this.state = '',
|
||||
this.zipCode = '',
|
||||
this.citizenshipStatus = '',
|
||||
this.uscisNumber = '',
|
||||
this.admissionNumber = '',
|
||||
this.passportNumber = '',
|
||||
this.countryIssuance = '',
|
||||
this.preparerUsed = false,
|
||||
this.signature = '',
|
||||
this.status = FormI9Status.initial,
|
||||
this.errorMessage,
|
||||
});
|
||||
final int currentStep;
|
||||
// Personal Info
|
||||
final String firstName;
|
||||
@@ -35,32 +61,6 @@ class FormI9State extends Equatable {
|
||||
final FormI9Status status;
|
||||
final String? errorMessage;
|
||||
|
||||
const FormI9State({
|
||||
this.currentStep = 0,
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.middleInitial = '',
|
||||
this.otherLastNames = '',
|
||||
this.dob = '',
|
||||
this.ssn = '',
|
||||
this.email = '',
|
||||
this.phone = '',
|
||||
this.address = '',
|
||||
this.aptNumber = '',
|
||||
this.city = '',
|
||||
this.state = '',
|
||||
this.zipCode = '',
|
||||
this.citizenshipStatus = '',
|
||||
this.uscisNumber = '',
|
||||
this.admissionNumber = '',
|
||||
this.passportNumber = '',
|
||||
this.countryIssuance = '',
|
||||
this.preparerUsed = false,
|
||||
this.signature = '',
|
||||
this.status = FormI9Status.initial,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
FormI9State copyWith({
|
||||
int? currentStep,
|
||||
String? firstName,
|
||||
@@ -114,7 +114,7 @@ class FormI9State extends Equatable {
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
currentStep,
|
||||
firstName,
|
||||
lastName,
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'tax_forms_state.dart';
|
||||
|
||||
class TaxFormsCubit extends Cubit<TaxFormsState>
|
||||
with BlocErrorHandler<TaxFormsState> {
|
||||
final GetTaxFormsUseCase _getTaxFormsUseCase;
|
||||
|
||||
TaxFormsCubit(this._getTaxFormsUseCase) : super(const TaxFormsState());
|
||||
final GetTaxFormsUseCase _getTaxFormsUseCase;
|
||||
|
||||
Future<void> loadTaxForms() async {
|
||||
emit(state.copyWith(status: TaxFormsStatus.loading));
|
||||
|
||||
@@ -4,15 +4,15 @@ import 'package:krow_domain/krow_domain.dart';
|
||||
enum TaxFormsStatus { initial, loading, success, failure }
|
||||
|
||||
class TaxFormsState extends Equatable {
|
||||
final TaxFormsStatus status;
|
||||
final List<TaxForm> forms;
|
||||
final String? errorMessage;
|
||||
|
||||
const TaxFormsState({
|
||||
this.status = TaxFormsStatus.initial,
|
||||
this.forms = const <TaxForm>[],
|
||||
this.errorMessage,
|
||||
});
|
||||
final TaxFormsStatus status;
|
||||
final List<TaxForm> forms;
|
||||
final String? errorMessage;
|
||||
|
||||
TaxFormsState copyWith({
|
||||
TaxFormsStatus? status,
|
||||
|
||||
@@ -7,10 +7,10 @@ import '../../../domain/usecases/submit_w4_form_usecase.dart';
|
||||
import 'form_w4_state.dart';
|
||||
|
||||
class FormW4Cubit extends Cubit<FormW4State> with BlocErrorHandler<FormW4State> {
|
||||
final SubmitW4FormUseCase _submitW4FormUseCase;
|
||||
String _formId = '';
|
||||
|
||||
FormW4Cubit(this._submitW4FormUseCase) : super(const FormW4State());
|
||||
final SubmitW4FormUseCase _submitW4FormUseCase;
|
||||
String _formId = '';
|
||||
|
||||
void initialize(TaxForm? form) {
|
||||
if (form == null || form.formData.isEmpty) {
|
||||
@@ -92,7 +92,7 @@ class FormW4Cubit extends Cubit<FormW4State> with BlocErrorHandler<FormW4State>
|
||||
await handleError(
|
||||
emit: emit,
|
||||
action: () async {
|
||||
final Map<String, dynamic> formData = {
|
||||
final Map<String, dynamic> formData = <String, dynamic>{
|
||||
'firstName': state.firstName,
|
||||
'lastName': state.lastName,
|
||||
'ssn': state.ssn,
|
||||
|
||||
@@ -3,6 +3,25 @@ import 'package:equatable/equatable.dart';
|
||||
enum FormW4Status { initial, submitting, success, failure }
|
||||
|
||||
class FormW4State extends Equatable {
|
||||
|
||||
const FormW4State({
|
||||
this.currentStep = 0,
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.ssn = '',
|
||||
this.address = '',
|
||||
this.cityStateZip = '',
|
||||
this.filingStatus = '',
|
||||
this.multipleJobs = false,
|
||||
this.qualifyingChildren = 0,
|
||||
this.otherDependents = 0,
|
||||
this.otherIncome = '',
|
||||
this.deductions = '',
|
||||
this.extraWithholding = '',
|
||||
this.signature = '',
|
||||
this.status = FormW4Status.initial,
|
||||
this.errorMessage,
|
||||
});
|
||||
final int currentStep;
|
||||
|
||||
// Personal Info
|
||||
@@ -29,25 +48,6 @@ class FormW4State extends Equatable {
|
||||
final FormW4Status status;
|
||||
final String? errorMessage;
|
||||
|
||||
const FormW4State({
|
||||
this.currentStep = 0,
|
||||
this.firstName = '',
|
||||
this.lastName = '',
|
||||
this.ssn = '',
|
||||
this.address = '',
|
||||
this.cityStateZip = '',
|
||||
this.filingStatus = '',
|
||||
this.multipleJobs = false,
|
||||
this.qualifyingChildren = 0,
|
||||
this.otherDependents = 0,
|
||||
this.otherIncome = '',
|
||||
this.deductions = '',
|
||||
this.extraWithholding = '',
|
||||
this.signature = '',
|
||||
this.status = FormW4Status.initial,
|
||||
this.errorMessage,
|
||||
});
|
||||
|
||||
FormW4State copyWith({
|
||||
int? currentStep,
|
||||
String? firstName,
|
||||
@@ -89,7 +89,7 @@ class FormW4State extends Equatable {
|
||||
int get totalCredits => (qualifyingChildren * 2000) + (otherDependents * 500);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
List<Object?> get props => <Object?>[
|
||||
currentStep,
|
||||
firstName,
|
||||
lastName,
|
||||
|
||||
@@ -9,8 +9,8 @@ import '../blocs/i9/form_i9_cubit.dart';
|
||||
import '../blocs/i9/form_i9_state.dart';
|
||||
|
||||
class FormI9Page extends StatefulWidget {
|
||||
final TaxForm? form;
|
||||
const FormI9Page({super.key, this.form});
|
||||
final TaxForm? form;
|
||||
|
||||
@override
|
||||
State<FormI9Page> createState() => _FormI9PageState();
|
||||
@@ -77,7 +77,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.i9;
|
||||
final TranslationsStaffComplianceTaxFormsI9En i18n = Translations.of(context).staff_compliance.tax_forms.i9;
|
||||
|
||||
final List<Map<String, String>> steps = <Map<String, String>>[
|
||||
<String, String>{'title': i18n.steps.personal, 'subtitle': i18n.steps.personal_sub},
|
||||
@@ -150,7 +150,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
Container(
|
||||
width: 64,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: UiColors.tagSuccess,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@@ -507,7 +507,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
),
|
||||
const SizedBox(height: UiConstants.space1 + 2),
|
||||
DropdownButtonFormField<String>(
|
||||
value: state.state.isEmpty ? null : state.state,
|
||||
initialValue: state.state.isEmpty ? null : state.state,
|
||||
onChanged: (String? val) =>
|
||||
context.read<FormI9Cubit>().stateChanged(val ?? ''),
|
||||
items: _usStates.map((String stateAbbr) {
|
||||
@@ -828,7 +828,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
}
|
||||
|
||||
String _getReadableCitizenship(String status) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.i9.fields;
|
||||
final TranslationsStaffComplianceTaxFormsI9FieldsEn i18n = Translations.of(context).staff_compliance.tax_forms.i9.fields;
|
||||
switch (status) {
|
||||
case 'CITIZEN':
|
||||
return i18n.status_us_citizen;
|
||||
@@ -848,7 +848,7 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
FormI9State state,
|
||||
List<Map<String, String>> steps,
|
||||
) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.i9;
|
||||
final TranslationsStaffComplianceTaxFormsI9En i18n = Translations.of(context).staff_compliance.tax_forms.i9;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
|
||||
@@ -9,8 +9,8 @@ import '../blocs/w4/form_w4_cubit.dart';
|
||||
import '../blocs/w4/form_w4_state.dart';
|
||||
|
||||
class FormW4Page extends StatefulWidget {
|
||||
final TaxForm? form;
|
||||
const FormW4Page({super.key, this.form});
|
||||
final TaxForm? form;
|
||||
|
||||
@override
|
||||
State<FormW4Page> createState() => _FormW4PageState();
|
||||
@@ -123,7 +123,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.w4;
|
||||
final TranslationsStaffComplianceTaxFormsW4En i18n = Translations.of(context).staff_compliance.tax_forms.w4;
|
||||
|
||||
final List<Map<String, String>> steps = <Map<String, String>>[
|
||||
<String, String>{'title': i18n.steps.personal, 'subtitle': i18n.step_label(current: '1', total: '5')},
|
||||
@@ -198,7 +198,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
Container(
|
||||
width: 64,
|
||||
height: 64,
|
||||
decoration: BoxDecoration(
|
||||
decoration: const BoxDecoration(
|
||||
color: UiColors.tagSuccess,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
@@ -1065,7 +1065,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
}
|
||||
|
||||
String _getFilingStatusLabel(String status) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.w4.fields;
|
||||
final TranslationsStaffComplianceTaxFormsW4FieldsEn i18n = Translations.of(context).staff_compliance.tax_forms.w4.fields;
|
||||
switch (status) {
|
||||
case 'SINGLE':
|
||||
return i18n.status_single;
|
||||
@@ -1083,7 +1083,7 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
FormW4State state,
|
||||
List<Map<String, String>> steps,
|
||||
) {
|
||||
final i18n = Translations.of(context).staff_compliance.tax_forms.w4;
|
||||
final TranslationsStaffComplianceTaxFormsW4En i18n = Translations.of(context).staff_compliance.tax_forms.w4;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
|
||||
@@ -150,12 +150,12 @@ class TaxFormsPage extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: () async {
|
||||
if (form is I9TaxForm) {
|
||||
final result = await Modular.to.pushNamed('i9', arguments: form);
|
||||
final Object? result = await Modular.to.pushNamed('i9', arguments: form);
|
||||
if (result == true && context.mounted) {
|
||||
await BlocProvider.of<TaxFormsCubit>(context).loadTaxForms();
|
||||
}
|
||||
} else if (form is W4TaxForm) {
|
||||
final result = await Modular.to.pushNamed('w4', arguments: form);
|
||||
final Object? result = await Modular.to.pushNamed('w4', arguments: form);
|
||||
if (result == true && context.mounted) {
|
||||
await BlocProvider.of<TaxFormsCubit>(context).loadTaxForms();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
library staff_tax_forms;
|
||||
library;
|
||||
|
||||
export 'src/staff_tax_forms_module.dart';
|
||||
|
||||
Reference in New Issue
Block a user