notification process
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
import { useParams, useRouter } from 'next/navigation'
|
||||
import { useRouter, useSearchParams } from 'next/navigation'
|
||||
import { useParams} from 'next/navigation'
|
||||
import Link from 'next/link'
|
||||
import { toast } from 'react-hot-toast'
|
||||
import {
|
||||
@@ -35,6 +36,7 @@ const DIRECTIVE_TYPE_LABELS: Record<string, string> = {
|
||||
}
|
||||
|
||||
function TenderDetailContent() {
|
||||
const searchParams = useSearchParams()
|
||||
const params = useParams()
|
||||
const router = useRouter()
|
||||
const tenderId = params.id as string
|
||||
@@ -43,7 +45,12 @@ function TenderDetailContent() {
|
||||
const [tender, setTender] = useState<Tender | null>(null)
|
||||
const [history, setHistory] = useState<any[]>([])
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [activeTab, setActiveTab] = useState<'info' | 'directives' | 'attachments' | 'history'>('info')
|
||||
type TenderTab = 'details' | 'directives' | 'attachments' | 'logs' | 'info' |'history'
|
||||
const [activeTab, setActiveTab] = useState<TenderTab>('details')
|
||||
const openTab = (tab: TenderTab) => {
|
||||
setActiveTab(tab)
|
||||
router.replace(`/tenders/${params.id}?tab=${tab}`)
|
||||
}
|
||||
const [showDirectiveModal, setShowDirectiveModal] = useState(false)
|
||||
const [showConvertModal, setShowConvertModal] = useState(false)
|
||||
const [showCompleteModal, setShowCompleteModal] = useState<TenderDirective | null>(null)
|
||||
@@ -85,6 +92,17 @@ function TenderDetailContent() {
|
||||
setHistory(data)
|
||||
} catch {}
|
||||
}
|
||||
useEffect(() => {
|
||||
const tabParam = searchParams.get('tab') as TenderTab | null
|
||||
|
||||
const allowedTabs: TenderTab[] = ['details', 'directives', 'attachments', 'logs']
|
||||
|
||||
if (tabParam && allowedTabs.includes(tabParam)) {
|
||||
setActiveTab(tabParam)
|
||||
}
|
||||
}, [searchParams])
|
||||
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetchTender()
|
||||
|
||||
Reference in New Issue
Block a user