Commit Graph

858 Commits

Author SHA1 Message Date
Achintha Isuru
493891eea0 Add staff reliability stats & shift location
Introduce staff reliability statistics and location fields across domain, data, and UI. Changes include:

- New API endpoint StaffEndpoints.profileStats ('/staff/profile/stats').
- New domain entity StaffReliabilityStats with JSON (de)serialization and export.
- Profile repository: getReliabilityStats implementation and interface addition.
- New GetReliabilityStatsUseCase and DI registration in StaffProfileModule.
- ProfileCubit/state: load and store reliabilityStats; UI wired to display ReliabilityStatsCard and ReliabilityScoreBar using state values.
- Coverage/shift updates: Added AssignedWorker.hasReview to track if a worker was reviewed; added locationName/locationAddress to ShiftWithWorkers and show location in ShiftHeader; hide rate button if worker.hasReview.
- Clock-in handling: treat backend ALREADY_CLOCKED_IN (409) as idempotent by re-fetching attendance and emitting success when appropriate.

These changes wire backend stats through repository/usecase/cubit to the profile UI and add shift location and review-awareness to client views.
2026-03-19 10:53:37 -04:00
Achintha Isuru
843eec5692 feat: Refactor context reading in emergency contact and FAQs widgets
- Updated the context reading method in `EmergencyContactAddButton` and `EmergencyContactFormItem` to use `ReadContext`.
- Modified the `FaqsWidget` to utilize `ReadContext` for fetching FAQs.
- Adjusted the `PrivacySectionWidget` to read from `PrivacySecurityBloc` using `ReadContext`.

feat: Implement Firebase Auth isolation pattern

- Introduced `FirebaseAuthService` and `FirebaseAuthServiceImpl` to abstract Firebase Auth operations.
- Ensured features do not directly import `firebase_auth`, adhering to architecture rules.

feat: Create repository interfaces for billing and coverage

- Added `BillingRepositoryInterface` for billing-related operations.
- Created `CoverageRepositoryInterface` for coverage data access.

feat: Add use cases for order management

- Implemented use cases for fetching hubs, managers, and roles related to orders.
- Created `GetHubsUseCase`, `GetManagersByHubUseCase`, and `GetRolesByVendorUseCase`.

feat: Develop report use cases for client reports

- Added use cases for fetching various reports including coverage, daily operations, forecast, no-show, performance, and spend reports.
- Implemented `GetCoverageReportUseCase`, `GetDailyOpsReportUseCase`, `GetForecastReportUseCase`, `GetNoShowReportUseCase`, `GetPerformanceReportUseCase`, and `GetSpendReportUseCase`.

feat: Establish profile repository and use cases

- Created `ProfileRepositoryInterface` for staff profile data access.
- Implemented use cases for retrieving staff profile and section statuses: `GetStaffProfileUseCase` and `GetProfileSectionsUseCase`.
- Added `SignOutUseCase` for signing out the current user.
2026-03-19 01:10:27 -04:00
Achintha Isuru
499dceda37 fix(coverage_shift_list): update cancel button visibility logic based on shift start time 2026-03-19 00:31:33 -04:00
Achintha Isuru
c8f944e1ac style(shift_header): improve layout and styling of shift header components 2026-03-19 00:27:42 -04:00
Achintha Isuru
af1ff53749 fix(worker_row): correct condition for displaying cancel button 2026-03-19 00:19:18 -04:00
Achintha Isuru
8bb336d1b5 Refactor coverage-related widgets and improve UI consistency
- Updated CancelLateWorkerSheet to enhance layout and information display.
- Modified CoverageCalendarSelector to adjust color opacity for better visibility.
- Simplified CoveragePageSkeleton by removing unused quick stats row.
- Removed CoverageQuickStats widget as it was redundant.
- Enhanced CoverageShiftList to manage expanded state and improve worker display.
- Deleted CoverageStatCard as its functionality is no longer needed.
- Revamped CoverageStatsHeader to provide a clearer overview of coverage statistics.
- Improved LateWorkersAlert for better visual feedback on late workers.
- Redesigned ShiftHeader for a more interactive and informative shift card.
- Updated WorkerRow to streamline status display and action buttons.
2026-03-19 00:12:35 -04:00
Achintha Isuru
b317c53e7e feat(review): implement worker review functionality with rating, feedback, and issue flags 2026-03-18 19:01:51 -04:00
Achintha Isuru
2d452f65e6 feat(geofence): enhance geofence handling with improved messaging and justification for clock-out 2026-03-18 18:30:15 -04:00
Achintha Isuru
f488577e6b feat(geofence): add OutsideWorkAreaBanner for non-blocking warning when clocked in outside geofence 2026-03-18 18:02:17 -04:00
Achintha Isuru
baf426935e feat(shift): enhance Shift entity with client and role names, update JSON deserialization 2026-03-18 17:56:48 -04:00
Achintha Isuru
f5699865f9 feat(benefit_history): enhance layout of benefit history row with improved structure and styling 2026-03-18 17:45:42 -04:00
Achintha Isuru
597866fc99 feat(benefit_history): add spacing to benefit history preview layout 2026-03-18 17:38:48 -04:00
Achintha Isuru
8d39ebbced feat(benefit_history): refactor benefit history page with new components and improved loading states 2026-03-18 17:37:38 -04:00
Achintha Isuru
9039aa63d6 feat: add benefit history feature with lazy loading and pagination
- Implemented `getBenefitsHistory` method in `HomeRepository` to retrieve paginated benefit history.
- Enhanced `BenefitsOverviewCubit` to manage loading and displaying benefit history.
- Created `BenefitHistoryPage` for full-screen display of benefit history with infinite scroll support.
- Added `BenefitHistoryPreview` widget for expandable history preview in benefit cards.
- Introduced `BenefitHistoryRow` to display individual history records.
- Updated `BenefitsOverviewState` to include history management fields.
- Added new entities and use cases for handling benefit history.
- Created design system documentation for UI patterns and known gaps.
2026-03-18 17:21:30 -04:00
Achintha Isuru
1552f60e5b feat(clock_in): add messages for already clocked in/out states and handle API call failures 2026-03-18 16:37:59 -04:00
Achintha Isuru
d13cabb30d Round accuracyMeters before serialization
Round accuracyMeters to an integer when building payloads to ensure consistent, integer accuracy values sent to the backend. Updates made in background_geofence_service.dart (location.accuracy.round()) and in ClockInArguments/ClockOutArguments (round accuracyMeters when present) so nullable values are rounded before serialization.
2026-03-18 16:31:12 -04:00
Achintha Isuru
18b74473dc feat(time_card): refactor TimeCardPage to use StatelessWidget and optimize Bloc initialization
feat(time_card): change GetTimeCardsUseCase to lazy singleton in StaffTimeCardModule
feat(clock_in): update use cases to lazy singleton in StaffClockInModule
2026-03-18 16:01:41 -04:00
Achintha Isuru
f70bdc4fca feat(shifts): add client name support in OpenShift and RecommendedShiftCard 2026-03-18 15:58:58 -04:00
Achintha Isuru
3f42014cb9 feat(shifts): refactor shift card implementation for today's and tomorrow's shifts 2026-03-18 15:56:20 -04:00
Achintha Isuru
47508f54e4 feat(shifts): enhance TodayShift and shift card components with client details and pay calculations 2026-03-18 15:39:05 -04:00
Achintha Isuru
77f8b8511c Add submitting state to shift approval UI
Add a submitting state to the shift approval flow: include new "submitting" strings in English and Spanish localization files; thread submittingShiftId from ShiftsPage into MyShiftsTab and HistoryShiftsTab and compute per-shift isSubmitting; add isSubmitting prop to ShiftCard and ShiftCardApprovalFooter. When a shift is being submitted the footer shows "SUBMITTING..." and a small CircularProgressIndicator instead of the submit button.
2026-03-18 15:26:53 -04:00
Achintha Isuru
b9d64bd53b Refactor Shift Card Implementation
- Updated import paths for shift card components to use a centralized index file.
- Introduced a new ShiftCard widget that consolidates the functionality of previous card implementations.
- Created individual files for shift card components: ShiftCard, ShiftCardBody, ShiftCardApprovalFooter, ShiftCardPendingFooter, ShiftCardStatusBadge, ShiftCardMetadataRows, ShiftCardTitleRow, and ShiftCardData.
- Enhanced ShiftCard to handle various shift types (confirmed, pending, cancelled, completed, checked-in, swap requested) through a unified data model.
- Improved UI consistency and maintainability by separating concerns into distinct widgets.
2026-03-18 15:18:27 -04:00
Achintha Isuru
e7b5cb33a4 feat(upload): enhance PDF upload banners with title and description 2026-03-18 15:06:06 -04:00
Achintha Isuru
0c8a5bb15b Support reusing existing certificate file URI
Allow uploading or updating certificates without forcing a re-upload of an already-stored file. Repository API now accepts an optional filePath or existingFileUri and branches: a new local file is uploaded and a signed URL generated, while an existingFileUri performs a metadata-only update. Verification creation now uses the resolved fileUri; API payload uses the signed URL when available and normalizes expiry to UTC. Domain usecase and params were updated (with an assert ensuring one of filePath or existingFileUri is provided). Presentation page pre-populates the file field for edits, relaxes form validation to accept existing remote URIs, and distinguishes local vs remote paths when invoking the upload use case.
2026-03-18 14:59:04 -04:00
Achintha Isuru
3a5f2cc9c6 feat(shifts): implement submit for approval functionality
- Added `submitForApproval` method to `ShiftsRepositoryInterface` and its implementation in `ShiftsRepositoryImpl`.
- Created `SubmitForApprovalUseCase` to handle the submission logic.
- Updated `ShiftsBloc` to handle `SubmitForApprovalEvent` and manage submission state.
- Enhanced `HistoryShiftsTab` and `MyShiftsTab` to support submission actions and display appropriate UI feedback.
- Refactored date utilities for better calendar management and filtering of past shifts.
- Improved UI components for better spacing and alignment.
- Localized success messages for shift submission actions.
2026-03-18 14:37:55 -04:00
Achintha Isuru
3e5b6af8dc Refactor widgets, add bloc dep
Clean up widget code and update a dependency:

- Remove redundant const qualifiers and tidy widget children in several skeleton/header widgets for consistent style.
- Add super.key to TaxFormsProgressOverview, TaxFormStatusBadge, and AccountCard constructors.
- Simplify AccountCard by consolidating its constructor into a single const declaration.
- Minor fixes: adjust Image.onError parameter, reformat CircleAvatar/Icon construction in edit_profile_page.
- Add bloc ^8.1.4 to staff/authentication pubspec.

These changes are stylistic and aim to improve consistency and constructor patterns across the codebase.
2026-03-18 10:33:19 -04:00
Achintha Isuru
9ee8467632 Refactor widgets & imports; add krow_domain
Add local krow_domain dependency to client, staff apps and client home package. Numerous UI/widget cleanups across features: add const where applicable, use explicit List<Widget> types and List<Widget>.generate, add super.key to constructors, tighten BlocProvider generics, replace some Containers with SizedBox, and simplify InputDecoration/Border constructors. Fix API error handler to return a const UnknownException. Update internal imports to package-style paths (staff_home, staff_payments, staff_main repository interface) and normalize Flutter imports (use material.dart). Add missing braces for early returns in tax form pages. Mostly formatting and small API/typing refactors with no behavioral changes intended.
2026-03-18 10:27:31 -04:00
Achintha Isuru
e471fd12f2 Merge branch 'dev' into 592-migrate-frontend-applications-to-v2-backend-and-database 2026-03-18 10:06:54 -04:00
zouantchaw
1d850811c4 chore(legacy): relocate v1 dataconnect source 2026-03-18 15:04:18 +01:00
Achintha Isuru
c9f7e41cbe refactor(skeletons): update children type annotations and improve consistency in skeleton widgets 2026-03-18 10:01:23 -04:00
Achintha Isuru
0b5254311d feat(api): update DeviceLocation model and clean up AuthRepositoryImpl and BillingPageSkeleton 2026-03-18 10:00:27 -04:00
Achintha Isuru
2c7094bb54 feat: load assigned, pending, and cancelled shifts in parallel for improved performance 2026-03-17 16:18:45 -04:00
Achintha Isuru
42945b3b60 feat: update ReorderWidget layout for responsive design; adjust item dimensions based on screen size 2026-03-17 15:15:18 -04:00
Achintha Isuru
1252211a12 fix: correct clock-in validation logic to check for too early time 2026-03-17 15:03:08 -04:00
Achintha Isuru
cfe8c0bc6c feat: update certificate card to display issuer name if available 2026-03-17 14:55:10 -04:00
Achintha Isuru
a12539ba07 feat: normalize user ID in auth envelope and update hub manager assignment logic 2026-03-17 14:47:01 -04:00
Achintha Isuru
e2d833dc58 feat: update UiNoticeBanner layout; align children to start and adjust description color 2026-03-17 14:37:56 -04:00
Achintha Isuru
de388c9a77 feat: update profile setup and bank account management; enhance API integration and data handling 2026-03-17 14:32:26 -04:00
Achintha Isuru
b6a655a261 feat: enhance API error handling and response structure; introduce ApiException for V2 error codes 2026-03-17 14:15:26 -04:00
Achintha Isuru
d6ddb7829e fix: change saveContacts method to use POST instead of PUT for emergency contacts 2026-03-17 14:00:41 -04:00
Achintha Isuru
e1d30c124b feat: migrate experience management to V2 API; add support for industries and skills 2026-03-17 13:44:48 -04:00
Achintha Isuru
e83b8fff1c refactor: update color definitions and improve UI component structure; handle null safety in repository data fetching 2026-03-17 13:20:04 -04:00
Achintha Isuru
a0d5a18e6f Refactor shift history and my shifts tabs to use a unified ShiftCard widget
- Introduced ShiftCard widget to standardize the display of shift information across different states (assigned, completed, cancelled, pending).
- Removed redundant card implementations (_CompletedShiftCard, MyShiftCard, ShiftAssignmentCard) and replaced them with ShiftCard.
- Updated localization for empty states and shift titles in HistoryShiftsTab and MyShiftsTab.
- Enhanced MyShiftsTab to track submitted shifts locally and show appropriate actions based on shift status.
- Added meta package dependency for improved type annotations.
2026-03-17 13:08:32 -04:00
Achintha Isuru
020c785b6f Cancel background tasks and clear feature scopes
Ensure sign-out cleans up background work and feature state: import BackgroundTaskService and FeatureGate, invoke BackgroundTaskService.cancelAll() inside a try/catch in the sign-out finally block, and call FeatureGate.instance.clearScopes(). Existing client/staff session clearing and handleSignOut() are preserved.
2026-03-17 12:22:09 -04:00
Achintha Isuru
730b298d49 fix: correct time comparison logic in clock-in validation 2026-03-17 12:17:31 -04:00
Achintha Isuru
d12b45a37d Expose parseDouble; fix shift mapping and UI
Rename and expose numeric parser (from _parseDouble to parseDouble) with a doc comment so other modules can reuse it. Update ClockIn repository mapping to populate orderId and prefer clientName for the shift title, and map latitude/longitude using Shift.parseDouble. Remove outdated TODOs and remove the selected/today badge text from the shift card UI. These changes consolidate parsing logic, improve today-shift mapping fidelity, and simplify the shift card display.
2026-03-17 12:14:14 -04:00
Achintha Isuru
376b4e4431 feat: Update API endpoint usage in repositories to remove redundant path property
- Refactored multiple repository implementations across client and staff features to directly use endpoint objects without accessing the `path` property.
- Introduced a new `FeatureGate` class for client-side feature gating based on user scopes, allowing for better access control to API endpoints.
- Added `ApiEndpoint` class to represent API endpoints with their paths and required scopes for future feature gating.
2026-03-17 12:01:06 -04:00
Achintha Isuru
57bba8ab4e Refactor API endpoint usage across multiple repositories to use ClientEndpoints and StaffEndpoints
- Updated ClientOrderQueryRepositoryImpl to replace V2ApiEndpoints with ClientEndpoints for vendor, role, hub, and manager retrieval methods.
- Modified ViewOrdersRepositoryImpl to utilize ClientEndpoints for order viewing, editing, and vendor retrieval.
- Refactored ReportsRepositoryImpl to switch from V2ApiEndpoints to ClientEndpoints for various report fetching methods.
- Changed SettingsRepositoryImpl to use AuthEndpoints for sign-out functionality.
- Adjusted AuthRepositoryImpl to replace V2ApiEndpoints with AuthEndpoints for phone authentication and sign-out processes.
- Updated ProfileSetupRepositoryImpl to utilize StaffEndpoints for profile setup.
- Refactored AvailabilityRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for availability management.
- Changed ClockInRepositoryImpl to use StaffEndpoints for clock-in and clock-out functionalities.
- Updated HomeRepositoryImpl to replace V2ApiEndpoints with StaffEndpoints for dashboard and profile completion retrieval.
- Refactored PaymentsRepositoryImpl to utilize StaffEndpoints for payment summaries and history.
- Changed ProfileRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for staff profile and section status retrieval.
- Updated CertificatesRepositoryImpl to use StaffEndpoints for certificate management.
- Refactored DocumentsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for document management.
- Changed TaxFormsRepositoryImpl to utilize StaffEndpoints for tax form management.
- Updated BankAccountRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for bank account management.
- Refactored TimeCardRepositoryImpl to use StaffEndpoints for time card retrieval.
- Changed AttireRepositoryImpl to utilize StaffEndpoints for attire management.
- Updated EmergencyContactRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for emergency contact management.
- Refactored ExperienceRepositoryImpl to use StaffEndpoints for industry and skill retrieval.
- Changed PersonalInfoRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for personal information management.
- Updated FaqsRepositoryImpl to utilize StaffEndpoints for FAQs retrieval.
- Refactored PrivacySettingsRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for privacy settings management.
- Changed ShiftsRepositoryImpl to use StaffEndpoints for shift management and retrieval.
- Updated StaffMainRepositoryImpl to switch from V2ApiEndpoints to StaffEndpoints for profile completion checks.
2026-03-17 11:40:15 -04:00
Achintha Isuru
31231c1e6d feat(api): refactor API endpoints to use structured ApiEndpoint class and introduce new endpoint files 2026-03-17 11:26:44 -04:00
Achintha Isuru
eccd2c6dbd Use UserRole enum for session role handling
Replace string-based role handling with a typed UserRole enum. Adds src/entities/enums/user_role.dart and exports it from krow_domain. Update SessionHandlerMixin to use List<UserRole> and change fetchUserRole to return UserRole?. V2SessionService now derives the role via UserRole.fromSessionData, and client/staff SessionListener widgets pass const <UserRole>[...] when initializing the auth listener. This centralizes role derivation and eliminates scattered role string literals.
2026-03-17 11:19:54 -04:00