Correction in Subscription page.
This commit is contained in:
parent
d68cb9e664
commit
630c11985d
@ -1,4 +1,4 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import TeamEmployeeList from "./TeamEmployeeList";
|
import TeamEmployeeList from "./TeamEmployeeList";
|
||||||
import { useOrganization } from "../../../hooks/useDirectory";
|
import { useOrganization } from "../../../hooks/useDirectory";
|
||||||
import { useOrganizationsList } from "../../../hooks/useOrganization";
|
import { useOrganizationsList } from "../../../hooks/useOrganization";
|
||||||
@ -14,56 +14,48 @@ const TeamAssignToProject = ({ closeModal }) => {
|
|||||||
const project = useSelectedProject();
|
const project = useSelectedProject();
|
||||||
const { data, isLoading, isError, error } =
|
const { data, isLoading, isError, error } =
|
||||||
useProjectAssignedOrganizationsName(project);
|
useProjectAssignedOrganizationsName(project);
|
||||||
const { control, watch, formState: { errors } } = useForm({
|
const { control, watch, setValue, formState: { errors } } = useForm({
|
||||||
defaultValues: { organizationId: "" },
|
defaultValues: { organizationId: "" },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data?.length === 1) {
|
||||||
|
setValue("organizationId", data[0].id, {
|
||||||
|
shouldValidate: true,
|
||||||
|
shouldDirty: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [data, setValue]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
{/* <p className="fs-5 fs-seminbod ">Assign Employee To Project </p> */}
|
{/* <p className="fs-5 fs-seminbod ">Assign Employee To Project </p> */}
|
||||||
<h5 className="mb-4">Assign Employee To Project</h5>
|
<h5 className="mb-4">Assign Employee To Project</h5>
|
||||||
|
|
||||||
<div className="row align-items-center gx-5 text-start">
|
<div className="row align-items-center gx-5 text-start">
|
||||||
<div className="col-12 col-md-6 mb-2 mt-5">
|
<div className="col-12 col-md-6 mb-2">
|
||||||
|
<AppFormController
|
||||||
{!isLoading && data && (
|
name="organizationId"
|
||||||
<>
|
control={control}
|
||||||
{data.length === 1 && (
|
rules={{ required: "Organization is required" }}
|
||||||
<h5 className="mb-2">{data[0].name}</h5>
|
render={({ field }) => (
|
||||||
)}
|
<SelectField
|
||||||
|
label="Select Organization"
|
||||||
{/* If multiple organizations → show dropdown */}
|
options={data ?? []}
|
||||||
{data.length > 1 && (
|
placeholder="Choose an Organization"
|
||||||
<div className="col-12 col-md-6 mb-2 text-start">
|
required
|
||||||
<AppFormController
|
labelKey="name"
|
||||||
name="organizationId"
|
valueKey="id"
|
||||||
control={control}
|
value={field.value}
|
||||||
rules={{ required: "Organization is required" }}
|
onChange={field.onChange}
|
||||||
render={({ field }) => (
|
isLoading={isLoading}
|
||||||
<SelectField
|
className="m-0 w-100"
|
||||||
label="Select Organization"
|
/>
|
||||||
options={[...data]}
|
)}
|
||||||
placeholder="Choose an Organization"
|
/>
|
||||||
required
|
{errors.organizationId && (
|
||||||
labelKey="name"
|
<small className="danger-text">{errors.organizationId.message}</small>
|
||||||
valueKey="id"
|
|
||||||
value={field.value}
|
|
||||||
onChange={field.onChange}
|
|
||||||
isLoading={isLoading}
|
|
||||||
className="m-0 w-100"
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
{errors.organizationId && (
|
|
||||||
<small className="danger-text">
|
|
||||||
{errors.organizationId.message}
|
|
||||||
</small>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
{/* </div> */}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="col-12 col-md-6 mt-n2">
|
<div className="col-12 col-md-6 mt-n2">
|
||||||
<div className="d-flex flex-column">
|
<div className="d-flex flex-column">
|
||||||
|
|||||||
@ -108,64 +108,56 @@ const SubscriptionPlans = () => {
|
|||||||
if (!mod || !mod.name) return null;
|
if (!mod || !mod.name) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="accordion-item mb-2" key={mod.id}>
|
<div className="accordion-item mb-2" key={`${plan.id}-${mod.id}`}>
|
||||||
<h2 className="accordion-header" id={`heading-${mod.id}`}>
|
<h2 id={`heading-${plan.id}-${mod.id}`} className="accordion-header">
|
||||||
<button
|
<button
|
||||||
className="accordion-button collapsed py-2 d-flex justify-content-between align-items-center"
|
className="accordion-button py-2 d-flex justify-content-between align-items-center"
|
||||||
type="button"
|
type="button"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
data-bs-target={`#collapse-${mod.id}-${plan.id}`}
|
data-bs-target={`#collapse-${plan.id}-${mod.id}`}
|
||||||
aria-expanded="false"
|
aria-expanded="true"
|
||||||
aria-controls={`collapse-${mod.id}-${plan.id}`}
|
aria-controls={`collapse-${plan.id}-${mod.id}`}
|
||||||
>
|
>
|
||||||
<span className="fw-semibold d-flex align-items-center">
|
<span className="fw-semibold d-flex align-items-center">
|
||||||
{mod.enabled ? (
|
{mod.enabled ? (
|
||||||
<i className="fa-regular fa-circle-check text-success me-2"></i>
|
<i className="fa-regular fa-circle-check text-success me-2"></i>
|
||||||
) : (
|
) : (
|
||||||
<i className="fa-regular fa-circle-xmark text-danger me-2"></i>
|
<i className="fa-regular fa-circle-xmark text-danger me-2"></i>
|
||||||
)}
|
)}
|
||||||
{mod.name}
|
{mod.name}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{/* Down arrow */}
|
<i className="bx bx-chevron-down ms-2"></i>
|
||||||
<i
|
</button>
|
||||||
className="bx bx-chevron-down ms-2 transition-arrow"
|
</h2>
|
||||||
style={{ fontSize: "16px", transition: "transform 0.3s" }}
|
|
||||||
></i>
|
|
||||||
</button>
|
|
||||||
</h2>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id={`collapse-${mod.id}-${plan.id}`}
|
id={`collapse-${plan.id}-${mod.id}`}
|
||||||
className="accordion-collapse collapse"
|
className="accordion-collapse collapse show"
|
||||||
data-bs-parent={`#planFeatures-${plan.id}`}
|
aria-labelledby={`heading-${plan.id}-${mod.id}`}
|
||||||
>
|
>
|
||||||
<div className="accordion-body py-2">
|
<div className="accordion-body py-2">
|
||||||
{mod.features && mod.features.length > 0 ? (
|
{mod.features?.length > 0 ? (
|
||||||
<ul className="list-unstyled ms-2">
|
<ul className="list-unstyled ms-2">
|
||||||
{mod.features.map((feat) => (
|
{mod.features.map((feat) => (
|
||||||
<li
|
<li key={feat.id} className="d-flex align-items-start mb-1">
|
||||||
key={feat.id}
|
<i
|
||||||
className="d-flex align-items-start mb-1"
|
className={`bx bxs-circle ${
|
||||||
>
|
mod.enabled ? "text-success" : "text-danger"
|
||||||
<i
|
} me-2 mt-1`}
|
||||||
className={`fa-regular ${mod.enabled ? "bx bxs-circle text-success" : "bx bxs-circle text-danger"
|
style={{ fontSize: "8px" }}
|
||||||
} me-2 mt-1`}
|
></i>
|
||||||
style={{ fontSize: "8px" }}
|
<span>{feat.name}</span>
|
||||||
></i>
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<p className="text-muted small mb-0">No additional features</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<span>{feat.name}</span>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : (
|
|
||||||
<p className="text-muted small mb-0">
|
|
||||||
No additional features
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user