Commit Graph

65 Commits

Author SHA1 Message Date
hosseintaromi 3f4aefb112 admin-users: implement complete admin users management
- Add admin users CRUD operations (list, create, edit, delete)
- Implement proper API response structure handling (admin_user vs user)
- Add form validation with conditional password requirement (optional in edit mode)
- Create reusable hooks and request functions following established pattern
- Add TypeScript interfaces and proper error handling
- Include debug logging for API responses
2025-07-22 08:48:36 +03:30
hosseintaromi 174452d65d roles: fix API response handling
- Add defensive programming for null API responses
- Handle roles array being null in API response
- Fix role permissions array handling
- Add proper fallbacks to prevent 'map is not a function' errors
2025-07-22 08:48:28 +03:30
hosseintaromi 4d385f2031 auth: update authentication system
- Update AuthContext with new login response structure
- Add isLoading state to prevent premature redirects
- Implement proper session restoration from localStorage
- Update permission checking logic (id=1 = super admin)
- Fix login form to use new API structure
- Store tokens, user info, and permissions in localStorage
2025-07-22 08:48:12 +03:30
hosseintaromi fa755515bb fix(roles): correct Button variants
- Change outline to secondary/primary/danger variants
- Fix linter errors for Button component variants
- Update icons and button styling
2025-07-22 00:04:43 +03:30
hosseintaromi 37747941ce fix(roles): add fallback and debug for roles API response
- Add console.log to debug roles API response structure
- Handle different API response formats (results, items, data fields)
- Add fallback to empty array when API fails or returns non-array
- Fix roles?.map error by ensuring roles is always an array
- Handle backend API not working scenario
2025-07-22 00:04:25 +03:30
hosseintaromi d06135824d feat(auth): implement Super Admin permission system
- Update AdminUser interface to match new API response structure
- Remove permissions/roles from AdminUser (they come separately)
- Update hasPermission logic: id=1 (AdminAll) = Super Admin access
- Fix localStorage handling to remove admin_all_permissions key
- Super Admin (permission id=1) now has access to everything
- Other users checked against their specific permissions
2025-07-22 00:01:53 +03:30
hosseintaromi ebd2c3c8f7 feat(roles): add role permissions management page
- Two-column layout for assigned vs available permissions
- Real-time permission assignment and removal
- Confirmation modals for destructive actions
- Complete permissions list with descriptions
- Visual distinction between assigned and available permissions
2025-07-18 14:03:04 +03:30
hosseintaromi cdf0eb29f3 feat(roles): add role detail page
- Complete role information display
- Statistics and metadata sections
- List of assigned permissions
- Quick access to edit and permissions management
- Responsive layout with proper Persian typography
2025-07-18 14:03:01 +03:30
hosseintaromi 4b4fe84cee feat(roles): add role form page for create/edit
- Unified form for both create and edit operations
- Form validation with Yup schema
- Auto-populate fields in edit mode
- Proper navigation and loading states
- Persian validation messages
2025-07-18 14:02:58 +03:30
hosseintaromi 0ee448d9be feat(roles): add roles list page
- Complete table view with role information
- CRUD operations (view, edit, delete, permissions)
- Delete confirmation modal
- Responsive design with proper Persian RTL
- Loading states and error handling
2025-07-18 14:02:55 +03:30
hosseintaromi efb92ac136 feat(roles): implement roles core architecture
- Add comprehensive role and permission models
- Add all CRUD API request functions
- Add custom hooks with React Query integration
- Support role permissions management
- Follow established development pattern
2025-07-18 14:02:53 +03:30
hosseintaromi 0833a6180a feat(drafts): implement drafts feature structure
- Add draft API request functions
- Add custom hooks for draft data fetching
- Update React Query to use @tanstack/react-query
- Follow established development pattern
2025-07-18 13:06:15 +03:30
hosseintaromi 64a63e01fb refactor(login): update Login page to use custom hook
- Replace direct AuthContext usage with useLogin hook
- Change form field from email to username
- Add proper error handling and navigation
- Follow separation of concerns pattern
2025-07-18 13:06:12 +03:30
hosseintaromi d45f588fa7 feat(auth): implement authentication structure
- Add auth helper functions (getAuth, postLogout)
- Add postLogin API request function
- Add useLogin custom hook with React Query
- Update validation schema from email to username
2025-07-18 13:06:06 +03:30
hosseintaromi 46d9c20d87 Update file structure and improve code organization in the main directory 2025-07-13 22:03:22 +03:30