web service tenant first try

This commit is contained in:
2025-05-07 11:41:08 +03:00
parent aee9d59750
commit 4d7a6e6ec0
25 changed files with 161 additions and 80 deletions

View File

@@ -0,0 +1,27 @@
"use server";
import React from "react";
import DashboardLayout from "@/components/layouts/DashboardLayout";
import { useDashboardPage } from "@/components/common/hooks/useDashboardPage";
export default async function Dashboard({
searchParams,
}: {
searchParams: Promise<{ [key: string]: string | undefined }>;
}) {
const {
activePage,
searchParamsInstance,
lang,
PageComponent,
siteUrlsList,
} = await useDashboardPage({
pageUrl: "/management/budget/actions",
searchParams
});
return (
<DashboardLayout lang={lang} activePage={activePage} siteUrls={siteUrlsList} >
<PageComponent lang={lang} queryParams={searchParamsInstance} />
</DashboardLayout>
);
}

View File

@@ -15,7 +15,7 @@ export default async function Dashboard({
PageComponent,
siteUrlsList,
} = await useDashboardPage({
pageUrl: "/management/budget",
pageUrl: "/management/budget/status",
searchParams
});

View File

@@ -61,6 +61,24 @@ const ManagementAccounting = {
siteUrl: "/management/accounting",
};
const BuildingBudgetActions = {
name: "BuildingBudgetActions",
lg: {
tr: "Son Bakiye",
en: "Last Balance",
},
siteUrl: "/management/budget/actions",
};
const BuildingBudgetStatus = {
name: "BuildingBudgetStatus",
lg: {
tr: "Bakiye Durumu",
en: "Balance Status",
},
siteUrl: "/management/budget/status",
};
const ManagementBudget = {
name: "ManagementBudget",
lg: {
@@ -207,7 +225,7 @@ const Menu = [
tr: "Cari işlemler",
en: "Management Accounting",
},
subList: [ManagementAccounting, ManagementBudget, BuildPartsAccounting],
subList: [ManagementAccounting, ManagementBudget, BuildPartsAccounting, BuildingBudgetActions, BuildingBudgetStatus],
},
{
name: "Meetings",
@@ -215,13 +233,7 @@ const Menu = [
tr: "Toplantılar",
en: "Meetings",
},
subList: [
AnnualMeeting,
AnnualMeetingClose,
EmergencyMeeting,
EmergencyMeetingClose,
MeetingParticipations,
],
subList: [AnnualMeeting, AnnualMeetingClose, EmergencyMeeting, EmergencyMeetingClose, MeetingParticipations],
},
],
},

View File

@@ -29,19 +29,34 @@ const NavigationMenu: React.FC<NavigationMenuProps> = ({ transformedMenu, lang,
// Handle first level menu click
const handleFirstLevelClick = (index: number) => {
// Only allow collapsing if we're not on an active page or if it's dashboard
if (activePage === "/dashboard" || !activeMenuPath) {
setFirstLayerIndex(index === firstLayerIndex ? -1 : index);
setSecondLayerIndex(-1); // Reset second layer selection when first layer changes
// If this is the active menu path and not dashboard, don't allow collapsing it
if (activeMenuPath && activeMenuPath.first === index && activePage !== "/dashboard") {
// Don't collapse the active menu item
return;
}
// Otherwise allow expanding/collapsing any menu item
setFirstLayerIndex(index === firstLayerIndex ? -1 : index);
// If we're clicking on a different first level, reset second level
if (index !== firstLayerIndex) {
setSecondLayerIndex(-1);
}
};
// Handle second level menu click
const handleSecondLevelClick = (index: number) => {
// Only allow collapsing if we're not on an active page or if it's dashboard
if (activePage === "/dashboard" || !activeMenuPath) {
setSecondLayerIndex(index === secondLayerIndex ? -1 : index);
// If this is the active menu path and not dashboard, don't allow collapsing it
if (activeMenuPath &&
activeMenuPath.first === firstLayerIndex &&
activeMenuPath.second === index &&
activePage !== "/dashboard") {
// Don't collapse the active menu item
return;
}
// Otherwise allow expanding/collapsing any menu item
setSecondLayerIndex(index === secondLayerIndex ? -1 : index);
};
return (

View File

@@ -1,8 +0,0 @@
import { PageComponent } from "@/components/validations/translations/translation";
import { peopleApplications } from "./people";
import { dashboardApplications } from "./dashboard";
export const PageNavigator: Record<string, Record<string, PageComponent>> = {
"/individual": peopleApplications,
"/dashboard": dashboardApplications,
};

View File

@@ -0,0 +1,6 @@
import { PageComponent } from "@/components/validations/translations/translation";
import TenantActionsSuperUserApp from "./superusers/app";
export const tenantBudgetActionsApplications: Record<string, PageComponent> = {
app000023: TenantActionsSuperUserApp,
};

View File

@@ -0,0 +1,9 @@
import React from "react";
const TenantActionsSuperUserApp = () => {
return (
<><h1>Tenant Budget Actions</h1></>
);
};
export default TenantActionsSuperUserApp;

View File

@@ -0,0 +1,6 @@
import { PageComponent } from "@/components/validations/translations/translation";
import TenantBudgetStatusSuperUserApp from "./superusers/app";
export const tenantBudgetStatusApplications: Record<string, PageComponent> = {
app000024: TenantBudgetStatusSuperUserApp,
};

View File

@@ -0,0 +1,9 @@
import React from "react";
const TenantBudgetStatusSuperUserApp = () => {
return (
<><h1>Tenant Budget Status</h1></>
);
};
export default TenantBudgetStatusSuperUserApp;

View File

@@ -1,10 +1,12 @@
import { PageComponent } from "@/components/validations/translations/translation";
import { peopleApplications } from "./Pages/people";
import { dashboardApplications } from "./Pages/dashboard";
import { peopleApplications } from "@/eventRouters/Pages/people";
import { dashboardApplications } from "@/eventRouters/Pages/dashboard";
import { tenantBudgetActionsApplications } from "@/eventRouters/Pages/tenantActions";
import { tenantBudgetStatusApplications } from "@/eventRouters/Pages/tenantBudgetStatus";
export const menuPages: Record<string, Record<string, PageComponent>> = {
"/individual": peopleApplications,
"/dashboard": dashboardApplications,
"/management/budget/actions": tenantBudgetActionsApplications,
"/management/budget/status": tenantBudgetStatusApplications,
};
export default menuPages;

View File

@@ -1,6 +1,6 @@
import { PageProps } from "../validations/translations/translation";
import { UnAuthorizedPage } from "./unauthorizedpage";
import menuPages from "./index";
import { menuPages } from "@/eventRouters/index";
export function retrievePageByUrl(siteUrl: string, url: string): React.FC<PageProps> {
console.log("siteUrl", siteUrl, "url", url);

View File

@@ -1,27 +1,23 @@
"use client";
import { useState, useEffect } from "react";
import LoginOccupant from "./LoginOccupant";
import LoginEmployee from "./LoginEmployee";
import { useState, useEffect } from "react";
import { LanguageSelectionComponent } from "@/components/common/HeaderSelections/LanguageSelectionComponent";
import { Company, SelectListProps, BuildingMap } from "./types";
import { selectEmployeeTranslation, selectOccupantTranslation } from "./language";
import { LanguageSelectionComponent } from "@/components/common/HeaderSelections/LanguageSelectionComponent";
const Select: React.FC<SelectListProps> = ({ selectionList, isEmployee, isOccupant, language }) => {
const isEmployeeTrue = isEmployee && Array.isArray(selectionList)
const isOccupantTrue = isOccupant && !Array.isArray(selectionList)
const initTranslation = isEmployee ? selectEmployeeTranslation[language as "en" | "tr"] : selectOccupantTranslation[language as "en" | "tr"]
console.log("initTranslation", initTranslation);
const [lang, setLang] = useState(language);
const [translation, setTranslation] = useState(initTranslation);
const [listEmployeeSelection, setListEmployeeSelection] = useState<Company[]>(selectionList as Company[]);
const [listOccupantSelection, setListOccupantSelection] = useState<BuildingMap>(selectionList as BuildingMap);
console.log("translation", translation);
useEffect(() => {
if (isEmployee) { setListEmployeeSelection(selectionList as Company[]) }
else if (isOccupant) { setListOccupantSelection(selectionList as BuildingMap) }
@@ -43,7 +39,6 @@ const Select: React.FC<SelectListProps> = ({ selectionList, isEmployee, isOccupa
<div className="flex h-full min-h-[inherit] flex-col items-center justify-center gap-4">
<div className="w-full max-w-md rounded-lg bg-white p-8 shadow-md">
<h2 className="mb-6 text-center text-2xl font-bold text-gray-900">{translation?.select}</h2>
{isEmployeeTrue && <LoginEmployee translation={translation} selectionList={listEmployeeSelection} />}
{isOccupantTrue && <LoginOccupant translation={translation} selectionList={listOccupantSelection} />}
</div>