fixed: added array guards in mergedServices to stop iterable error
This commit is contained in:
parent
23660379c9
commit
e755faecdc
@ -33,8 +33,11 @@ const AssignOrg = ({ setStep }) => {
|
||||
});
|
||||
const isPending = isPendingProject || isPendingTenat;
|
||||
const mergedServices = useMemo(() => {
|
||||
if (!masterService || !projectServices) return [];
|
||||
const combined = [...masterService?.data, ...projectServices];
|
||||
const master = Array.isArray(masterService?.data) ? masterService.data : [];
|
||||
const project = Array.isArray(projectServices) ? projectServices : [];
|
||||
|
||||
const combined = [...master, ...project];
|
||||
|
||||
return combined.filter(
|
||||
(item, index, self) => index === self.findIndex((s) => s.id === item.id)
|
||||
);
|
||||
@ -100,7 +103,8 @@ const AssignOrg = ({ setStep }) => {
|
||||
alt="logo"
|
||||
width={40}
|
||||
height={40}
|
||||
/> <p className="fw-semibold fs-5 mt-2 m-0">{orgData.name}</p>
|
||||
/>{" "}
|
||||
<p className="fw-semibold fs-5 mt-2 m-0">{orgData.name}</p>
|
||||
</div>
|
||||
<div className="text-end">
|
||||
<button
|
||||
@ -113,7 +117,10 @@ const AssignOrg = ({ setStep }) => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="d-flex text-secondary mb-3"> <i className="bx bx-sm bx-info-circle me-2" /> Organization Info</div>
|
||||
<div className="d-flex text-secondary mb-3">
|
||||
{" "}
|
||||
<i className="bx bx-sm bx-info-circle me-2" /> Organization Info
|
||||
</div>
|
||||
{/* Contact Info */}
|
||||
<div className="col-md-12 mb-4">
|
||||
<div className="d-flex">
|
||||
@ -132,7 +139,7 @@ const AssignOrg = ({ setStep }) => {
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
<i className='bx bx-sm me-1 bx-phone'></i> Contact Number :
|
||||
<i className="bx bx-sm me-1 bx-phone"></i> Contact Number :
|
||||
</label>
|
||||
<div className="text-muted">{orgData.contactNumber}</div>
|
||||
</div>
|
||||
@ -143,7 +150,7 @@ const AssignOrg = ({ setStep }) => {
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
<i className='bx bx-sm me-1 bx-envelope'></i> Email Address :
|
||||
<i className="bx bx-sm me-1 bx-envelope"></i> Email Address :
|
||||
</label>
|
||||
<div className="text-muted text-wrap">{orgData.email}</div>
|
||||
</div>
|
||||
@ -166,7 +173,7 @@ const AssignOrg = ({ setStep }) => {
|
||||
className="form-label me-1 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
<i className='bx bx-sm me-1 bx-map'></i> Address :
|
||||
<i className="bx bx-sm me-1 bx-map"></i> Address :
|
||||
</label>
|
||||
<div className="text-muted text-start">{orgData.address}</div>
|
||||
</div>
|
||||
@ -180,7 +187,11 @@ const AssignOrg = ({ setStep }) => {
|
||||
<>
|
||||
{/* Organization Type */}
|
||||
<div className="mb-3 text-start">
|
||||
<Label htmlFor="organizationTypeId" className="mb-3 fw-semibold" required>
|
||||
<Label
|
||||
htmlFor="organizationTypeId"
|
||||
className="mb-3 fw-semibold"
|
||||
required
|
||||
>
|
||||
Organization Type
|
||||
</Label>
|
||||
<div className="d-flex flex-wrap gap-3 mt-1">
|
||||
@ -214,7 +225,11 @@ const AssignOrg = ({ setStep }) => {
|
||||
|
||||
{/* Services */}
|
||||
<div className="mb-3">
|
||||
<Label htmlFor="serviceIds" className="mb-3 fw-semibold" required>
|
||||
<Label
|
||||
htmlFor="serviceIds"
|
||||
className="mb-3 fw-semibold"
|
||||
required
|
||||
>
|
||||
Select Services
|
||||
</Label>
|
||||
{mergedServices?.map((service) => (
|
||||
@ -255,8 +270,8 @@ const AssignOrg = ({ setStep }) => {
|
||||
{isPending
|
||||
? "Please wait..."
|
||||
: flowType === "default"
|
||||
? "Assign to Organization"
|
||||
: "Assign to Project"}
|
||||
? "Assign to Organization"
|
||||
: "Assign to Project"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user