feat(companies): Enhance company forms with additional fields

This commit expands the company profile by adding several new fields to the create and edit forms. This allows for the collection of more detailed and comprehensive company information.

Key changes include:
- Added new fields: Establishment Date, Company Type, Business Nature, Industry, Country, State, and City.
- Introduced a new reusable `DatePicker` component, utilizing `react-datepicker`, for date input.
- Created a new `CalendarIcon` for use in the date picker.
- Updated the company Zod schema, API services, and data types to support the new fields.

Additionally, this commit includes a refactor to standardize the `MultiSelect` component by renaming the `text` prop to `label` for better consistency across form elements. Form labels are now capitalized for a uniform UI.
This commit is contained in:
AmirReza Jamali
2025-09-27 16:33:13 +03:30
parent 527d8e7661
commit bb56e1013a
22 changed files with 628 additions and 29 deletions
+1
View File
@@ -52,6 +52,7 @@ export const API_ENDPOINTS = {
},
NOTIFICATIONS: {
HISTORY: "notifications",
CREATE: "notifications",
DETAILS: (id: string) => `notifications/view/${id}`,
},
} as const;
@@ -1,6 +1,7 @@
import api from "../axios";
import { API_ENDPOINTS } from "../endpoints";
import {
TCreateNotificationCredentials,
TNotificationDetailsResponse,
TNotificationHistoryResponse,
} from "../types/NotificationHistory";
@@ -34,4 +35,20 @@ export const notificationService = {
throw error;
}
},
createNotification: async ({
credentials,
}: {
credentials: TCreateNotificationCredentials;
}) => {
try {
return (await api.post(API_ENDPOINTS.NOTIFICATIONS.CREATE, credentials))
.data;
} catch (error) {
console.error(
"ERROR Caught in Notification service => Create Notification",
error,
);
throw error;
}
},
};
+22 -4
View File
@@ -1,3 +1,9 @@
import {
NotificationChannels,
NotificationPriorities,
NotificationTargetGroups,
NotificationTypes,
} from "@/constants/enums";
import { z } from "zod";
import { createApiResponseSchema } from "./Factory";
@@ -30,14 +36,26 @@ export const notificationSchema = z.object({
updated_at: z.string(),
user_id: z.string(),
});
const createNotificationCredentialsSchema = z.object({
channels: z.array(z.enum(NotificationChannels)),
description: z.string(),
link: z.string(),
priority: z.enum(NotificationPriorities),
recipient: z.array(z.string()).optional(),
schedule_at: z.number(),
target: z.enum(NotificationTargetGroups),
tender: z.string(),
title: z.string(),
type: z.enum(NotificationTypes),
});
const notificationHistoryResponseSchema = createApiResponseSchema(
z.object({
notifications: z.array(notificationSchema),
}),
z.array(notificationSchema),
);
export type TNotificationHistory = z.infer<typeof notificationSchema>;
export type TNotificationDetailsResponse = z.infer<typeof notificationSchema>;
export type TCreateNotificationCredentials = z.infer<
typeof createNotificationCredentialsSchema
>;
export type TNotificationHistoryResponse = z.infer<
typeof notificationHistoryResponseSchema
>;
+1 -1
View File
@@ -5,7 +5,7 @@ export const UserSchema = z.object({
id: z.string().regex(/^[0-9a-fA-F]{24}$/, {
message: "Invalid ObjectId",
}),
full_name: z.string().optional(),
full_name: z.string(),
username: z.string().optional(),
email: z.string().email().optional(),
role: z.string().optional(),