Merge branch 'Expense_TransactionId' of https://git.marcoaiot.com/admin/marco.pms.web into Weidget_Dashboard_Services
This commit is contained in:
commit
2eff34a016
@ -89,106 +89,98 @@ const AssignOrg = ({ setStep }) => {
|
||||
if (isMasterserviceLoading || isLoading)
|
||||
return <div className="text-center">Loading....</div>;
|
||||
|
||||
const showTwoColumns = startStep === 3 && flowType !== "default";
|
||||
return (
|
||||
<div className="row text-black text-start mb-3">
|
||||
{/* Left Column */}
|
||||
<div className={showTwoColumns ? "col-md-6" : "col-12"}>
|
||||
{/* Organization Info Display */}
|
||||
<div className="col-12 mb-3">
|
||||
<div className="d-flex justify-content-between align-items-center text-start mb-1">
|
||||
<div className="d-flex flex-row gap-2 align-items-center text-wrap">
|
||||
<img
|
||||
src="/public/assets/img/orgLogo.png"
|
||||
alt="logo"
|
||||
width={40}
|
||||
height={40}
|
||||
/> <p className="fw-semibold fs-5 mt-2 m-0">{orgData.name}</p>
|
||||
<div className="d-flex justify-content-between align-items-center mb-3">
|
||||
<div className="d-flex align-items-center gap-2">
|
||||
<img src="/public/assets/img/orgLogo.png" alt="logo" width={40} height={40} />
|
||||
<p className="fw-semibold fs-5 mt-2 m-0">{orgData.name}</p>
|
||||
</div>
|
||||
<div className="text-end">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleEdit}
|
||||
className="btn btn-link p-0"
|
||||
>
|
||||
<button type="button" onClick={handleEdit} className="btn btn-link p-0">
|
||||
<i className="bx bx-edit text-secondary"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="d-flex text-secondary mb-5">
|
||||
<i className="bx bx-sm bx-info-circle me-2" /> Organization Info
|
||||
</div>
|
||||
</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">
|
||||
<label
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
|
||||
<div className="mb-5 d-flex">
|
||||
<label className="form-label me-2 mb-0 fw-semibold" style={{ minWidth: "130px" }}>
|
||||
<i className="bx bx-sm bx-user me-1" /> Contact Person :
|
||||
</label>
|
||||
<div className="text-muted">{orgData.contactPerson}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-12 mb-4">
|
||||
<div className="d-flex">
|
||||
<label
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
<i className='bx bx-sm me-1 bx-phone'></i> Contact Number :
|
||||
|
||||
<div className="mb-5 d-flex">
|
||||
<label className="form-label me-2 mb-0 fw-semibold" style={{ minWidth: "130px" }}>
|
||||
<i className="bx bx-sm me-1 bx-phone" /> Contact Number :
|
||||
</label>
|
||||
<div className="text-muted">{orgData.contactNumber}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-12 mb-4">
|
||||
<div className="d-flex">
|
||||
<label
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
|
||||
<div className="mb-5 d-flex">
|
||||
<label className="form-label me-2 mb-0 fw-semibold" style={{ minWidth: "130px" }}>
|
||||
<i className='bx bx-sm me-1 bx-envelope'></i> Email Address :
|
||||
</label>
|
||||
<div className="text-muted text-wrap">{orgData.email}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12 mb-4">
|
||||
<div className="d-flex">
|
||||
<label
|
||||
className="form-label me-2 mb-0 fw-semibold"
|
||||
style={{ maxWidth: "130px" }}
|
||||
>
|
||||
<i className="bx bx-sm me-2 bx-barcode"></i>
|
||||
Service Provider Id (SPRID) :
|
||||
|
||||
<div className="mb-5 d-flex">
|
||||
<label className="form-label me-2 mb-0 fw-semibold" style={{ maxWidth: "130px" }}>
|
||||
<i className="bx bx-sm me-2 bx-barcode"></i> Service Provider Id SPRID :
|
||||
</label>
|
||||
<div className="text-muted">{orgData.sprid}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-12 mb-4">
|
||||
<div className="d-flex">
|
||||
<label
|
||||
className="form-label me-1 mb-0 fw-semibold"
|
||||
style={{ minWidth: "130px" }}
|
||||
>
|
||||
<div className="mb-5 d-flex">
|
||||
<label className="form-label me-1 mb-0 fw-semibold" style={{ minWidth: "135px" }}>
|
||||
<i className='bx bx-sm me-1 bx-map'></i> Address :
|
||||
</label>
|
||||
<div className="text-muted text-start">{orgData.address}</div>
|
||||
</div>
|
||||
<div className="text-muted">{orgData.address}</div>
|
||||
</div>
|
||||
|
||||
{/* Form */}
|
||||
<div className="text-black text-start">
|
||||
{/* Assigned Services */}
|
||||
{flowType !== "default" && projectServices?.length > 0 && (
|
||||
<div className="mb-3">
|
||||
<label className="form-label fw-semibold mb-2 d-flex align-items-center gap-1">
|
||||
<i className="bx bx-cog fs-5"></i>
|
||||
Assigned Services:
|
||||
</label>
|
||||
|
||||
<div className="d-flex flex-wrap gap-2">
|
||||
{projectServices.map((service) => (
|
||||
<span
|
||||
key={service.id}
|
||||
className="badge bg-label-secondary"
|
||||
>
|
||||
{service.name}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Right Column */}
|
||||
{showTwoColumns && (
|
||||
<div className="col-md-6">
|
||||
{/* Form Section */}
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
{/* Show fields only if flowType is NOT default */}
|
||||
{flowType !== "default" && (
|
||||
<>
|
||||
{/* Organization Type */}
|
||||
<div className="mb-3 text-start">
|
||||
<Label htmlFor="organizationTypeId" className="mb-3 fw-semibold" required>
|
||||
<div className="mb-3">
|
||||
<Label htmlFor="organizationTypeId" className="mb-2 fw-semibold" required>
|
||||
Organization Type
|
||||
</Label>
|
||||
<div className="d-flex flex-wrap gap-3 mt-1">
|
||||
{orgType?.data.map((type) => (
|
||||
<div
|
||||
key={type.id}
|
||||
className="form-check d-flex align-items-center gap-2 p-0 m-0"
|
||||
>
|
||||
<div key={type.id} className="form-check d-flex align-items-center gap-2 p-0 m-0">
|
||||
<input
|
||||
type="radio"
|
||||
id={`organizationType-${type.id}`}
|
||||
@ -196,49 +188,77 @@ const AssignOrg = ({ setStep }) => {
|
||||
{...register("organizationTypeId")}
|
||||
className="form-check-input m-0"
|
||||
/>
|
||||
<label
|
||||
className="form-check-label m-0"
|
||||
htmlFor={`organizationType-${type.id}`}
|
||||
>
|
||||
<label className="form-check-label m-0" htmlFor={`organizationType-${type.id}`}>
|
||||
{type.name}
|
||||
</label>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{errors.organizationTypeId && (
|
||||
<span className="text-danger">
|
||||
{errors.organizationTypeId.message}
|
||||
</span>
|
||||
<span className="text-danger">{errors.organizationTypeId.message}</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Services */}
|
||||
<div className="mb-3">
|
||||
<Label htmlFor="serviceIds" className="mb-3 fw-semibold" required>
|
||||
Select Services
|
||||
<div className="mb-4">
|
||||
<Label htmlFor="serviceIds" className="mb-6 fw-semibold" required>
|
||||
Choose Services
|
||||
</Label>
|
||||
{mergedServices?.map((service) => (
|
||||
<div key={service.id} className="form-check mb-3">
|
||||
|
||||
{/* FIXED HEIGHT + SCROLLBAR */}
|
||||
<div
|
||||
className="row g-3"
|
||||
style={{
|
||||
maxHeight: "290px",
|
||||
overflowY: "auto",
|
||||
paddingRight: "6px",
|
||||
}}
|
||||
>
|
||||
{mergedServices
|
||||
?.slice() // copy array
|
||||
.sort((a, b) => a.name.localeCompare(b.name))
|
||||
.map((service) => (
|
||||
<div key={service.id} className="col-12 col-md-6">
|
||||
<div className="card h-100" style={{ minHeight: "120px" }}>
|
||||
<div className="card-body d-flex align-items-start">
|
||||
<input
|
||||
type="checkbox"
|
||||
value={service.id}
|
||||
{...register("serviceIds")}
|
||||
className="form-check-input"
|
||||
className="form-check-input me-2 mt-1"
|
||||
id={`service-${service.id}`}
|
||||
/>
|
||||
<label className="form-check-label">{service.name}</label>
|
||||
|
||||
<div>
|
||||
<label
|
||||
htmlFor={`service-${service.id}`}
|
||||
className="fw-semibold mb-1 d-block"
|
||||
>
|
||||
{service.name}
|
||||
</label>
|
||||
|
||||
<small className="text-muted d-block text-wrap">
|
||||
{service.description?.length > 80
|
||||
? service.description.substring(0, 80) + "..."
|
||||
: service.description}
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{errors.serviceIds && (
|
||||
<div className="text-danger small">
|
||||
{errors.serviceIds.message}
|
||||
</div>
|
||||
{errors.serviceIds && (
|
||||
<div className="text-danger small mt-1">{errors.serviceIds.message}</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Buttons: Always visible */}
|
||||
<div className="d-flex justify-content-between mt-5">
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
{/* Buttons */}
|
||||
<div className="d-flex justify-content-between mt-6">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
@ -247,11 +267,7 @@ const AssignOrg = ({ setStep }) => {
|
||||
>
|
||||
<i className="bx bx-chevron-left"></i> Back
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-primary"
|
||||
disabled={isPending}
|
||||
>
|
||||
<button type="submit" className="btn btn-sm btn-primary" disabled={isPending}>
|
||||
{isPending
|
||||
? "Please wait..."
|
||||
: flowType === "default"
|
||||
@ -259,9 +275,8 @@ const AssignOrg = ({ setStep }) => {
|
||||
: "Assign to Project"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -148,8 +148,8 @@ const ManagOrg = () => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="mb-3 text-start">
|
||||
<Label htmlFor="email" required>
|
||||
<div className="mb-1 text-start">
|
||||
<Label htmlFor="email">
|
||||
Email Address
|
||||
</Label>
|
||||
<input
|
||||
@ -164,7 +164,7 @@ const ManagOrg = () => {
|
||||
<div className="mb-3 text-start">
|
||||
<SelectMultiple
|
||||
name="serviceIds"
|
||||
label="Select Service"
|
||||
label="Select Service Provided"
|
||||
options={service?.data}
|
||||
labelKey="name"
|
||||
valueKey="id"
|
||||
|
||||
@ -1,23 +1,22 @@
|
||||
import { useState } from "react";
|
||||
import {
|
||||
useAssignOrgToTenant,
|
||||
useOrganizationBySPRID,
|
||||
useOrganizationModal,
|
||||
} from "../../hooks/useOrganization";
|
||||
import Label from "../common/Label";
|
||||
import { useDebounce } from "../../utils/appUtils";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { spridSchema } from "./OrganizationSchema";
|
||||
import { OrgCardSkeleton } from "./OrganizationSkeleton";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
// Zod schema: only allow exactly 4 digits
|
||||
|
||||
const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||
const { onClose, startStep, flowType, onOpen, prevStep, orgData } =
|
||||
useOrganizationModal();
|
||||
const OrgPickerFromSPId = () => {
|
||||
const { onOpen, prevStep, flowType } = useOrganizationModal();
|
||||
const clientQuery = useQueryClient();
|
||||
|
||||
const [activeTab, setActiveTab] = useState("search"); // search | create
|
||||
const [SPRID, setSPRID] = useState("");
|
||||
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
@ -28,127 +27,129 @@ const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||
defaultValues: { spridSearchText: "" },
|
||||
});
|
||||
|
||||
const [SPRID, setSPRID] = useState("");
|
||||
|
||||
const { data, isLoading, isError, error, refetch } =
|
||||
useOrganizationBySPRID(SPRID);
|
||||
const { data, isLoading } = useOrganizationBySPRID(SPRID);
|
||||
|
||||
const onSubmit = (formdata) => {
|
||||
setSPRID(formdata.spridSearchText);
|
||||
};
|
||||
|
||||
const handleCrateOrg = () => {
|
||||
const handleCreateOrg = () => {
|
||||
clientQuery.removeQueries({ queryKey: ["organization"] });
|
||||
onOpen({ startStep: 4, orgData: null });
|
||||
};
|
||||
|
||||
const SP = watch("spridSearchText");
|
||||
|
||||
return (
|
||||
<div className="d-block mt-4">
|
||||
<div className="mt-4">
|
||||
{/* Tabs */}
|
||||
<ul className="nav nav-tabs mb-8">
|
||||
<li className="nav-item">
|
||||
<button
|
||||
className={`nav-link ${activeTab === "search" ? "active" : ""}`}
|
||||
onClick={() => setActiveTab("search")}
|
||||
type="button"
|
||||
>
|
||||
Search Organization
|
||||
</button>
|
||||
</li>
|
||||
<li className="nav-item">
|
||||
<button
|
||||
className={`nav-link ${activeTab === "create" ? "active" : ""}`}
|
||||
onClick={() => setActiveTab("create")}
|
||||
type="button"
|
||||
>
|
||||
Assign Organization
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{/* Tab Content */}
|
||||
{activeTab === "search" && (
|
||||
<>
|
||||
<form onSubmit={handleSubmit(onSubmit)}>
|
||||
<div className="row align-items-center g-2 mb-3">
|
||||
{/* Input Section */}
|
||||
<div className="col-12 col-md-8 d-block d-md-flex align-items-center gap-2 m-0 text-start">
|
||||
<Label className="text-nowrap mb-1 mb-md-0" required>
|
||||
Search by SPRID
|
||||
</Label>
|
||||
<div className="row align-items-end mb-3">
|
||||
|
||||
{/* Search Input */}
|
||||
<div className="col-12 col-md-8 text-start">
|
||||
<Label required className="mb-1">Search by SPRID</Label>
|
||||
<input
|
||||
type="search"
|
||||
{...register("spridSearchText")}
|
||||
className="form-control form-control-sm flex-grow-1"
|
||||
className="form-control form-control-sm"
|
||||
placeholder="Enter SPRID"
|
||||
maxLength={4}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Button Section */}
|
||||
<div className="col-12 col-md-4 text-md-start text-center mt-2 mt-md-0">
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-primary w-100 w-md-auto"
|
||||
>
|
||||
<i className="bx bx-sm bx-search-alt-2"></i> Search
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div className="text-start danger-text">
|
||||
{" "}
|
||||
{errors.spridSearchText && (
|
||||
<p className="text-danger small mt-1">
|
||||
{errors.spridSearchText.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ---- Organization list ---- */}
|
||||
{isLoading ? (
|
||||
<OrgCardSkeleton />
|
||||
) : data && data?.data.length > 0 ? (
|
||||
<div className="py-2 text-tiny text-center">
|
||||
<div className="d-flex flex-column gap-2 border-0 bg-none">
|
||||
{data.data.map((org) => (
|
||||
<div className="d-flex flex-row gap-2 text-start text-black mt-3">
|
||||
<div className="mt-1">
|
||||
<img
|
||||
src="/public/assets/img/orgLogo.png"
|
||||
alt="logo"
|
||||
width={50}
|
||||
height={50}
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex flex-column p-0 m-0 cursor-pointer mb-3">
|
||||
<span className="fs-6 fw-semibold mb-2">{org.name}</span>
|
||||
<div className="d-flex gap-2">
|
||||
<small
|
||||
className=" fw-semibold text-uppercase mb-2"
|
||||
style={{ letterSpacing: "1px" }}
|
||||
>
|
||||
SPRID :{" "}
|
||||
</small>
|
||||
<small className="fs-6">{org.sprid}</small>
|
||||
</div>
|
||||
<div className="d-flex flex-row gap-2 mb-4">
|
||||
<small className="text-small fw-semibold ">Address:</small>
|
||||
<div className="d-flex text-wrap">{org.address}</div>
|
||||
</div>
|
||||
<div className="m-0 p-0">
|
||||
{" "}
|
||||
{/* Search Button (always at end) */}
|
||||
<div className="col-12 col-md d-flex justify-content-md-end mt-2 mt-md-0">
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-primary"
|
||||
>
|
||||
<i className="bx bx-sm bx-search-alt-2 me-1"></i>
|
||||
Search
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{errors.spridSearchText && (
|
||||
<p className="text-danger small mt-1">{errors.spridSearchText.message}</p>
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<OrgCardSkeleton />
|
||||
) : data && data?.data.length > 0 ? (
|
||||
<div className="d-flex flex-column gap-2">
|
||||
{data.data.map((org) => (
|
||||
<div key={org.sprid} className="d-flex gap-2 text-start mt-5">
|
||||
<div className="mt-2"><img src="/public/assets/img/orgLogo.png" alt="logo" width={50} height={50} /></div>
|
||||
<div className="flex-grow-1">
|
||||
<span className="fs-6 fw-semibold mb-2">{org.name}</span>
|
||||
<div className="d-flex gap-2 mt-2">
|
||||
<small className="fw-semibold text-uppercase">SPRID :</small>
|
||||
<small>{org.sprid}</small>
|
||||
</div>
|
||||
<div className="d-flex gap-2 mt-2">
|
||||
<small className="fw-semibold">Address:</small>
|
||||
<div>{org.address}</div>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-primary mt-5"
|
||||
onClick={() => onOpen({ startStep: 3, orgData: org })}
|
||||
>
|
||||
Select
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : SPRID ? (
|
||||
<div className="py-3 text-center text-secondary">
|
||||
No organization found for "{SPRID}"
|
||||
</div>
|
||||
) : null}
|
||||
<div className="py-2 text-center text-tiny text-black">
|
||||
</>
|
||||
)}
|
||||
|
||||
{activeTab === "create" && (
|
||||
<div className="text-center py-5">
|
||||
<small className="d-block text-secondary">
|
||||
Do not have SPRID or could not find organization ?
|
||||
{/* Do not have SPRID or want to create a new organization? */}
|
||||
</small>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-primary mt-3"
|
||||
onClick={handleCrateOrg}
|
||||
>
|
||||
<i className="bx bx-plus-circle me-2"></i>
|
||||
Create New Organization
|
||||
<button type="button" className="btn btn-sm btn-primary" onClick={handleCreateOrg}>
|
||||
<i className="bx bx-plus-circle me-2"></i> Create New Organization
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* ---- Footer buttons ---- */}
|
||||
<div className={`d-flex text-secondary mt-3`}>
|
||||
{/* Footer Back button */}
|
||||
{flowType !== "default" && (
|
||||
<div className="d-flex text-secondary mt-7">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-xs btn-outline-secondary"
|
||||
@ -156,8 +157,8 @@ const OrgPickerFromSPId = ({ title, placeholder }) => {
|
||||
>
|
||||
<i className="bx bx-chevron-left"></i> Back
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@ -40,44 +40,46 @@ const OrgPickerfromTenant = ({ title }) => {
|
||||
const contactList = [
|
||||
{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
label: (
|
||||
<div style={{ width: "290px", maxWidth: "300px", overflow: "hidden", textOverflow: "ellipsis" }}>
|
||||
Name
|
||||
</div>
|
||||
),
|
||||
getValue: (org) => (
|
||||
<div className="d-flex gap-2 py-1 ">
|
||||
<i className="bx bx-buildings"></i>
|
||||
<span
|
||||
className="text-truncate d-inline-block "
|
||||
style={{ maxWidth: "150px" }}
|
||||
className="text-wrap d-inline-block "
|
||||
>
|
||||
{org?.name || "N/A"}
|
||||
</span>
|
||||
</div>
|
||||
),
|
||||
align: "text-start",
|
||||
align: "text-start"
|
||||
},
|
||||
{
|
||||
key: "sprid",
|
||||
label: "SPRID",
|
||||
getValue: (org) => (
|
||||
<span
|
||||
className="text-truncate d-inline-block"
|
||||
style={{ maxWidth: "200px" }}
|
||||
className="text-warp d-inline-block"
|
||||
>
|
||||
{org?.sprid || "N/A"}
|
||||
</span>
|
||||
),
|
||||
align: "text-center",
|
||||
align: "text-start",
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="d-block">
|
||||
<div className="d-flex align-items-center gap-2 mb-1">
|
||||
<div className="d-flex align-items-center gap-2 mb-4 mt-4">
|
||||
<Label className="mb-0">{title}</Label>
|
||||
<input
|
||||
type="text"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText?.(e.target.value)}
|
||||
className="form-control form-control-sm w-auto"
|
||||
className="form-control form-control-sm w-75"
|
||||
placeholder="Enter Organization Name"
|
||||
/>
|
||||
</div>
|
||||
@ -126,7 +128,8 @@ const OrgPickerfromTenant = ({ title }) => {
|
||||
onOpen({ startStep: 3, orgData: row })
|
||||
}
|
||||
>
|
||||
<i className='bx bx-right-arrow-circle text-primary'></i>
|
||||
<i className="bx bx-plus-circle text-primary"></i>
|
||||
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
@ -138,10 +141,9 @@ const OrgPickerfromTenant = ({ title }) => {
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="d-flex flex-column align-items-center text-center text-wrap text-black gap-2">
|
||||
<div className="d-flex flex-column align-items-center text-center text-wrap text-black gap-2 mt-4">
|
||||
<small className="mb-1">
|
||||
Could not find organization in your database? Please search within the
|
||||
global database.
|
||||
Could not find organization in your database? Create New Organization
|
||||
</small>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@ -22,7 +22,7 @@ import OrgPickerfromTenant from "./OrgPickerfromTenant";
|
||||
import ViewOrganization from "./ViewOrganization";
|
||||
|
||||
const OrganizationModal = () => {
|
||||
const { isOpen, orgData, startStep, onOpen, onClose, onToggle } =
|
||||
const { isOpen, orgData, startStep,flowType, onOpen, onClose, onToggle } =
|
||||
useOrganizationModal();
|
||||
const { data: masterService, isLoading } = useServices();
|
||||
const [searchText, setSearchText] = useState();
|
||||
@ -75,13 +75,13 @@ const OrganizationModal = () => {
|
||||
return "Organization Details"
|
||||
}
|
||||
|
||||
return `${orgData ? "Update":"Create"} Organization`;
|
||||
return `${orgData ? "Update" : "Assign"} Organization`;
|
||||
}, [startStep, orgData]);
|
||||
|
||||
const contentBody = (
|
||||
<div>
|
||||
{/* ---------- STEP 1: Service Provider- Form Own Tenant list ---------- */}
|
||||
{startStep === 1 && <OrgPickerfromTenant title="Find Organization" />}
|
||||
{startStep === 1 && <OrgPickerfromTenant title="Search Organization" />}
|
||||
|
||||
{startStep === 2 && (
|
||||
<OrgPickerFromSPId
|
||||
@ -106,6 +106,7 @@ const OrganizationModal = () => {
|
||||
|
||||
return (
|
||||
<Modal
|
||||
size={startStep === 3 && flowType !== "default" ? "xl" : "md"}
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
title={RenderTitle}
|
||||
|
||||
@ -15,8 +15,7 @@ export const organizationSchema = z.object({
|
||||
address: z.string().min(1, { message: "Address is required!" }),
|
||||
email: z
|
||||
.string().trim()
|
||||
.min(1, { message: "Email is required" })
|
||||
.email("Invalid email address"),
|
||||
.optional(),
|
||||
serviceIds: z
|
||||
.array(z.string())
|
||||
.min(1, { message: "Service isrequired" }),
|
||||
|
||||
@ -4,6 +4,7 @@ import { ITEMS_PER_PAGE } from "../../utils/constants";
|
||||
import Avatar from "../common/Avatar";
|
||||
import { useDebounce } from "../../utils/appUtils";
|
||||
import Pagination from "../common/Pagination";
|
||||
import { SpinnerLoader } from "../common/Loader";
|
||||
|
||||
const OrganizationsList = ({ searchText }) => {
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
@ -94,6 +95,7 @@ const OrganizationsList = ({ searchText }) => {
|
||||
|
||||
return (
|
||||
<div
|
||||
className="card-datatable table-responsive overflow-auto"
|
||||
id="horizontal-example"
|
||||
>
|
||||
<div className="dataTables_wrapper no-footer px-2 ">
|
||||
@ -143,10 +145,18 @@ const OrganizationsList = ({ searchText }) => {
|
||||
<td
|
||||
colSpan={organizationsColumns.length + 1}
|
||||
className="text-center"
|
||||
style={{ height: "250px" }}
|
||||
>
|
||||
<p className="fw-semibold">{isLoading ? "Loading...." : "Not Found Organization"}</p>
|
||||
{isLoading ? (
|
||||
<div className="d-flex justify-content-center align-items-center h-100">
|
||||
<SpinnerLoader />
|
||||
</div>
|
||||
) : (
|
||||
<p className="fw-semibold mt-3">Not Found Organization</p>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user