updated components common header layouts

This commit is contained in:
2025-05-03 13:51:02 +03:00
parent 1ce28ec5f0
commit 71c808a5c3
33 changed files with 769 additions and 809 deletions

View File

@@ -0,0 +1,8 @@
import { PageComponent } from "@/components/validations/translations/translation";
import PeopleSuperUserApp from "@/components/Pages/people/superusers/app";
export const PageNavigator: Record<string, Record<string, PageComponent>> = {
"/individual": {
app000003: PeopleSuperUserApp,
},
};

View File

@@ -0,0 +1,215 @@
// Mock data for buildings table
const buildingsMockData = [
{
uu_id: "63192f8a-0b36-49b5-a058-423eb375ab1b",
gov_address_code: "GAC12345678",
build_name: "Sunset Towers",
build_no: "A123",
max_floor: 15,
underground_floor: 2,
build_date: "2010-05-12T00:00:00Z",
decision_period_date: "2024-03-15T00:00:00Z",
tax_no: "TX123456789012",
lift_count: 3,
heating_system: true,
cooling_system: true,
hot_water_system: true,
block_service_man_count: 2,
security_service_man_count: 1,
garage_count: 25,
site_uu_id: "site-uuid-6789abcd-1234",
address_uu_id: "addr-uuid-1234-5678-abcd",
build_types_uu_id: "type-uuid-residential-apt",
},
{
uu_id: "8149fcac-3ac8-4107-acce-ef52f378a874",
gov_address_code: "GAC23456789",
build_name: "Ocean View Plaza",
build_no: "B456",
max_floor: 22,
underground_floor: 3,
build_date: "2015-07-23T00:00:00Z",
decision_period_date: "2024-05-10T00:00:00Z",
tax_no: "TX234567890123",
lift_count: 5,
heating_system: true,
cooling_system: true,
hot_water_system: true,
block_service_man_count: 3,
security_service_man_count: 2,
garage_count: 50,
site_uu_id: "site-uuid-7890bcde-2345",
address_uu_id: "addr-uuid-2345-6789-bcde",
build_types_uu_id: "type-uuid-residential-condo",
},
{
uu_id: "10fb6ffe-610b-4e7e-bb5b-b46e0946cff7",
gov_address_code: "GAC34567890",
build_name: "Parkside Heights",
build_no: "C789",
max_floor: 8,
underground_floor: 1,
build_date: "2005-11-30T00:00:00Z",
decision_period_date: "2024-04-22T00:00:00Z",
tax_no: "TX345678901234",
lift_count: 2,
heating_system: true,
cooling_system: false,
hot_water_system: true,
block_service_man_count: 1,
security_service_man_count: 1,
garage_count: 16,
site_uu_id: "site-uuid-8901cdef-3456",
address_uu_id: "addr-uuid-3456-7890-cdef",
build_types_uu_id: "type-uuid-commercial-office",
},
{
uu_id: "0447123a-8992-4e22-ba86-2f0feaa763d2",
gov_address_code: "GAC45678901",
build_name: "Riverside Apartments",
build_no: "D012",
max_floor: 12,
underground_floor: 2,
build_date: "2018-03-17T00:00:00Z",
decision_period_date: "2024-02-28T00:00:00Z",
tax_no: "TX456789012345",
lift_count: 3,
heating_system: true,
cooling_system: true,
hot_water_system: false,
block_service_man_count: 2,
security_service_man_count: 1,
garage_count: 30,
site_uu_id: "site-uuid-9012defg-4567",
address_uu_id: "addr-uuid-4567-8901-defg",
build_types_uu_id: "type-uuid-residential-apt",
},
{
uu_id: "6682a927-abb7-4d33-b877-3df170c3679c",
gov_address_code: "GAC56789012",
build_name: "Mountain View Plaza",
build_no: "E345",
max_floor: 5,
underground_floor: 0,
build_date: "2000-09-05T00:00:00Z",
decision_period_date: "2024-01-15T00:00:00Z",
tax_no: "TX567890123456",
lift_count: 1,
heating_system: true,
cooling_system: false,
hot_water_system: false,
block_service_man_count: 1,
security_service_man_count: 0,
garage_count: 8,
site_uu_id: "site-uuid-0123efgh-5678",
address_uu_id: "addr-uuid-5678-9012-efgh",
build_types_uu_id: "type-uuid-mixed-use",
},
{
uu_id: "a06fef1b-3eb7-4aed-b901-47a171a12a93",
gov_address_code: "GAC67890123",
build_name: "City Center Tower",
build_no: "F678",
max_floor: 30,
underground_floor: 4,
build_date: "2020-01-10T00:00:00Z",
decision_period_date: "2024-06-30T00:00:00Z",
tax_no: "TX678901234567",
lift_count: 8,
heating_system: true,
cooling_system: true,
hot_water_system: true,
block_service_man_count: 4,
security_service_man_count: 3,
garage_count: 100,
site_uu_id: "site-uuid-1234fghi-6789",
address_uu_id: "addr-uuid-6789-0123-fghi",
build_types_uu_id: "type-uuid-commercial-skyscraper",
},
{
uu_id: "22be0407-f6a4-456e-a183-6641d2714d73",
gov_address_code: "GAC78901234",
build_name: "Garden Villas",
build_no: "G901",
max_floor: 3,
underground_floor: 0,
build_date: "2012-06-22T00:00:00Z",
decision_period_date: "2024-03-01T00:00:00Z",
tax_no: "TX789012345678",
lift_count: 0,
heating_system: true,
cooling_system: false,
hot_water_system: true,
block_service_man_count: 1,
security_service_man_count: 0,
garage_count: 6,
site_uu_id: "site-uuid-2345ghij-7890",
address_uu_id: "addr-uuid-7890-1234-ghij",
build_types_uu_id: "type-uuid-residential-townhouse",
},
{
uu_id: "7792645f-350c-4567-8a78-190014674e6b",
gov_address_code: "GAC89012345",
build_name: "Industrial Complex",
build_no: "H234",
max_floor: 2,
underground_floor: 1,
build_date: "2008-12-05T00:00:00Z",
decision_period_date: "2024-05-15T00:00:00Z",
tax_no: "TX890123456789",
lift_count: 1,
heating_system: true,
cooling_system: false,
hot_water_system: false,
block_service_man_count: 0,
security_service_man_count: 1,
garage_count: 12,
site_uu_id: "site-uuid-3456hijk-8901",
address_uu_id: "addr-uuid-8901-2345-hijk",
build_types_uu_id: "type-uuid-industrial",
},
{
uu_id: "8de7a620-3c1e-4925-8147-3eb33a2059cc",
gov_address_code: "GAC90123456",
build_name: "Hillside Residences",
build_no: "I567",
max_floor: 10,
underground_floor: 2,
build_date: "2017-04-18T00:00:00Z",
decision_period_date: "2024-02-10T00:00:00Z",
tax_no: "TX901234567890",
lift_count: 2,
heating_system: true,
cooling_system: true,
hot_water_system: true,
block_service_man_count: 2,
security_service_man_count: 1,
garage_count: 20,
site_uu_id: "site-uuid-4567ijkl-9012",
address_uu_id: "addr-uuid-9012-3456-ijkl",
build_types_uu_id: "type-uuid-residential-apt",
},
{
uu_id: "1a680003-d005-414c-86ab-f16e090aba25",
gov_address_code: "GACA0123456",
build_name: "Tech Hub Center",
build_no: "J890",
max_floor: 18,
underground_floor: 3,
build_date: "2019-08-30T00:00:00Z",
decision_period_date: "2024-04-01T00:00:00Z",
tax_no: "TXA01234567890",
lift_count: 6,
heating_system: true,
cooling_system: true,
hot_water_system: true,
block_service_man_count: 3,
security_service_man_count: 2,
garage_count: 45,
site_uu_id: "site-uuid-5678jklm-0123",
address_uu_id: "addr-uuid-0123-4567-jklm",
build_types_uu_id: "type-uuid-commercial-office",
},
];
export default buildingsMockData;

View File

@@ -0,0 +1,36 @@
import React from "react";
import { PageProps } from "./interFaces";
const pageContext = {
tr: {
pageTitle: "Sayfa 0001",
pageDescription: "Bu, Sayfa 0001'in içeriğidir.",
},
en: {
pageTitle: "Page 0001",
pageDescription: "This is the content of Page 0001.",
},
};
function Page0001({ lang }: PageProps) {
const { pageTitle, pageDescription } =
pageContext[lang as keyof typeof pageContext];
return (
<>
<div className="flex flex-col h-screen">
<header className="bg-gray-800 text-white p-4 text-center">
<h1 className="text-2xl font-bold">{pageTitle}</h1>
</header>
<main className="flex-grow p-4 bg-gray-100">
<p className="text-gray-700">{pageDescription}</p>
</main>
<footer className="bg-gray-800 text-white p-4 text-center">
<p>&copy; 2023 My Application</p>
</footer>
</div>
</>
);
}
export default Page0001;

113
Trash/menu/leftMenu.tsx Normal file
View File

@@ -0,0 +1,113 @@
"use server";
import React from "react";
import Link from "next/link";
import { Home } from "lucide-react";
import { transformMenu, LanguageTranslation } from "@/components/menu/runner";
async function LeftMenu({
searchParams,
pageUuidList,
lang,
pageSelected,
}: {
pageUuidList: string[];
lang: keyof LanguageTranslation;
searchParams: { [key: string]: string | string[] | undefined };
pageSelected: string;
}) {
const transformedMenu = transformMenu(pageUuidList) || [];
// Get the menuContext from searchParams without setting a default value
const menuContext = searchParams?.menu;
// Only parse the indices if menuContext exists
let firstLayerIndex = -1;
let secondLayerIndex = -1;
if (menuContext) {
const indices = menuContext.toString().split("*").map(Number);
firstLayerIndex = indices[0] || 0;
secondLayerIndex = indices[1] || 0;
}
return (
<div>
<nav className="flex flex-col space-y-2">
<div className="text-xl font-bold mb-6 text-center">Dashboard</div>
{transformedMenu &&
transformedMenu.map((item, firstIndex) => (
<div key={item.name} className="mb-4">
<Link
href={`${pageSelected}?menu=${firstIndex}*0`}
className={`text-xl font-semibold pl-5 my-2 py-2 block ${
firstIndex === firstLayerIndex
? "text-emerald-600"
: "text-emerald-400"
} hover:text-emerald-600`}
>
{item.lg[lang]}
</Link>
{/* Only render the second layer if menuContext exists and this first layer item is selected */}
{menuContext && firstIndex === firstLayerIndex && (
<ul className="space-y-2">
{item.subList.map((subItem, secondIndex) => (
<div key={subItem.name}>
<Link
href={`${pageSelected}?menu=${firstIndex}*${secondIndex}`}
className={`ml-5 my-4 pl-4 text-xl font-semibold block ${
secondIndex === secondLayerIndex
? "text-emerald-700"
: "text-emerald-500"
} hover:text-emerald-700`}
>
{subItem.lg[lang]}
</Link>
{/* Only render the third layer if this second layer item is selected */}
{firstIndex === firstLayerIndex &&
secondIndex === secondLayerIndex && (
<div className="ml-5">
{subItem.subList.map((subSubItem) =>
`${pageSelected}` !== subSubItem.siteUrl ? (
<Link
key={subSubItem.name}
href={`${subSubItem?.siteUrl}?menu=${firstIndex}*${secondIndex}`}
className={`flex flex-row text-xl py-4 my-4 w-full space-x-2 p-2 rounded hover:bg-gray-200`}
>
<span className="text-gray-400">
<Home />
</span>
<span className="ml-5 text-gray-700">
{subSubItem.lg[lang]}
</span>
</Link>
) : (
<a
key={subSubItem.name}
href={`${subSubItem?.siteUrl}?menu=${firstIndex}*${secondIndex}`}
className={`flex flex-row text-xl py-4 my-4 w-full space-x-2 p-2 rounded bg-gray-100 cursor-not-allowed"`}
>
<span className="text-gray-400">
<Home />
</span>
<span className="ml-5 text-gray-700">
{subSubItem.lg[lang]}
</span>
</a>
)
)}
</div>
)}
</div>
))}
</ul>
)}
</div>
))}
</nav>
</div>
);
}
export default LeftMenu;

76
Trash/menu/runner.tsx Normal file
View File

@@ -0,0 +1,76 @@
/**
* Filters the menu structure based on intersections with provided UUIDs
* @param {string[]} uuids - Array of UUIDs to check for intersection
* @param {Array} menu - The original menu structure
* @returns {Array} - Filtered menu structure with only matching items
*/
import Menu from "@/components/menu/store"; // Assuming you have a menu structure imported
import {
MenuFirstLevel,
MenuSecondLevel,
MenuThirdLevel,
FilteredMenuFirstLevel,
FilteredMenuSecondLevel,
FilteredMenuThirdLevel,
} from "@/components/validations/translations/tr";
function transformMenu(siteUrls: string[]) {
// Process the menu structure
const filteredMenu: FilteredMenuFirstLevel[] = Menu.reduce(
(acc: FilteredMenuFirstLevel[], firstLevel: MenuFirstLevel) => {
// Create a new first level item with empty subList
const newFirstLevel: FilteredMenuFirstLevel = {
name: firstLevel.name,
lg: { ...firstLevel.lg },
subList: [],
};
// Process second level items
firstLevel.subList.forEach((secondLevel: MenuSecondLevel) => {
// Create a new second level item with empty subList
const newSecondLevel: FilteredMenuSecondLevel = {
name: secondLevel.name,
lg: { ...secondLevel.lg },
subList: [],
};
// Process third level items
secondLevel.subList.forEach((thirdLevel: MenuThirdLevel) => {
// Check if the third level's siteUrl matches exactly
if (
thirdLevel.siteUrl &&
siteUrls.some((url) => url === thirdLevel.siteUrl)
) {
// Create a modified third level item
const newThirdLevel: FilteredMenuThirdLevel = {
name: thirdLevel.name,
lg: { ...thirdLevel.lg },
siteUrl: thirdLevel.siteUrl,
};
// Add the modified third level to the second level's subList
newSecondLevel.subList.push(newThirdLevel);
}
});
// Only add the second level to the first level if it has any matching third level items
if (newSecondLevel.subList.length > 0) {
newFirstLevel.subList.push(newSecondLevel);
}
});
// Only add the first level to the result if it has any matching second level items
if (newFirstLevel.subList.length > 0) {
acc.push(newFirstLevel);
}
return acc;
},
[]
);
return filteredMenu;
}
export { transformMenu };

203
Trash/menu/store.tsx Normal file
View File

@@ -0,0 +1,203 @@
const Individual = {
name: "Individual",
lg: {
tr: "Birey",
en: "Individual",
},
siteUrl: "/individual",
};
const User = {
name: "User",
lg: {
tr: "Kullanıcı",
en: "User",
},
siteUrl: "/user",
};
const Build = {
name: "Build",
lg: {
tr: "Apartman",
en: "Build",
},
siteUrl: "/build",
};
const Dashboard = {
name: "Dashboard",
lg: {
tr: "Pano",
en: "Dashboard",
},
siteUrl: "/dashboard",
};
const BuildParts = {
name: "BuildParts",
lg: {
tr: "Daireler",
en: "Build Parts",
},
siteUrl: "/build/parts",
};
const BuildArea = {
name: "BuildArea",
lg: {
tr: "Daire Alanları",
en: "Build Area",
},
siteUrl: "/build/area",
};
const ManagementAccounting = {
name: "ManagementAccounting",
lg: {
tr: "Yönetim Cari Hareketler",
en: "ManagementAccounting",
},
siteUrl: "/management/accounting",
};
const ManagementBudget = {
name: "ManagementBudget",
lg: {
tr: "Yönetim Bütçe İşlemleri",
en: "Management Budget",
},
siteUrl: "/management/budget",
};
const BuildPartsAccounting = {
name: "BuildPartsAccounting",
lg: {
tr: "Daire Cari Hareketler",
en: "Build Parts Accounting",
},
siteUrl: "/build/parts/accounting",
};
const AnnualMeeting = {
name: "AnnualMeeting",
lg: {
tr: "Yıllık Olağan Toplantı Tanımlama ve Davet",
en: "Annual Meetings and Invitations",
},
siteUrl: "/annual/meeting",
};
const AnnualMeetingClose = {
name: "AnnualMeetingClose",
lg: {
tr: "Yıllık Olağan Toplantı kapatma ve Cari Yaratma",
en: "Annual Meeting Close and Accountings",
},
siteUrl: "/annual/meeting/close",
};
const EmergencyMeeting = {
name: "EmergencyMeeting",
lg: {
tr: "Acil Toplantı Tanımlama ve Davet",
en: "Emergency Meeting and Invitations",
},
siteUrl: "/emergency/meeting",
};
const EmergencyMeetingClose = {
name: "EmergencyMeetingClose",
lg: {
tr: "Acil Olağan Toplantı kapatma ve Cari Yaratma",
en: "Emergency Meeting Close and Accountings",
},
siteUrl: "/emergency/meeting/close",
};
const MeetingParticipations = {
name: "MeetingParticipations",
lg: {
tr: "Toplantı Katılım İşlemleri",
en: "Meeting Participations",
},
siteUrl: "/meeting/participation",
};
const Menu = [
{
name: "Dashboard",
lg: {
tr: "Pano",
en: "Dashboard",
},
subList: [
{
name: "Dashboard",
lg: {
tr: "Pano",
en: "Dashboard",
},
subList: [Dashboard],
},
],
},
{
name: "Definitions",
lg: {
tr: "Tanımlar",
en: "Definitions",
},
subList: [
{
name: "People",
lg: {
tr: "Kişiler",
en: "People",
},
subList: [Individual, User],
},
{
name: "Building",
lg: {
tr: "Binalar",
en: "Building",
},
subList: [Build, BuildParts, BuildArea],
},
],
},
{
name: "Building Management",
lg: {
tr: "Bina Yönetimi",
en: "Building Management",
},
subList: [
{
name: "Management Accounting",
lg: {
tr: "Cari işlemler",
en: "Management Accounting",
},
subList: [ManagementAccounting, ManagementBudget, BuildPartsAccounting],
},
{
name: "Meetings",
lg: {
tr: "Toplantılar",
en: "Meetings",
},
subList: [
AnnualMeeting,
AnnualMeetingClose,
EmergencyMeeting,
EmergencyMeetingClose,
MeetingParticipations,
],
},
],
},
];
export default Menu;