How ash469/pims-leave-app works
Purpose and Runtime
PIMS is a Flutter client for institutional leave management across student, parent, warden, and guard roles. It targets Android, iOS, web, Linux, macOS, and Windows; the operational product is primarily a mobile workflow. Flutter starts from lib/main.dart, with platform host bootstraps such as android/app/src/main/kotlin/com/pims/pims_app/MainActivity.kt and ios/Runner/AppDelegate.swift.
Application Composition and Navigation
The UI is organized as role-specific screens rather than feature modules. Initial role choice and Google login determine the active dashboard, then each role reaches its permitted workflow.
• Entry/access: lib/main.dart, lib/screens/role_selection_screen.dart, lib/screens/login_screen.dart
• Dashboards: lib/screens/student_dashboard_screen.dart, lib/screens/parent_dashboard_screen.dart, lib/screens/warden_dashboard_screen.dart
• Guard operations: lib/screens/guard_dashboard_screen.dart, lib/screens/raise_concern_screen.dart, lib/screens/qr_scanner_screen.dart
Identity and Authorization Boundary
Authentication is Firebase Authentication with Google Sign-In; application role authorization is implied by the login and backend/service layer rather than by separate client applications. Firebase initialization/configuration is held in lib/firebase_options.dart; authentication calls are centralized in lib/services/auth_service.dart. Native Firebase credentials exist for iOS at ios/Runner/GoogleService-Info.plist; Android requires its equivalent deployment configuration.
Leave Lifecycle
The core domain flow is: student creates a leave request, parent performs first approval, warden performs final approval, and approved leave information becomes available for gate validation. Shared domain entities are defined in lib/models/data_models.dart; mutations and retrieval flow through lib/services/leave_service.dart. Role-specific processing is exposed through lib/services/parent_service.dart and lib/services/warden_service.dart, with UI stages in lib/screens/leave_request_screen.dart and lib/screens/leave_details_screen.dart.
Gate Verification and Concerns
Approved leaves generate QR-based credentials. Guards scan them to mark departure/return, placing the scanner at a trust boundary between a presented code and server-side leave status. Scanner UI/rendering is in lib/screens/qr_scanner_screen.dart, lib/widgets/qr_scan_body.dart, and lib/helpers/qr_handler.dart. Guard-raised issues, optionally with attachments, are handled through lib/screens/raise_concern_screen.dart and lib/services/concern_service.dart.
Notifications and Local Behavior
Leave-state changes are surfaced through in-app notifications and Firebase Cloud Messaging. FCM integration is centralized in lib/services/fcm_service.dart; notification data/UI is handled by lib/services/notification_service.dart and lib/screens/notifications_screen.dart. The README states offline persistence, though the concrete storage implementation is not identifiable from the provided tree.
External Systems and Delivery
The Flutter client calls a Node.js API hosted on Render, which persists operational data in MongoDB; neither backend code nor database schema is present here. Firebase provides Authentication and FCM. Firebase hosting/project metadata is represented by firebase.json. CI/build delivery is configured through .gitlab-ci.yml and codemagic.yaml; native packaging resides under android/, ios/, and the other Flutter platform directories.
Components 20
Flutter client
- App bootstrap
lib/main.dart - Role selection & login
lib/screens/role_selection_screen.dart - Auth service · Centralizes Google sign-in and Firebase Authentication calls.
lib/services/auth_service.dart - Firebase configuration
lib/firebase_options.dart - Role dashboards · Student, parent, warden, and guard entry points.
lib/screens/student_dashboard_screen.dart - Leave request & details
lib/screens/leave_request_screen.dart - Leave domain models
lib/models/data_models.dart - Leave service · Retrieves and mutates leave lifecycle state.
lib/services/leave_service.dart - Parent & warden approvals · Applies first and final approval stages.
lib/services/parent_service.dart - Guard operations · Gate workflow and concern entry points.
lib/screens/guard_dashboard_screen.dart - QR gate verification · Validates presented leave credentials for departure or return.
lib/screens/qr_scanner_screen.dart - Concern service
lib/services/concern_service.dart - Notifications · Shows leave-state notifications in the client.
lib/services/notification_service.dart - FCM service
lib/services/fcm_service.dart
Firebase services
- Firebase Authentication
- Firebase Cloud Messaging
External backend
- Render Node.js API · Backend source is not present in this repository.
- MongoDB · Backend persistence is outside this repository.
Platforms & delivery
- Native platform hosts · Android, iOS, web, Linux, macOS, and Windows targets.
android/app/src/main/kotlin/com/pims/pims_app/MainActivity.kt - CI & mobile delivery
.gitlab-ci.yml
Connections 21
- Native platform hosts → App bootstrap: launches
- App bootstrap → Firebase configuration: initializes
- App bootstrap → Role selection & login: starts access flow
- Role selection & login → Auth service: signs in through
- Auth service → Firebase Authentication: Google/Firebase login
- Role selection & login → Role dashboards: selects authorized role
- Role dashboards → Leave request & details: student leave workflow
- Leave request & details → Leave service: creates and views requests
- Leave service → Leave domain models: uses
- Role dashboards → Parent & warden approvals: parent/warden actions
- Parent & warden approvals → Leave service: updates approval state
- Leave service → Render Node.js API: leave data API
- Guard operations → QR gate verification: scans credentials
- QR gate verification → Render Node.js API: validates status and records gate event
- Guard operations → Concern service: raises concerns
- Concern service → Render Node.js API: submits incidents and attachments
- Render Node.js API → MongoDB: persists operational data
- Render Node.js API → Firebase Cloud Messaging: sends leave-state push
- Firebase Cloud Messaging → FCM service: delivers push
- FCM service → Notifications: updates notification UI
- CI & mobile delivery → Native platform hosts: builds and packages