added Tenant Profile
This commit is contained in:
parent
2d7adbac14
commit
d25cc3531e
17
src/components/Tenanat/Organization.jsx
Normal file
17
src/components/Tenanat/Organization.jsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { formatUTCToLocalTime } from '../../utils/dateUtils'
|
||||||
|
|
||||||
|
const Organization = ({data}) => {
|
||||||
|
return (
|
||||||
|
<div className='container-fluid'>
|
||||||
|
{/* <div className='col-12'>
|
||||||
|
<h4>{data?.name}</h4>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Organization
|
||||||
|
|
||||||
|
|
||||||
@ -4,6 +4,8 @@ import Label from "../common/Label";
|
|||||||
import DatePicker from "../common/DatePicker";
|
import DatePicker from "../common/DatePicker";
|
||||||
import { useCreateTenant, useIndustries } from "../../hooks/useTenant";
|
import { useCreateTenant, useIndustries } from "../../hooks/useTenant";
|
||||||
import { LogoUpload } from "./LogoUpload";
|
import { LogoUpload } from "./LogoUpload";
|
||||||
|
import { orgSize, reference } from "../../utils/constants";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
||||||
const { data, isError, isLoading: industryLoading } = useIndustries();
|
const { data, isError, isLoading: industryLoading } = useIndustries();
|
||||||
@ -40,26 +42,15 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const tenantPayload = getValues();
|
const data = getValues();
|
||||||
// onSubmitTenant(data);
|
// onSubmitTenant(data);
|
||||||
// onNext();
|
// onNext();
|
||||||
|
const tenantPayload = {...data,onBoardingDate: moment.utc(data.onBoardingDate, "DD-MM-YYYY").toISOString() }
|
||||||
CreateTenant(tenantPayload);
|
CreateTenant(tenantPayload);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const Reference = [
|
|
||||||
{ val: "google", name: "Google" },
|
|
||||||
{ val: "frined", name: "Friend" },
|
|
||||||
{ val: "advertisement", name: "Advertisement" },
|
|
||||||
{ val: "root tenant", name: "Root Tenant" },
|
|
||||||
];
|
|
||||||
const orgSize = [
|
|
||||||
{ val: "50", name: "1-50" },
|
|
||||||
{ val: "100", name: "51-100" },
|
|
||||||
{ val: "500", name: "101-500" },
|
|
||||||
{ val: "600", name: "500+" },
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="row g-2">
|
<div className="row g-2">
|
||||||
@ -74,9 +65,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
{...register("organizationName")}
|
{...register("organizationName")}
|
||||||
/>
|
/>
|
||||||
{errors.organizationName && (
|
{errors.organizationName && (
|
||||||
<div className="danger-text">
|
<div className="danger-text">{errors.organizationName.message}</div>
|
||||||
{errors.organizationName.message}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -126,43 +115,28 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
<Label htmlFor="onBoardingDate" required>
|
<Label htmlFor="onBoardingDate" required>
|
||||||
Onboarding Date
|
Onboarding Date
|
||||||
</Label>
|
</Label>
|
||||||
{/* this will upcomming from main */}
|
<DatePicker
|
||||||
{/* <DatePicker
|
|
||||||
name="onBoardingDate"
|
name="onBoardingDate"
|
||||||
control={control}
|
control={control}
|
||||||
placeholder="Select onboarding date"
|
placeholder="DD-MM-YYYY"
|
||||||
maxDate={new Date()}
|
maxDate={new Date()}
|
||||||
className={errors.onBoardingDate ? "is-invalid" : ""}
|
className={errors.onBoardingDate ? "is-invalid" : ""}
|
||||||
/>
|
|
||||||
{errors.onBoardingDate && (
|
|
||||||
<div className="invalid-feedback">{errors.onBoardingDate.message}</div>
|
|
||||||
)} */}
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="date"
|
|
||||||
id="onBoardingDate"
|
|
||||||
{...register("onBoardingDate")}
|
|
||||||
className={`form-control form-control-sm `}
|
|
||||||
/>
|
/>
|
||||||
{errors.onBoardingDate && (
|
{errors.onBoardingDate && (
|
||||||
<div className="danger-text">
|
<div className="invalid-feedback">
|
||||||
{errors.onBoardingDate.message}
|
{errors.onBoardingDate.message}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{errors.onBoardingDate && (
|
||||||
|
<div className="danger-text">{errors.onBoardingDate.message}</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
<Label htmlFor="organizationSize" required>
|
<Label htmlFor="organizationSize" required>
|
||||||
Organization Size
|
Organization Size
|
||||||
</Label>
|
</Label>
|
||||||
{/* <input
|
|
||||||
id="organizationSize"
|
|
||||||
type="number"
|
|
||||||
className={`form-control form-control-sm ${
|
|
||||||
errors.organizationSize ? "is-invalid" : ""
|
|
||||||
}`}
|
|
||||||
{...register("organizationSize")}
|
|
||||||
/> */}
|
|
||||||
|
|
||||||
<select
|
<select
|
||||||
className="form-select form-select-sm"
|
className="form-select form-select-sm"
|
||||||
@ -175,9 +149,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
{errors.organizationSize && (
|
{errors.organizationSize && (
|
||||||
<div className="danger-text">
|
<div className="danger-text">{errors.organizationSize.message}</div>
|
||||||
{errors.organizationSize.message}
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -206,18 +178,12 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
|
|
||||||
<div className="col-sm-6">
|
<div className="col-sm-6">
|
||||||
<Label htmlFor="reference">Reference</Label>
|
<Label htmlFor="reference">Reference</Label>
|
||||||
{/* <input
|
|
||||||
id="reference"
|
|
||||||
className={`form-control form-control-sm ${
|
|
||||||
errors.reference ? "is-invalid" : ""
|
|
||||||
}`}
|
|
||||||
{...register("reference")}
|
|
||||||
/> */}
|
|
||||||
<select
|
<select
|
||||||
className="form-select form-select-sm"
|
className="form-select form-select-sm"
|
||||||
{...register("reference")}
|
{...register("reference")}
|
||||||
>
|
>
|
||||||
{Reference.map((org) => (
|
{reference.map((org) => (
|
||||||
<option key={org.val} value={org.val}>
|
<option key={org.val} value={org.val}>
|
||||||
{org.name}
|
{org.name}
|
||||||
</option>
|
</option>
|
||||||
@ -267,7 +233,7 @@ const OrganizationInfo = ({ onNext, onPrev, onSubmitTenant }) => {
|
|||||||
onClick={handleNext}
|
onClick={handleNext}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
>
|
>
|
||||||
{isPending ? "Please Wait...":"Submit and Next"}
|
{isPending ? "Please Wait..." : "Submit and Next"}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,9 +1,156 @@
|
|||||||
import React from 'react'
|
import React from "react";
|
||||||
|
import { formatUTCToLocalTime } from "../../utils/dateUtils";
|
||||||
|
|
||||||
const Profile = () => {
|
const Profile = ({ data }) => {
|
||||||
|
// const {logoImage,name,domainName,contactName,contactNumber,officeNumber} = data;
|
||||||
return (
|
return (
|
||||||
<div className='container-fuid'>profile</div>
|
<div className="container-fuid">
|
||||||
)
|
<div className="row">
|
||||||
}
|
<div className="col-12 ">
|
||||||
|
<div className="d-flex flex-wrap align-items-start position-relative ">
|
||||||
|
<div className=" d-flex align-items-start gap-2">
|
||||||
|
<img
|
||||||
|
src={data.logoImage}
|
||||||
|
alt="Preview"
|
||||||
|
className="img-thumbnail rounded"
|
||||||
|
style={{ maxHeight: "35px" }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="ms-2 ">
|
||||||
|
<h4 className="m-0">{data.name}</h4>
|
||||||
|
<div className="block">
|
||||||
|
<i className="bx bx-globe text-primary bx-xs me-1"></i>
|
||||||
|
<span>{data?.domainName}</span>
|
||||||
|
</div>
|
||||||
|
<span className="badge text-bg-primary position-absolute top-0 end-0">
|
||||||
|
{data?.tenantStatus?.name}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="divider text-start">
|
||||||
|
<div className="divider-text">Profile</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
export default Profile
|
<div className="col rounded-2 bg-light justify-content-start p-2">
|
||||||
|
<p className="m-0">{data?.description}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="row ">
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center">
|
||||||
|
<i className="bx bx-sm bx-user me-1"></i>
|
||||||
|
<span className="fw-semibold">Contact Person:</span>
|
||||||
|
<span className="ms-2">{data.contactName}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center my-4 m-0">
|
||||||
|
<i className="bx bx-sm bx-envelope me-1"></i>
|
||||||
|
<span className="fw-semibold">Email:</span>
|
||||||
|
<span className="ms-2">{data.email}</span>
|
||||||
|
</div>
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center">
|
||||||
|
<i className="bx bx-sm bx-mobile me-1"></i>
|
||||||
|
<span className="fw-semibold">Contact Number:</span>
|
||||||
|
<span className="ms-2">{data.contactNumber}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-12 d-flex text-wrap align-items-start my-4 m-0">
|
||||||
|
<i className="bx bx-sm bx-mark me-1"></i>
|
||||||
|
<span className="fw-semibold">Address:</span>
|
||||||
|
<span className="ms-2">{data.billingAddress}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="divider text-start">
|
||||||
|
<div className="divider-text">Organization</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-12 d-flex align-items-center">
|
||||||
|
<i class="bx bx-sm bxs-building"></i>
|
||||||
|
<span className="fw-semibold">Industry:</span>
|
||||||
|
<span className="ms-2">{data.industry.name}</span>
|
||||||
|
</div>
|
||||||
|
<div className="row ">
|
||||||
|
{data.taxId && (
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center">
|
||||||
|
<i className="bx bx-sm bx-id-card me-1"></i>
|
||||||
|
<span className="fw-semibold">Tax Id:</span>
|
||||||
|
<span className="ms-2">{data.taxId}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center my-4 m-0">
|
||||||
|
<i className="bx bx-sm bx-group me-1"></i>
|
||||||
|
<span className="fw-semibold">Organization Size:</span>
|
||||||
|
<span className="ms-2">{data.organizationSize}</span>
|
||||||
|
</div>
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center">
|
||||||
|
<i className="bx bx-sm bxs-calendar"></i>
|
||||||
|
<span className="fw-semibold">On-Boarding Date:</span>
|
||||||
|
<span className="ms-2">
|
||||||
|
{formatUTCToLocalTime(data.onBoardingDate)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table className="table table-bordered text-center text-nowrap table-responsive my-4">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td colspan="1">
|
||||||
|
<strong>Status</strong>
|
||||||
|
</td>
|
||||||
|
<td colspan="1">
|
||||||
|
<strong>Active</strong>
|
||||||
|
</td>
|
||||||
|
<td colspan="1">
|
||||||
|
<strong>In-Progress</strong>
|
||||||
|
</td>
|
||||||
|
<td colspan="1">
|
||||||
|
<strong>On Hold</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>In-Active</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>Completed</strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<strong>Projects</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{data?.activeProjects}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{data?.inProgressProjects}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{data?.onHoldProjects}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{data?.inActiveProjects}</strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<strong>{data?.completedProjects}</strong>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center">
|
||||||
|
<i className="bx bx-sm bx-group me-1"></i>
|
||||||
|
<span className="fw-semibold">Activite Employees:</span>
|
||||||
|
<span className="ms-2">{data.activeEmployees}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="col-12 col-md-6 d-flex align-items-center my-4 m-0">
|
||||||
|
<i className="bx bx-sm bx-group me-1"></i>
|
||||||
|
<span className="fw-semibold">In-Active Employee:</span>
|
||||||
|
<span className="ms-2">{data.inActiveEmployees}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Profile;
|
||||||
|
|||||||
@ -1,28 +1,49 @@
|
|||||||
import { zodResolver } from '@hookform/resolvers/zod'
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import React from 'react'
|
import React, { useState } from "react";
|
||||||
import { FormProvider, useForm, useFormContext } from 'react-hook-form'
|
import { FormProvider, useForm, useFormContext } from "react-hook-form";
|
||||||
import { defaultFilterValues, filterSchema } from './TenantSchema'
|
import { defaultFilterValues, filterSchema } from "./TenantSchema";
|
||||||
import Label from '../common/Label'
|
import Label from "../common/Label";
|
||||||
import SelectMultiple from '../common/SelectMultiple'
|
import SelectMultiple from "../common/SelectMultiple";
|
||||||
import { useIndustries } from '../../hooks/useTenant'
|
import { useIndustries } from "../../hooks/useTenant";
|
||||||
|
import { reference } from "../../utils/constants";
|
||||||
|
import { DateRangePicker1 } from "../common/DateRangePicker";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
const TenantFilterPanel = () => {
|
const TenantFilterPanel = ({onApply}) => {
|
||||||
|
const [resetKey, setResetKey] = useState(0);
|
||||||
|
const method = useForm({
|
||||||
|
resolver: zodResolver(filterSchema),
|
||||||
|
defaultValues: defaultFilterValues,
|
||||||
|
});
|
||||||
|
const { control, register, handleSubmit, reset, watch } = method;
|
||||||
|
const { data, isError, isLoading } = useIndustries();
|
||||||
|
const closePanel = () => {
|
||||||
|
document.querySelector(".offcanvas.show .btn-close")?.click();
|
||||||
|
};
|
||||||
|
const onSubmit = (formData) => {
|
||||||
|
onApply({
|
||||||
|
...formData,
|
||||||
|
startDate: moment.utc(formData.startDate, "DD-MM-YYYY").toISOString(),
|
||||||
|
endDate: moment.utc(formData.endDate, "DD-MM-YYYY").toISOString(),
|
||||||
|
})
|
||||||
|
};
|
||||||
|
const onClear = () => {
|
||||||
|
reset(filterSchema);
|
||||||
|
setResetKey((prev) => prev + 1);
|
||||||
|
|
||||||
const method = useForm({
|
closePanel();
|
||||||
resolver:zodResolver(filterSchema),
|
};
|
||||||
defaultValues:defaultFilterValues
|
if (isLoading) return <div className="text-center">Loading...</div>;
|
||||||
})
|
|
||||||
const {control, register, handleSubmit, reset, watch} = method;
|
|
||||||
const {data,isError,isLoading} = useIndustries()
|
|
||||||
console.log(data)
|
|
||||||
const onSubmit =()=>{
|
|
||||||
|
|
||||||
}
|
|
||||||
if(isLoading) return <div className='text-center'>Loading...</div>
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...method}>
|
<FormProvider {...method}>
|
||||||
<form onsubmit={(handleSubmit(onSubmit))} >
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
<div className='text-start mb-1'>
|
<div className="text-start mb-1">
|
||||||
|
<DateRangePicker1
|
||||||
|
placeholder="DD-MM-YYYY To DD-MM-YYYY"
|
||||||
|
startField="startDate"
|
||||||
|
endField="endDate"
|
||||||
|
resetSignal={resetKey}
|
||||||
|
/>
|
||||||
<SelectMultiple
|
<SelectMultiple
|
||||||
name="industryIds"
|
name="industryIds"
|
||||||
label="Industries :"
|
label="Industries :"
|
||||||
@ -30,11 +51,36 @@ if(isLoading) return <div className='text-center'>Loading...</div>
|
|||||||
labelKey="name"
|
labelKey="name"
|
||||||
valueKey="id"
|
valueKey="id"
|
||||||
/>
|
/>
|
||||||
|
<SelectMultiple
|
||||||
|
name="references"
|
||||||
|
label="References :"
|
||||||
|
options={reference}
|
||||||
|
labelKey="name"
|
||||||
|
valueKey="val"
|
||||||
|
/>
|
||||||
|
{/* <SelectMultiple
|
||||||
|
name="references"
|
||||||
|
label="Industries :"
|
||||||
|
options={reference}
|
||||||
|
labelKey="name"
|
||||||
|
valueKey="val"
|
||||||
|
/> */}
|
||||||
|
</div>
|
||||||
|
<div className="d-flex justify-content-end py-3 gap-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-secondary btn-xs"
|
||||||
|
onClick={onClear}
|
||||||
|
>
|
||||||
|
Clear
|
||||||
|
</button>
|
||||||
|
<button type="submit" className="btn btn-primary btn-xs">
|
||||||
|
Apply
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default TenantFilterPanel
|
export default TenantFilterPanel;
|
||||||
|
|||||||
@ -101,7 +101,7 @@ const TenantForm = () => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`step-trigger ${isActive ? "active" : ""}`}
|
className={`step-trigger ${isActive ? "active" : ""}`}
|
||||||
// onClick={() => setActiveTab(index)}
|
onClick={() => setActiveTab(index)}
|
||||||
>
|
>
|
||||||
<span className="bs-stepper-circle">
|
<span className="bs-stepper-circle">
|
||||||
{isCompleted ? (
|
{isCompleted ? (
|
||||||
|
|||||||
@ -67,16 +67,16 @@ export const subscriptionDefaultValues = {
|
|||||||
|
|
||||||
export const filterSchema = z.object({
|
export const filterSchema = z.object({
|
||||||
industryIds: z.array(z.string()).optional(),
|
industryIds: z.array(z.string()).optional(),
|
||||||
createdByIds: z.array(z.string()).optional(),
|
// createdByIds: z.array(z.string()).optional(),
|
||||||
tenantStatusIds: z.array(z.string()).optional(),
|
// tenantStatusIds: z.array(z.string()).optional(),
|
||||||
references: z.array(z.string()).optional(),
|
references: z.array(z.string()).optional(),
|
||||||
startDate: z.string().optional(),
|
startDate: z.string().optional(),
|
||||||
endDate: z.string().optional(),
|
endDate: z.string().optional(),
|
||||||
});
|
});
|
||||||
export const defaultFilterValues = {
|
export const defaultFilterValues = {
|
||||||
industryIds: [],
|
industryIds: [],
|
||||||
createdByIds: [],
|
// createdByIds: [],
|
||||||
tenantStatusIds: [],
|
// tenantStatusIds: [],
|
||||||
references: [],
|
references: [],
|
||||||
startDate: "YYYY-MM-DDTHH:mm:ssZ",
|
startDate: "YYYY-MM-DDTHH:mm:ssZ",
|
||||||
endDate: "YYYY-MM-DDTHH:mm:ssZ",
|
endDate: "YYYY-MM-DDTHH:mm:ssZ",
|
||||||
|
|||||||
@ -8,12 +8,12 @@ import { TenantTableSkeleton } from "./TenanatSkeleton";
|
|||||||
import { useTenantContext } from "../../pages/Tenant/TenantPage";
|
import { useTenantContext } from "../../pages/Tenant/TenantPage";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const TenantsList = ({searchText,setIsRefetching, setRefetchFn}) => {
|
const TenantsList = ({filters,searchText,setIsRefetching, setRefetchFn}) => {
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { data, isLoading, isError, isInitialLoading, error,refetch, isFetching } = useTenants(
|
const { data, isLoading, isError, isInitialLoading, error,refetch, isFetching } = useTenants(
|
||||||
currentPage,
|
currentPage,
|
||||||
{},
|
filters,
|
||||||
searchText,
|
searchText,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ const TenantsList = ({searchText,setIsRefetching, setRefetchFn}) => {
|
|||||||
key: "name",
|
key: "name",
|
||||||
label: "Organization",
|
label: "Organization",
|
||||||
getValue: (t) => (
|
getValue: (t) => (
|
||||||
<div className="d-flex align-items-center py-1" onClick={()=>navigate(`/tenant/${t.id}`)}>
|
<div className="d-flex align-items-center py-1 cursor-pointer" onClick={()=>navigate(`/tenant/${t.id}`)}>
|
||||||
<IconButton
|
<IconButton
|
||||||
iconClass="bx bx-sm bx-building"
|
iconClass="bx bx-sm bx-building"
|
||||||
color="warning"
|
color="warning"
|
||||||
@ -95,7 +95,6 @@ const TenantsList = ({searchText,setIsRefetching, setRefetchFn}) => {
|
|||||||
{t.tenantStatus?.name || "Unknown"}
|
{t.tenantStatus?.name || "Unknown"}
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
align:"text-center"
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
if (isInitialLoading)
|
if (isInitialLoading)
|
||||||
|
|||||||
@ -23,6 +23,16 @@ export const useTenants = (pageNumber, filter = {}, searchString = "") => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useTenantDetails =(id)=>{
|
||||||
|
return useQuery({
|
||||||
|
queryKey:["Tenant",id],
|
||||||
|
queryFn:async()=>{
|
||||||
|
const response = await TenantRepository.getTenantDetails(id);
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const useIndustries=()=>{
|
export const useIndustries=()=>{
|
||||||
return useQuery({
|
return useQuery({
|
||||||
|
|||||||
@ -2,8 +2,13 @@ import React from "react";
|
|||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import Breadcrumb from "../../components/common/Breadcrumb";
|
import Breadcrumb from "../../components/common/Breadcrumb";
|
||||||
import Profile from "../../components/Tenanat/profile";
|
import Profile from "../../components/Tenanat/profile";
|
||||||
|
import { useTenantDetails } from "../../hooks/useTenant";
|
||||||
|
import Organization from "../../components/Tenanat/Organization";
|
||||||
|
import { ComingSoonPage } from "../Misc/ComingSoonPage";
|
||||||
|
|
||||||
const TenantDetails = () => {
|
const TenantDetails = () => {
|
||||||
|
const { tenantId } = useParams();
|
||||||
|
const { data, isLoading, isError, error } = useTenantDetails(tenantId);
|
||||||
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
@ -11,80 +16,41 @@ const TenantDetails = () => {
|
|||||||
label: "Profile",
|
label: "Profile",
|
||||||
icon: "bx bx-user-circle",
|
icon: "bx bx-user-circle",
|
||||||
iconSize: "bx-sm",
|
iconSize: "bx-sm",
|
||||||
content: <Profile/>,
|
content: <Profile data={data} />,
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "navs-left-org",
|
|
||||||
label: "Organization",
|
|
||||||
icon: "bx bxs-business",
|
|
||||||
iconSize: "bx-sm", // change to bx-xs, bx-md, bx-lg
|
|
||||||
content: (
|
|
||||||
<>
|
|
||||||
<p>
|
|
||||||
Icing pastry pudding oat cake. Lemon drops cotton candy caramels cake...
|
|
||||||
</p>
|
|
||||||
<p className="mb-0">
|
|
||||||
Tootsie roll fruitcake cookie. Dessert topping pie...
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "navs-left-profile",
|
|
||||||
label: "Settings",
|
|
||||||
icon: "bx bx-cog",
|
|
||||||
iconSize: "bx-sm",
|
|
||||||
content: (
|
|
||||||
<>
|
|
||||||
<p>
|
|
||||||
Donut dragée jelly pie halvah. Danish gingerbread bonbon cookie...
|
|
||||||
</p>
|
|
||||||
<p className="mb-0">
|
|
||||||
Jelly-o jelly beans icing pastry cake cake lemon drops...
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "navs-left-messages",
|
|
||||||
label: "Messages",
|
|
||||||
icon: "bx bx-message-rounded",
|
|
||||||
iconSize: "bx-sm",
|
|
||||||
content: (
|
|
||||||
<>
|
|
||||||
<p>
|
|
||||||
Oat cake chupa chups dragée donut toffee. Sweet cotton candy jelly beans...
|
|
||||||
</p>
|
|
||||||
<p className="mb-0">
|
|
||||||
Cake chocolate bar cotton candy apple pie tootsie roll...
|
|
||||||
</p>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
id: "navs-left-bill",
|
id: "navs-left-bill",
|
||||||
label: "Bill",
|
label: "Bill",
|
||||||
icon: "bx bx-receipt",
|
icon: "bx bx-receipt",
|
||||||
iconSize: "bx-sm",
|
iconSize: "bx-sm",
|
||||||
content: (
|
content: (
|
||||||
<>
|
<div className="text-center">
|
||||||
<p>
|
<ComingSoonPage />
|
||||||
Oat cake chupa chups dragée donut toffee. Sweet cotton candy jelly beans...
|
</div>
|
||||||
</p>
|
),
|
||||||
<p className="mb-0">
|
},
|
||||||
Cake chocolate bar cotton candy apple pie tootsie roll...
|
|
||||||
</p>
|
{
|
||||||
</>
|
id: "navs-left-messages",
|
||||||
|
label: "Messages",
|
||||||
|
icon: "bx bx-message-rounded",
|
||||||
|
iconSize: "bx-sm",
|
||||||
|
content: (
|
||||||
|
<div className="text-center">
|
||||||
|
<ComingSoonPage />
|
||||||
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
if (isLoading) return <div className="my-4">Loading...</div>;
|
||||||
|
if (isError) return <div>{error.message}</div>;
|
||||||
return (
|
return (
|
||||||
<div className="container-fluid py-0">
|
<div className="container-fluid py-0">
|
||||||
<Breadcrumb
|
<Breadcrumb
|
||||||
data={[
|
data={[
|
||||||
{ label: "Home", link: "/dashboard" },
|
{ label: "Home", link: "/dashboard" },
|
||||||
{ label: "Tenant", link: "/tenant" },
|
{ label: "Tenant", link: "/tenants" },
|
||||||
{ label: "Tenant Details", link: null },
|
{ label: "Tenant Details", link: null },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@ -95,7 +61,9 @@ const TenantDetails = () => {
|
|||||||
<li key={tab.id} className="nav-item">
|
<li key={tab.id} className="nav-item">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`nav-link d-flex align-items-center gap-2 ${index === 0 ? "active" : ""}`}
|
className={`nav-link d-flex align-items-center gap-2 ${
|
||||||
|
index === 0 ? "active" : ""
|
||||||
|
}`}
|
||||||
role="tab"
|
role="tab"
|
||||||
data-bs-toggle="tab"
|
data-bs-toggle="tab"
|
||||||
data-bs-target={`#${tab.id}`}
|
data-bs-target={`#${tab.id}`}
|
||||||
@ -113,7 +81,9 @@ const TenantDetails = () => {
|
|||||||
{tabs.map((tab, index) => (
|
{tabs.map((tab, index) => (
|
||||||
<div
|
<div
|
||||||
key={tab.id}
|
key={tab.id}
|
||||||
className={`tab-pane fade ${index === 0 ? "show active" : ""} text-start`}
|
className={`tab-pane fade ${
|
||||||
|
index === 0 ? "show active" : ""
|
||||||
|
} text-start`}
|
||||||
id={tab.id}
|
id={tab.id}
|
||||||
>
|
>
|
||||||
{tab.content}
|
{tab.content}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ const TenantPage = () => {
|
|||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
const [isRefetching,setRefetching] = useState(false)
|
const [isRefetching,setRefetching] = useState(false)
|
||||||
const [refetchFn, setRefetchFn] = useState(null);
|
const [refetchFn, setRefetchFn] = useState(null);
|
||||||
|
const [filters, setFilter] = useState();
|
||||||
const debouncedSearch = useDebounce(searchText, 500);
|
const debouncedSearch = useDebounce(searchText, 500);
|
||||||
const contextValue = {
|
const contextValue = {
|
||||||
};
|
};
|
||||||
@ -38,9 +39,22 @@ const TenantPage = () => {
|
|||||||
|
|
||||||
// This Hook allow us to right-side bar for filter Tenants
|
// This Hook allow us to right-side bar for filter Tenants
|
||||||
|
|
||||||
|
const methods = useForm({
|
||||||
|
resolver: zodResolver(filterSchema),
|
||||||
|
defaultValues: defaultFilterValues,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { reset } = methods;
|
||||||
|
|
||||||
|
const clearFilter = () => {
|
||||||
|
setFilter(defaultFilter);
|
||||||
|
reset();
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setShowTrigger(true);
|
setShowTrigger(true);
|
||||||
setOffcanvasContent("Tenant Filters", <TenantFilterPanel />);
|
setOffcanvasContent("Tenant Filters", <TenantFilterPanel onApply={setFilter}
|
||||||
|
|
||||||
|
clearFilter={clearFilter}/>);
|
||||||
return () => {
|
return () => {
|
||||||
setShowTrigger(false);
|
setShowTrigger(false);
|
||||||
setOffcanvasContent("", null);
|
setOffcanvasContent("", null);
|
||||||
@ -90,7 +104,7 @@ const TenantPage = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<TenantsList searchText={debouncedSearch} setIsRefetching={setRefetching}
|
<TenantsList filters={filters} searchText={debouncedSearch} setIsRefetching={setRefetching}
|
||||||
setRefetchFn={setRefetchFn}
|
setRefetchFn={setRefetchFn}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export const TenantRepository = {
|
|||||||
return api.get(`/api/Tenant/list?${params.toString()}`);
|
return api.get(`/api/Tenant/list?${params.toString()}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getTenantDetails:(id)=>api.get(`/api/Tenant/details/${id}`),
|
||||||
|
|
||||||
getSubscriptionPlan: (freq) =>
|
getSubscriptionPlan: (freq) =>
|
||||||
api.get(`/api/Tenant/list/subscription-plan?frequency=${freq}`),
|
api.get(`/api/Tenant/list/subscription-plan?frequency=${freq}`),
|
||||||
|
|||||||
@ -71,6 +71,18 @@ export const EXPENSE_MANAGEMENT = "a4e25142-449b-4334-a6e5-22f70e4732d7"
|
|||||||
export const CONSTANT_TEXT = {
|
export const CONSTANT_TEXT = {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
export const reference = [
|
||||||
|
{ val: "google", name: "Google" },
|
||||||
|
{ val: "frined", name: "Friend" },
|
||||||
|
{ val: "advertisement", name: "Advertisement" },
|
||||||
|
{ val: "root tenant", name: "Root Tenant" },
|
||||||
|
];
|
||||||
|
export const orgSize = [
|
||||||
|
{ val: "50", name: "1-50" },
|
||||||
|
{ val: "100", name: "51-100" },
|
||||||
|
{ val: "500", name: "101-500" },
|
||||||
|
{ val: "600", name: "500+" },
|
||||||
|
];
|
||||||
|
|
||||||
export const BASE_URL = process.env.VITE_BASE_URL;
|
export const BASE_URL = process.env.VITE_BASE_URL;
|
||||||
// export const BASE_URL = "https://api.marcoaiot.com";
|
// export const BASE_URL = "https://api.marcoaiot.com";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user