fix: tenant section
This commit is contained in:
parent
863f5c0819
commit
741fe97641
|
|
@ -29,7 +29,6 @@ function TenantSettingsContent() {
|
||||||
const { checkWorkflowStatus } = useWorkflowStatusCheck();
|
const { checkWorkflowStatus } = useWorkflowStatusCheck();
|
||||||
const { showWorkflowModal } = useWorkflowModal();
|
const { showWorkflowModal } = useWorkflowModal();
|
||||||
|
|
||||||
// Load data on component mount
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
loadData();
|
loadData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -38,7 +37,7 @@ function TenantSettingsContent() {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const [comprehensiveWorkflowRes, userLevelsRes] = await Promise.all([
|
const [comprehensiveWorkflowRes, userLevelsRes] = await Promise.all([
|
||||||
getApprovalWorkflowComprehensiveDetails(4), // Using workflow ID 4 as per API example
|
getApprovalWorkflowComprehensiveDetails(4),
|
||||||
getUserLevels(),
|
getUserLevels(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -60,7 +59,7 @@ function TenantSettingsContent() {
|
||||||
|
|
||||||
const handleWorkflowSave = async (data: CreateApprovalWorkflowWithClientSettingsRequest) => {
|
const handleWorkflowSave = async (data: CreateApprovalWorkflowWithClientSettingsRequest) => {
|
||||||
setIsEditingWorkflow(false);
|
setIsEditingWorkflow(false);
|
||||||
await loadData(); // Reload data after saving
|
await loadData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUserLevelSave = async (data: UserLevelsCreateRequest) => {
|
const handleUserLevelSave = async (data: UserLevelsCreateRequest) => {
|
||||||
|
|
@ -69,27 +68,25 @@ function TenantSettingsContent() {
|
||||||
|
|
||||||
if (response?.error) {
|
if (response?.error) {
|
||||||
console.error("Error creating user level:", response?.message);
|
console.error("Error creating user level:", response?.message);
|
||||||
// You can add error handling here (e.g., show error message)
|
|
||||||
} else {
|
} else {
|
||||||
console.log("User level created successfully:", response);
|
console.log("User level created successfully:", response);
|
||||||
// You can add success handling here (e.g., show success message)
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error creating user level:", error);
|
console.error("Error creating user level:", error);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsUserLevelDialogOpen(false);
|
setIsUserLevelDialogOpen(false);
|
||||||
await loadData(); // Reload data after saving
|
await loadData();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBulkUserLevelSave = async (data: UserLevelsCreateRequest[]) => {
|
const handleBulkUserLevelSave = async (data: UserLevelsCreateRequest[]) => {
|
||||||
setIsUserLevelDialogOpen(false);
|
setIsUserLevelDialogOpen(false);
|
||||||
await loadData(); // Reload data after saving
|
await loadData();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto p-6 space-y-6">
|
<div className="container mx-auto p-6 space-y-6 border rounded-lg">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between ">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-3xl font-bold text-gray-900">Tenant Settings</h1>
|
<h1 className="text-3xl font-bold text-gray-900">Tenant Settings</h1>
|
||||||
<p className="text-gray-600 mt-2">
|
<p className="text-gray-600 mt-2">
|
||||||
|
|
@ -118,20 +115,20 @@ function TenantSettingsContent() {
|
||||||
|
|
||||||
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
|
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
|
||||||
<TabsList className="grid w-full grid-cols-2">
|
<TabsList className="grid w-full grid-cols-2">
|
||||||
<TabsTrigger value="workflows" className="flex items-center gap-2">
|
<TabsTrigger value="workflows" className="flex items-center gap-2 border rounded-lg">
|
||||||
<WorkflowIcon className="h-4 w-4" />
|
<WorkflowIcon className="h-4 w-4" />
|
||||||
Approval Workflows
|
Approval Workflows
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="user-levels" className="flex items-center gap-2">
|
<TabsTrigger value="user-levels" className="flex items-center gap-2 border rounded-lg">
|
||||||
<UsersIcon className="h-4 w-4" />
|
<UsersIcon className="h-4 w-4" />
|
||||||
User Levels
|
User Levels
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
|
|
||||||
{/* Approval Workflows Tab */}
|
{/* Approval Workflows Tab */}
|
||||||
<TabsContent value="workflows" className="space-y-6">
|
<TabsContent value="workflows" className="space-y-6 border rounded-lg">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h2 className="text-2xl font-semibold">Approval Workflow Setup</h2>
|
<h2 className="text-2xl font-semibold ml-2 mt-4">Approval Workflow Setup</h2>
|
||||||
{workflow && !isEditingWorkflow && (
|
{workflow && !isEditingWorkflow && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setIsEditingWorkflow(true)}
|
onClick={() => setIsEditingWorkflow(true)}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue