Adding Services dropdown in Organization Creation dropdown.

This commit is contained in:
Kartik Sharma 2025-09-25 16:09:36 +05:30
parent 182280e91d
commit 69c225ac72
2 changed files with 21 additions and 0 deletions

View File

@ -6,11 +6,14 @@ import { useCreateTenant, useIndustries } from "../../hooks/useTenant";
import { LogoUpload } from "./LogoUpload"; import { LogoUpload } from "./LogoUpload";
import { orgSize, reference } from "../../utils/constants"; import { orgSize, reference } from "../../utils/constants";
import moment from "moment"; import moment from "moment";
import { useGlobalServices } from "../../hooks/masterHook/useMaster";
import SelectMultiple from "../common/SelectMultiple";
const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => { const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
const { data, isError, isLoading: industryLoading } = useIndustries(); const { data, isError, isLoading: industryLoading } = useIndustries();
const [logoPreview, setLogoPreview] = useState(null); const [logoPreview, setLogoPreview] = useState(null);
const [logoName, setLogoName] = useState(""); const [logoName, setLogoName] = useState("");
const { data: services, isLoading: serviceLoading } = useGlobalServices();
const { const {
register, register,
control, control,
@ -42,6 +45,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
"industryId", "industryId",
"reference", "reference",
"logoImage", "logoImage",
"serviceIds",
]); ]);
if (valid) { if (valid) {
@ -198,6 +202,21 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
)} )}
</div> </div>
<div className="col-sm-6">
<SelectMultiple
required
name="serviceIds"
label="Services"
options={services?.data}
isLoading={serviceLoading}
labelKey="name"
valueKey="id"
/>
{errors.serviceIds && (
<div className="danger-text">{errors.serviceIds.message}</div>
)}
</div>
<div className="col-sm-12"> <div className="col-sm-12">
<Label htmlFor="description">Description</Label> <Label htmlFor="description">Description</Label>

View File

@ -33,6 +33,7 @@ export const newTenantSchema = z.object({
organizationSize: z.string().nonempty("Organization size is required"), organizationSize: z.string().nonempty("Organization size is required"),
industryId: z.string().uuid("Invalid industry ID"), industryId: z.string().uuid("Invalid industry ID"),
reference: z.string().nonempty("Reference is required"), reference: z.string().nonempty("Reference is required"),
serviceIds: z.array(z.string()).nonempty("Services is required"),
}); });
export const tenantDefaultValues = { export const tenantDefaultValues = {
@ -51,6 +52,7 @@ export const tenantDefaultValues = {
organizationSize: "", organizationSize: "",
industryId: "", // should be a valid UUID if pre-filled industryId: "", // should be a valid UUID if pre-filled
reference: "", reference: "",
serviceIds:[]
}; };