Commit Graph

148 Commits

Author SHA1 Message Date
vergiLgood1 c7bdb24ceb feat: Add triggers and functions for user management and location handling
- Implemented user creation, update, and deletion triggers to manage officer and standard user data.
- Created functions to handle user type changes and conditional updates based on user metadata.
- Added a function to retrieve nearby units based on geographical coordinates.
- Established triggers to update distance to units upon location changes.
- Created spatial indexes for efficient querying of units and locations.
- Added a function to delete the current user from the auth.users table.
2025-05-18 13:52:26 +07:00
vergiLgood1 ffed8b8ede feat(panic-button): add models for events, evidences, incident logs, and sessions
- Implement EventModel with JSON serialization and deserialization.
- Create EvidenceModel with associated JSON handling.
- Develop IncidentLogModel to manage incident logs and their evidences.
- Introduce SessionsModel to track user sessions related to events.
- Update index file to export new models.

feat(personalization): introduce permissions and resources models

- Add PermissionModel to manage user permissions with JSON support.
- Create ResourceModel to define resources and their associated permissions.
- Ensure proper serialization and deserialization for both models.

chore(database): update Prisma schema for new models and relationships

- Add new models: events, evidences, incident_logs, sessions, permissions, and resources.
- Define relationships between users, roles, and permissions.
- Update existing models to maintain referential integrity.
- Introduce enums for session status, contact message status, crime rates, and crime status.
2025-05-16 18:41:16 +07:00
vergiLgood1 7ad427baf6 feat: Update pubspec.yaml with new dependencies and local assets
- Updated description format in pubspec.yaml
- Added multiple utility packages for enhanced functionality
- Included local assets and fonts for better UI design
- Updated widget test to reference the new app structure
- Registered new plugins in generated_plugin_registrant.cc for Windows
- Updated generated_plugins.cmake to include new plugins
- Modified Supabase config to allow additional redirect URLs
2025-05-16 15:42:03 +07:00
vergiLgood1 4b0bae1bcd feat: Implement migration and seeding for officers and patrol units
- Added migration to change primary key type for patrol_units and update foreign key constraints in officers table.
- Created seeder for officers, generating random data and ensuring each officer is linked to a patrol unit.
- Developed seeder for patrol units, including logic for generating patrol types, statuses, and locations based on police units.
- Enhanced Supabase triggers for user creation, updates, and deletions to handle officer-specific logic and maintain data integrity.
- Introduced GIS functions and triggers to calculate distances between locations and units, optimizing spatial queries.
2025-05-16 00:50:30 +07:00
vergiLgood1 223195e3fb Refactor map utility functions and components
- Moved map utility functions from `map.ts` to `map/common.ts` for better organization.
- Updated imports in `district-extrusion-layer.tsx`, `district-layer.tsx`, `layers.tsx`, and `distance-info.tsx` to reflect the new location of utility functions.
- Enhanced `DistrictFillLineLayer` to improve handling of fill color expressions and opacity based on active controls.
- Introduced new types for crime source in `map.ts` and updated relevant components to use these types.
- Added a new `IncidentDetailTab` component to display detailed information about incidents, including severity and status.
- Improved handling of severity and status information across components for consistency and clarity.
2025-05-15 15:47:56 +07:00
vergiLgood1 2ab60befd8 feat: Enhance Crime Sidebar and Incident Tab with Recent Incidents
- Updated CrimeSidebar to accept recent incidents as a prop for user reports from the last 24 hours.
- Modified SidebarIncidentsTab to format and display recent incidents, including filtering by category and sorting by timestamp.
- Adjusted CrimeMap to manage the selected year based on the source type and to handle recent incidents data.
- Renamed MapLegend to ClusterLegend for clarity and updated its props accordingly.
2025-05-15 14:15:18 +07:00
vergiLgood1 c3eeb4051e refactor: optimize crime analytics hook and improve filtering logic 2025-05-15 12:35:47 +07:00
vergiLgood1 4590e21c39 Refactor map layers: consolidate imports, enhance type definitions, and improve layer management. Remove UnclusteredPointLayer and introduce AllIncidentsLayer for better incident handling and visualization. 2025-05-15 12:21:24 +07:00
vergiLgood1 952bdbed8f feat: implement centralized layer visibility management across map layers 2025-05-15 10:55:34 +07:00
vergiLgood1 ba191c5e88 feat: add layer visibility management for recent incidents and ensure proper initialization 2025-05-15 10:19:25 +07:00
vergiLgood1 da93032a24 fix: adjust ping animation duration and simplify keyframes for better performance 2025-05-15 10:09:31 +07:00
vergiLgood1 b9f69ade3b feat: update incident logs structure and add popup component
- Modified IIncidentLogs interface to include user details and additional fields.
- Implemented IncidentLogsPopup component for displaying incident details on the map.
- Added functionality to format timestamps, display severity badges, and show reporter information.
- Created SQL functions for retrieving nearby units and updating location distances in the database.
- Added spatial indexes to optimize queries related to units and locations.
2025-05-14 19:21:36 +07:00
vergiLgood1 849b3c1ae3 fix: fix kesalahan oengambilan properti distance pada units layer 2025-05-14 17:17:10 +07:00
vergiLgood1 58f033d0e4 Refactor map layers and pop-ups for improved incident handling and UI updates
- Removed unused CrimePopup component and replaced with IncidentPopup in layers.tsx
- Consolidated incident click handling logic in UnitsLayer and RecentIncidentsLayer
- Updated UnitsLayer to fetch nearest units and display them in the IncidentPopup
- Enhanced UI for displaying nearby police units with loading states and better formatting
- Cleaned up console logs for production readiness
- Adjusted map flyTo parameters for better user experience
- Added wave circle animations for incident markers
2025-05-14 16:14:40 +07:00
vergiLgood1 f4b6d19eb2 feat: remove fill when district pop up is close 2025-05-14 12:31:31 +07:00
vergiLgood1 5808758855 Refactor map layer animations to use BASE_DURATION and introduce new constants for 3D view settings
- Updated DistrictFillLineLayer to use BASE_DURATION for animation duration instead of a hardcoded value.
- Commented out the flyTo animation in DistrictFillLineLayer for potential future use.
- Modified Layers component to utilize ZOOM_3D and PITCH_3D constants for flyTo animations, enhancing readability and maintainability.
2025-05-14 12:11:34 +07:00
vergiLgood1 8a1582c994 refactor: streamline map constants and enhance animation handling in layers 2025-05-14 12:04:21 +07:00
vergiLgood1 6c96c1140c Refactor tooltip and control types for improved clarity and consistency
- Renamed ITooltips to ITooltipsControl for better context in map controls.
- Updated type references in search-control, tooltips, crime-map, and layers to use the new ITooltipsControl type.
- Enhanced fill opacity logic in map layers based on active control state.
- Introduced getFillOpacity utility function to centralize opacity determination based on active control.
- Adjusted event handling for district clicks to ensure proper focus and visibility toggling.
- Cleaned up CSS styles by commenting out unused styles for circles.
2025-05-14 11:08:06 +07:00
vergiLgood1 9c6e005839 fix: fix bug district pop up always show while selected district is not focus 2025-05-14 10:06:09 +07:00
vergiLgood1 834d4b02cf feat: Enhance unit popup to display nearby incidents and loading state 2025-05-14 08:56:08 +07:00
vergiLgood1 2c11cc5991 fix: Update district coordinates and improve unit seeding logic 2025-05-14 08:15:27 +07:00
vergiLgood1 9f9b14992d add seeds supaabse 2025-05-14 07:08:11 +07:00
vergiLgood1 db8e2a6321 add seeds supaabse 2025-05-14 06:54:34 +07:00
vergiLgood1 2a8f249d0c add filter source_type 2025-05-12 12:24:50 +07:00
vergiLgood1 77c865958a feat: Add crime data JSON and district center data for crime incidents
feat: Update database schema to allow nullable year in crimes table

feat: Create test table for future use in migrations

feat: Add crime_cleared column to crimes table and drop test table

feat: Add city_id column to units table and adjust district_id constraints

feat: Add phone column to units table

feat: Add avg_crime column to crimes table

feat: Implement seeder for crime incidents with detailed mock data generation

feat: Add trigger and function for calculating distance to district's police unit
2025-05-12 08:17:26 +07:00
vergiLgood1 e422c59da9 Add crime data CSV files and update database schema
- Added crime summary by type CSV file with district-wise crime statistics.
- Added yearly crime data CSV file with detailed crime statistics per district and year.
- Modified the database schema to include a new column `source_type` in the `crimes` table and a new column `distance` in the `locations` table.
- Created migration to add `location_logs` table for tracking user location data with relevant fields and indices.
- Updated migration to drop the `distance` column and replace it with `distance_from_unit` in the `locations` table.
- Added additional migrations to drop and recreate the `location_logs` table, modify existing columns, and enforce new constraints in the `unit_statistics` and `units` tables.
2025-05-11 14:44:14 +07:00
vergiLgood1 f4b1d9d633 feat: Implement custom animated popup for EWS alerts with wave circles and enhanced styling 2025-05-07 11:38:16 +07:00
vergiLgood1 8a1a4320c2 feat: Add Panic Button Demo component and EWS Alert Layer for incident management
- Implemented PanicButtonDemo component for triggering alerts with varying priorities.
- Created EWSAlertLayer to manage and display active incidents on the map.
- Added styles for alert markers and status indicators.
- Developed mock data utilities for generating and managing incident logs.
- Defined TypeScript interfaces for incident logs and locations.
2025-05-07 10:23:54 +07:00
vergiLgood1 3448945f4d add some geojson layer 2025-05-07 09:03:52 +07:00
vergiLgood1 05ba4ab920 feat: enhance SidebarInfoTab with detailed map layers and add timeline layer functionality to CrimeMap; update TimelineLegend and TimelinePopup styles 2025-05-07 08:01:07 +07:00
vergiLgood1 4cc01babf1 Enhance pop-up components with connection indicators and improve styling
- Refactored IncidentPopup, TimelinePopup, and UnitPopup components to include connection lines and dots for better visual indication of their relation to the map.
- Updated the layout and styling of the pop-ups for improved readability and consistency.
- Adjusted the TIME_ZONES data to reflect more accurate geographical locations.
- Enhanced the digital clock display in the TimeZonesDisplay component with improved styling and shadow effects.
- Added new CSS styles for digital clock presentation to enhance user experience.
2025-05-07 07:21:38 +07:00
vergiLgood1 da94277f4d feat: add digital clock and timezone markers to map
- Implemented DigitalClockMarker component to display a blinking digital clock at specified coordinates.
- Created TimeZonesDisplay component to show current times for different time zones on the map.
- Added styling for digital clock and time zone markers in globals.css.
- Introduced TimelinePopup component to display incident analysis for selected districts.
- Enhanced UnclusteredPointLayer and UnitsLayer components to manage visibility and interactions with markers.
- Updated map event handlers for improved user interaction and experience.
2025-05-07 07:08:12 +07:00
vergiLgood1 609a9c1327 Refactor map interaction and event handling
- Updated DistrictLayer to dispatch custom events for incident clicks and map fly-to actions.
- Enhanced DistrictFillLineLayer to support a new onDistrictClick prop for handling district interactions.
- Improved Layers component to manage district and incident selections, including new event listeners for incident clicks.
- Refactored UnclusteredPointLayer to streamline incident click handling and map interactions.
- Introduced FlyToHandler component to centralize fly-to event handling and highlight effects for incidents.
- Cleaned up event listener management across components to ensure proper cleanup and avoid memory leaks.
2025-05-07 06:41:33 +07:00
vergiLgood1 ae6eb40a13 refactor: enhance unclustered point layer to include GeoJSON conversion and improve layer setup; add optional prop for incident marker visibility 2025-05-07 03:42:14 +07:00
vergiLgood1 6bfc148821 refactor: enhance distance calculation and heatmap functionality; improve error handling and add interaction support 2025-05-07 03:17:59 +07:00
vergiLgood1 57fb1e4e46 Refactor GeoJSON seeder to insert data in smaller batches to prevent timeouts; added chunking logic and improved error handling. Update permission seeder to batch create permissions for roles and resources. Optimize unit seeder to prepare and insert unit data in bulk, enhancing performance. Adjust Supabase configuration for local development and modify migration scripts to restore GIS functions and types. 2025-05-06 21:37:28 +07:00
vergiLgood1 969d10958c refactor: streamline SQL migration scripts and enhance schema management for units and incidents 2025-05-06 15:37:07 +07:00
vergiLgood1 e891df87d0 Refactor seeding scripts to utilize generateIdWithDbCounter for unique ID generation across crime categories, incidents, and units. Implement a new utility function for generating distributed points within district areas to enhance incident location variability. Comment out unnecessary type drops and creations in SQL migration files for clarity. Add migration scripts to drop and re-add the phone field in the units table, ensuring data integrity during schema updates. 2025-05-06 01:21:04 +07:00
vergiLgood1 0747897fc7 Refactor database privileges and schema management
- Created migration scripts to manage the 'prisma' role and its privileges across various schemas including 'public', 'gis', 'auth', and 'storage'.
- Added explicit grants for all necessary tables, sequences, and functions to ensure the 'prisma' role has appropriate access.
- Implemented triggers for user management in the 'auth' schema to handle new user creation, updates, and deletions.
- Established default privileges for future objects in the specified schemas to streamline permission management.
- Updated remote schema management scripts to include grants for 'postgres' on specific tables and functions.
- Dropped and recreated types in the 'gis' schema to ensure proper structure and functionality.
2025-05-05 23:39:01 +07:00
vergiLgood1 fa7651619b feat: Enhance heatmap and timeline layers with new data handling and filtering options 2025-05-05 11:11:11 +07:00
vergiLgood1 a19e8ec32d feat: Add timeline and units layers to the map component
- Introduced a new TimelineLayer to visualize average incident times per district.
- Added UnitsLayer to display police stations and connection lines to incidents.
- Updated Layers component to conditionally render the new layers based on active controls.
- Implemented a query to fetch units data from the server.
- Created utility functions for color generation based on crime categories.
- Enhanced map interaction with popups for detailed information on incidents and units.
- Added legends for timeline and units to improve user experience.
- Refactored existing types and interfaces to accommodate new features.
2025-05-05 10:38:11 +07:00
vergiLgood1 b0db61a9ff feat: add heatmap layer and enhance clustering functionality in map layers 2025-05-05 06:47:59 +07:00
vergiLgood1 c6115adf88 feat: enhance district layer interactions and animations for improved user experience 2025-05-05 05:49:50 +07:00
vergiLgood1 078bf969bc refactor: refactor district layer 2025-05-05 05:15:05 +07:00
vergiLgood1 03a5e527d4 Refactor map layers and components for improved structure and functionality
- Removed the MapLayerManager component and integrated its functionality into the Layers component.
- Added FlyToHandler component to manage map fly-to animations and highlight incidents.
- Introduced ClusterLayer and UnclusteredPointLayer components for better handling of crime incident clustering and display.
- Updated types in map.ts to include new interfaces for district features and layer props.
- Enhanced crime data processing functions for better data management and visualization.
- Adjusted button styles in button.tsx for improved UI consistency.
2025-05-05 04:57:32 +07:00
vergiLgood1 c282d958a5 feat: add map reset functionality and improve incident popup handling 2025-05-05 03:42:32 +07:00
vergiLgood1 6327d7b886 feat: implement map fly-to functionality with custom events for improved navigation experience 2025-05-05 03:20:16 +07:00
vergiLgood1 a2f51e6837 refactor: update crime-related interfaces for consistency and clarity across components 2025-05-05 03:11:07 +07:00
vergiLgood1 2aa2e609f1 feat: enhance search functionality with crime data integration and improved suggestion handling 2025-05-05 02:16:49 +07:00
vergiLgood1 befda55e2f feat: update tooltip styles for improved visibility and consistency across components 2025-05-05 02:02:40 +07:00