bug: merge conflict
This commit is contained in:
parent
9e194da309
commit
fb67f4b680
@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useState, useEffect, useCallback } from 'react'
|
import { useState, useEffect, useCallback, useRef } from 'react'
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import {
|
import {
|
||||||
@ -56,6 +56,7 @@ export default function Header() {
|
|||||||
const [hasReferralPerm, setHasReferralPerm] = useState(false)
|
const [hasReferralPerm, setHasReferralPerm] = useState(false)
|
||||||
// NEW: admin management dropdown state
|
// NEW: admin management dropdown state
|
||||||
const [adminMgmtOpen, setAdminMgmtOpen] = useState(false)
|
const [adminMgmtOpen, setAdminMgmtOpen] = useState(false)
|
||||||
|
const managementRef = useRef<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
try {
|
try {
|
||||||
@ -402,25 +403,26 @@ export default function Header() {
|
|||||||
Admin Navigation
|
Admin Navigation
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
onClick={() => { console.log('🧭 Admin: navigate to /admin'); router.push('/admin') }}
|
onClick={() => { router.push('/admin') }}
|
||||||
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A]"
|
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A]"
|
||||||
>
|
>
|
||||||
Dashboard
|
Dashboard
|
||||||
</button>
|
</button>
|
||||||
{/* MOVED: User Verify now before Management */}
|
|
||||||
<button
|
<button
|
||||||
onClick={() => { console.log('🧭 Admin: navigate to /admin/user-verify'); router.push('/admin/user-verify') }}
|
onClick={() => { router.push('/admin/user-verify') }}
|
||||||
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A]"
|
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A]"
|
||||||
>
|
>
|
||||||
User Verify
|
User Verify
|
||||||
</button>
|
</button>
|
||||||
{/* Management dropdown (unchanged) */}
|
{/* Updated Management dropdown */}
|
||||||
<div
|
<div
|
||||||
|
ref={managementRef}
|
||||||
className="relative"
|
className="relative"
|
||||||
onMouseLeave={() => setAdminMgmtOpen(false)}
|
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
onClick={() => setAdminMgmtOpen(o => !o)}
|
onClick={() => setAdminMgmtOpen(o => !o)}
|
||||||
|
aria-haspopup="true"
|
||||||
|
aria-expanded={adminMgmtOpen}
|
||||||
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A] flex items-center gap-1"
|
className="text-sm font-semibold text-[#0F1D37] hover:text-[#7A5E1A] flex items-center gap-1"
|
||||||
>
|
>
|
||||||
Management
|
Management
|
||||||
@ -429,29 +431,36 @@ export default function Header() {
|
|||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
{adminMgmtOpen && (
|
{adminMgmtOpen && (
|
||||||
<div className="absolute left-1/2 -translate-x-1/2 mt-2 min-w-[15rem] rounded-md bg-white shadow-lg ring-1 ring-black/10 z-50">
|
<div
|
||||||
|
className="absolute left-1/2 -translate-x-1/2 mt-2 min-w-[15rem] rounded-md bg-white shadow-lg ring-1 ring-black/10 z-50"
|
||||||
|
role="menu"
|
||||||
|
>
|
||||||
<div className="py-2">
|
<div className="py-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => { router.push('/admin/user-management'); setAdminMgmtOpen(false); }}
|
onClick={() => { router.push('/admin/user-management'); setAdminMgmtOpen(false); }}
|
||||||
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
||||||
|
role="menuitem"
|
||||||
>
|
>
|
||||||
User Management
|
User Management
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => { router.push('/admin/matrix-management'); setAdminMgmtOpen(false); }}
|
onClick={() => { router.push('/admin/matrix-management'); setAdminMgmtOpen(false); }}
|
||||||
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
||||||
|
role="menuitem"
|
||||||
>
|
>
|
||||||
Matrix Management
|
Matrix Management
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => { router.push('/admin/contract-management'); setAdminMgmtOpen(false); }}
|
onClick={() => { router.push('/admin/contract-management'); setAdminMgmtOpen(false); }}
|
||||||
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
||||||
|
role="menuitem"
|
||||||
>
|
>
|
||||||
Contract Management
|
Contract Management
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={() => { router.push('/admin/subscriptions'); setAdminMgmtOpen(false); }}
|
onClick={() => { router.push('/admin/subscriptions'); setAdminMgmtOpen(false); }}
|
||||||
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
className="w-full text-left px-4 py-2 text-sm text-[#0F1D37] hover:bg-[#F5F3EE]"
|
||||||
|
role="menuitem"
|
||||||
>
|
>
|
||||||
Coffee Subscription Management
|
Coffee Subscription Management
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -46,16 +46,13 @@ export const API_ENDPOINTS = {
|
|||||||
ADMIN_UPDATE_USER_VERIFICATION: '/api/admin/update-verification/:id',
|
ADMIN_UPDATE_USER_VERIFICATION: '/api/admin/update-verification/:id',
|
||||||
ADMIN_UPDATE_USER_PROFILE: '/api/admin/update-user-profile/:id',
|
ADMIN_UPDATE_USER_PROFILE: '/api/admin/update-user-profile/:id',
|
||||||
ADMIN_UPDATE_USER_STATUS: '/api/admin/update-user-status/:id',
|
ADMIN_UPDATE_USER_STATUS: '/api/admin/update-user-status/:id',
|
||||||
<<<<<<< HEAD
|
|
||||||
// Coffee products (admin)
|
// Coffee products (admin)
|
||||||
ADMIN_COFFEE_LIST: '/api/admin/coffee',
|
ADMIN_COFFEE_LIST: '/api/admin/coffee',
|
||||||
ADMIN_COFFEE_CREATE: '/api/admin/coffee',
|
ADMIN_COFFEE_CREATE: '/api/admin/coffee',
|
||||||
ADMIN_COFFEE_UPDATE: '/api/admin/coffee/:id',
|
ADMIN_COFFEE_UPDATE: '/api/admin/coffee/:id',
|
||||||
ADMIN_COFFEE_SET_STATE: '/api/admin/coffee/:id/state',
|
ADMIN_COFFEE_SET_STATE: '/api/admin/coffee/:id/state',
|
||||||
ADMIN_COFFEE_DELETE: '/api/admin/coffee/:id',
|
ADMIN_COFFEE_DELETE: '/api/admin/coffee/:id',
|
||||||
=======
|
ADMIN_CONTRACT_PREVIEW: '/api/admin/contract-preview/:id',
|
||||||
ADMIN_CONTRACT_PREVIEW: '/api/admin/contracts/:id/preview',
|
|
||||||
>>>>>>> 757b530e14a4c81bd8a54ae569dab647f906421a
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// API Helper Functions
|
// API Helper Functions
|
||||||
@ -441,6 +438,8 @@ export class AdminAPI {
|
|||||||
const resp = await ApiClient.delete(endpoint, token)
|
const resp = await ApiClient.delete(endpoint, token)
|
||||||
if (!resp.ok) throw new Error('Failed to delete product')
|
if (!resp.ok) throw new Error('Failed to delete product')
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
static async getContractPreviewHtml(token: string, userId: string, userType?: 'personal' | 'company') {
|
static async getContractPreviewHtml(token: string, userId: string, userType?: 'personal' | 'company') {
|
||||||
let endpoint = API_ENDPOINTS.ADMIN_CONTRACT_PREVIEW.replace(':id', userId)
|
let endpoint = API_ENDPOINTS.ADMIN_CONTRACT_PREVIEW.replace(':id', userId)
|
||||||
if (userType) {
|
if (userType) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user