fix: tenant section

This commit is contained in:
Sabda Yagra 2025-10-02 23:51:14 +07:00
parent 863f5c0819
commit 741fe97641
1 changed files with 10 additions and 13 deletions

View File

@ -29,7 +29,6 @@ function TenantSettingsContent() {
const { checkWorkflowStatus } = useWorkflowStatusCheck();
const { showWorkflowModal } = useWorkflowModal();
// Load data on component mount
React.useEffect(() => {
loadData();
}, []);
@ -38,7 +37,7 @@ function TenantSettingsContent() {
setIsLoading(true);
try {
const [comprehensiveWorkflowRes, userLevelsRes] = await Promise.all([
getApprovalWorkflowComprehensiveDetails(4), // Using workflow ID 4 as per API example
getApprovalWorkflowComprehensiveDetails(4),
getUserLevels(),
]);
@ -60,7 +59,7 @@ function TenantSettingsContent() {
const handleWorkflowSave = async (data: CreateApprovalWorkflowWithClientSettingsRequest) => {
setIsEditingWorkflow(false);
await loadData(); // Reload data after saving
await loadData();
};
const handleUserLevelSave = async (data: UserLevelsCreateRequest) => {
@ -69,27 +68,25 @@ function TenantSettingsContent() {
if (response?.error) {
console.error("Error creating user level:", response?.message);
// You can add error handling here (e.g., show error message)
} else {
console.log("User level created successfully:", response);
// You can add success handling here (e.g., show success message)
}
} catch (error) {
console.error("Error creating user level:", error);
}
setIsUserLevelDialogOpen(false);
await loadData(); // Reload data after saving
await loadData();
};
const handleBulkUserLevelSave = async (data: UserLevelsCreateRequest[]) => {
setIsUserLevelDialogOpen(false);
await loadData(); // Reload data after saving
await loadData();
};
return (
<div className="container mx-auto p-6 space-y-6">
<div className="flex items-center justify-between">
<div className="container mx-auto p-6 space-y-6 border rounded-lg">
<div className="flex items-center justify-between ">
<div>
<h1 className="text-3xl font-bold text-gray-900">Tenant Settings</h1>
<p className="text-gray-600 mt-2">
@ -118,20 +115,20 @@ function TenantSettingsContent() {
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
<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" />
Approval Workflows
</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" />
User Levels
</TabsTrigger>
</TabsList>
{/* 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">
<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 && (
<Button
onClick={() => setIsEditingWorkflow(true)}