change list invoce and tickets + pwa + ...

This commit is contained in:
hamid zarghami
2025-03-05 16:44:11 +03:30
parent 0084aefae4
commit b346481267
19 changed files with 8624 additions and 188 deletions
+2 -1
View File
@@ -14,13 +14,14 @@ const TicketList: FC = () => {
const { t } = useTranslation('global')
const [searchParams] = useSearchParams()
const [customerId, setCustomerId] = useState<string>('')
const [activeTab, setActiveTab] = useState<'ANSWERED' | 'PENDING' | 'CLOSED'>('PENDING')
const [activeTab, setActiveTab] = useState<'ANSWERED' | 'PENDING' | 'CLOSED' | ''>('PENDING')
const getTicket = useGetTickets(activeTab, customerId)
useEffect(() => {
const urlCustomerId = searchParams.get('user')
if (urlCustomerId) {
setCustomerId(urlCustomerId)
setActiveTab('')
}
}, [searchParams])
+5 -5
View File
@@ -2,11 +2,11 @@ import axios from "../../../config/axios";
import { AddMessageTicketType, CreateCategoryType } from "../types/TicketTypes";
export const getTickets = async (status: string, customerId?: string) => {
let query = `/tickets/admin?status=${status}`;
if (customerId) {
query += `&userId=${customerId}`;
}
const { data } = await axios.get(query);
const params = new URLSearchParams();
if (status) params.append("status", status);
if (customerId) params.append("userId", customerId);
const query = params.toString();
const { data } = await axios.get(`/tickets/admin?${query}`);
return data;
};