diff --git a/.claude/agent-memory/hrms-checkin-expert/MEMORY.md b/.claude/agent-memory/hrms-checkin-expert/MEMORY.md new file mode 100644 index 0000000..7897460 --- /dev/null +++ b/.claude/agent-memory/hrms-checkin-expert/MEMORY.md @@ -0,0 +1,9 @@ +# HRMS Check-in Expert Memory + +## Features + +- [No Position Assignment Page](feature_no_position_page.md) - Implementation for users without organization position assignment + +## Project Issues & Fixes + +- [Position Orientation Change Fix](issue_position_orientation_change_fix.md) - Fix for position map not displaying on screen orientation changes diff --git a/.claude/agent-memory/hrms-checkin-expert/feature_no_position_page.md b/.claude/agent-memory/hrms-checkin-expert/feature_no_position_page.md new file mode 100644 index 0000000..c72acc5 --- /dev/null +++ b/.claude/agent-memory/hrms-checkin-expert/feature_no_position_page.md @@ -0,0 +1,68 @@ +--- +name: No Position Assignment Page +description: Feature implementation for users without organization position assignment +type: reference +--- + +## No Position Assignment Page Feature + +When a user doesn't have a position assignment (สังกัด), they are redirected to a dedicated page explaining they are not part of the organization structure. + +### Files Created/Modified + +1. **Created:** `/Users/waruneeta/Desktop/ChamomindWorking/HRMSProject/hrms-checkin/src/views/NoPositionView.vue` + - Displays message in Thai: "ไม่พบข้อมูลสังกัด" + - Shows icon and explanation text + - "ตกลง" (OK) button that shows confirmation dialog + - After confirmation, performs logout and clears positionKeycloak store + +2. **Modified:** `/Users/waruneeta/Desktop/ChamomindWorking/HRMSProject/hrms-checkin/src/router/index.ts` + - Added new route `/no-position` with `Auth: false` + - Enhanced router guard to check for position data + - Redirects to `/no-position` if user has no organization assignment + +3. **Modified:** `/Users/waruneeta/Desktop/ChamomindWorking/HRMSProject/hrms-checkin/src/views/MainView.vue` + - Updated `fetchKeycloakPosition()` function + - Checks if `organization` object exists and has any data + - Redirects to `/no-position` if no organization data found + +### Logic Flow + +1. User logs in successfully +2. `MainView.vue` calls `fetchKeycloakPosition()` in `onMounted()` +3. API returns position data from `/org/profile/keycloak/position` +4. System checks if `organization` object has any non-null values (root, child1-4) +5. If no organization data exists: + - User is redirected to `/no-position` + - User sees message explaining they need to contact staff + - User clicks "ตกลง" to logout + - Staff adds them to organization structure + - User can login again + +### Position Data Structure + +```typescript +interface KeycloakPosition { + privacyCheckin: boolean + avatarName?: string + profileId: string + organization?: Organization +} + +interface Organization { + root?: string + child1?: string + child2?: string + child3?: string + child4?: string +} +``` + +A user is considered to have "no position" when all organization fields (root, child1, child2, child3, child4) are null or undefined. + +### Thai UI Messages + +- Page title: "ไม่พบข้อมูลสังกัด" +- Description: "ท่านยังไม่มีสังกัดในโครงสร้างองค์กร กรุณาติดต่อเจ้าหน้าที่เพื่อดำเนินการเพิ่มข้อมูล" +- Confirmation dialog: "ยืนยันการออกจากระบบ" - "ท่านจะถูกนำออกจากระบบเพื่อให้เจ้าหน้าที่ดำเนินการเพิ่มข้อมูลสังกัดในโครงสร้างองค์กร" +- Button: "ตกลง" diff --git a/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md b/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md new file mode 100644 index 0000000..7abffd3 --- /dev/null +++ b/.claude/agent-memory/hrms-checkin-expert/issue_position_orientation_change.md @@ -0,0 +1,48 @@ +--- +name: position_orientation_change_fix +description: Fix for position map not displaying on screen orientation changes +type: project +--- + +## Issue: Position/Geolocation Not Displaying on Screen Orientation Changes + +**Problem:** +The ArcGIS map component (`AscGISMap.vue`) failed to display or update position when the screen orientation changed between portrait and landscape modes. + +**Root Cause:** +1. The component uses `v-if="$q.screen.gt.xs"` for conditional rendering of different layouts +2. When orientation changes, the ArcGIS MapView doesn't automatically resize to fit the new container dimensions +3. ArcGIS MapView requires manual `resize()` call when its container's size changes + +**Solution Implemented:** +Added screen resize handling to `src/components/AscGISMap.vue`: + +1. **Added state tracking:** + - `isMapInitialized` ref to track when map is ready + - `isInitializing` ref to prevent concurrent initializations + +2. **Added `handleMapResize()` function:** + - Checks if mapView exists and isn't destroyed + - Uses `nextTick()` to ensure DOM updates complete before resizing + - Calls `mapView.value.resize()` to update map dimensions + +3. **Added watcher on `$q.screen.gt.xs`:** + - Triggers when screen size crosses the xs breakpoint + - Waits for DOM update via `nextTick()` + - Calls `handleMapResize()` to adjust map + +4. **Added window resize event listener:** + - Falls back for orientation changes that might not trigger Quasar's screen watcher + - Debounced with 300ms timeout to avoid excessive calls + - Properly cleaned up on component unmount + +**Files Modified:** +- `src/components/AscGISMap.vue` - Added resize handling logic + +**Best Practices Applied:** +- Proper cleanup of event listeners in `onBeforeUnmount` +- Debouncing resize events for performance +- Using `nextTick()` to ensure DOM synchronization +- Checking for destroyed state before calling map methods + +**Note:** The Google Maps component (`MapCheckin.vue`) was not affected as `vue3-google-map` handles resize automatically. diff --git a/src/assets/markers/marker-blue.svg b/src/assets/markers/marker-blue.svg new file mode 100644 index 0000000..e617e4c --- /dev/null +++ b/src/assets/markers/marker-blue.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/markers/marker-red.svg b/src/assets/markers/marker-red.svg new file mode 100644 index 0000000..39353ad --- /dev/null +++ b/src/assets/markers/marker-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/components/AscGISMap.vue b/src/components/AscGISMap.vue index e39f58d..ec1eb0b 100644 --- a/src/components/AscGISMap.vue +++ b/src/components/AscGISMap.vue @@ -1,22 +1,44 @@ -
+
@@ -374,4 +686,8 @@ defineExpose({ .expanAS.q-item__section--avatar { min-width: 40px !important; } + +.map-hidden { + visibility: hidden; +} diff --git a/src/components/AscGISMapTime.vue b/src/components/AscGISMapTime.vue index 7360980..1264791 100644 --- a/src/components/AscGISMapTime.vue +++ b/src/components/AscGISMapTime.vue @@ -1,9 +1,8 @@