feat(inquiries): add sidebar nav item, icon, and API endpoint
- Add "Inquiries" nav item to sidebar data with `/inquiries` URL and BriefcaseTimer icon - Implement BriefcaseTimer SVG icon component - Add `INQUIRIES` base endpoint to API_ENDPOINTS - Cleanup: remove commented details button in CmsTable, reorder imports
This commit is contained in:
@@ -64,4 +64,8 @@ export const API_ENDPOINTS = {
|
||||
CONTACT_US: {
|
||||
BASE: (id?: string) => (id ? `contacts/${id}` : "contacts"),
|
||||
},
|
||||
|
||||
INQUIRIES: {
|
||||
BASE: (id?: string) => (id ? `inquiries/${id}` : "inquiries"),
|
||||
}
|
||||
} as const;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from "./user-services";
|
||||
export * from "./companies-service";
|
||||
export * from "./tenders-service";
|
||||
export * from "./inquiries-service";
|
||||
export * from "./profile-service";
|
||||
export * from "./tenders-service";
|
||||
export * from "./user-services";
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import api from "../axios";
|
||||
import { API_ENDPOINTS } from "../endpoints";
|
||||
import { TInquiriesResponse } from "../types";
|
||||
|
||||
export const inquiriesService = {
|
||||
getInquiries: async (
|
||||
params?: Record<string, any>,
|
||||
): Promise<TInquiriesResponse> => {
|
||||
try {
|
||||
return (await api.get(API_ENDPOINTS.INQUIRIES.BASE(), { params })).data;
|
||||
} catch (error) {
|
||||
console.error("ERROR caught in inquiries service => getInquiries", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
deleteInquiry: async (id: string) => {
|
||||
try {
|
||||
return (await api.delete(API_ENDPOINTS.INQUIRIES.BASE(id))).data;
|
||||
} catch (error) {
|
||||
console.error("ERROR caught in inquiries service => deleteInquiry", error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
import { z } from "zod";
|
||||
import { createApiResponseSchema } from "./Factory";
|
||||
|
||||
const inquiriesSchema = z.object({
|
||||
company_name: z.string(),
|
||||
created_at: z.number(),
|
||||
full_name: z.string(),
|
||||
id: z.string(),
|
||||
phone_number: z.string(),
|
||||
status: z.string(),
|
||||
status_history: z.array(
|
||||
z.object({
|
||||
changed_at: z.number(),
|
||||
description: z.string(),
|
||||
reason: z.string(),
|
||||
status: z.string(),
|
||||
}),
|
||||
),
|
||||
updated_at: z.number(),
|
||||
work_email: z.string(),
|
||||
});
|
||||
export const inquiriesListResponse = createApiResponseSchema(
|
||||
z.object({ inquiries: z.array(inquiriesSchema) }),
|
||||
);
|
||||
export type TInquiries = z.infer<typeof inquiriesSchema>;
|
||||
export type TInquiriesResponse = z.infer<typeof inquiriesListResponse>;
|
||||
@@ -6,3 +6,7 @@ export * from "./Profile";
|
||||
export * from "./shared";
|
||||
export * from "./TCompany";
|
||||
export * from "./User";
|
||||
export * from "./TInquiries";
|
||||
export * from "./TCms";
|
||||
export * from "./Feedback";
|
||||
export * from "./Tenders";
|
||||
|
||||
Reference in New Issue
Block a user