hrms-checkin/.claude/agent-memory/hrms-checkin-expert/feature_no_position_page.md

2.9 KiB

name description type
No Position Assignment Page Feature implementation for users without organization position assignment 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

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: "ตกลง"