updated postgres and mongo updated

This commit is contained in:
2025-04-20 14:21:13 +03:00
parent 71822681f2
commit cc19cb7e6d
85 changed files with 6090 additions and 1986 deletions

View File

@@ -1,26 +0,0 @@
import React from "react";
import { PageProps } from "./interFaces";
function App000001({ lang, queryParams }: PageProps) {
return (
<>
<div className="flex">
{/* Sticky Header */}
<header className="sticky top-0 bg-white shadow-md z-10 p-4 flex justify-between items-center">
<h1 className="text-2xl font-semibold">Dashboard</h1>
<div className="flex items-center space-x-4">
{JSON.stringify({ lang, queryParams })}
<input
type="text"
placeholder="Search..."
className="border px-3 py-2 rounded-lg"
/>
<div className="w-10 h-10 bg-gray-300 rounded-full"></div>
</div>
</header>
</div>
</>
);
}
export default App000001;

View File

@@ -1,130 +0,0 @@
"use client";
import React from "react";
import { Pencil, Plus, ScanSearch } from "lucide-react";
// Define types
interface CardData {
id: number;
title: string;
description: string;
status: string;
lastUpdated: string;
}
interface CardProps {
data: CardData;
onUpdate: (id: number) => void;
}
// Mock data
const mockData: CardData[] = [
{
id: 1,
title: "Project Alpha",
description: "A cutting-edge project for automation",
status: "In Progress",
lastUpdated: "2024-03-15",
},
{
id: 2,
title: "Project Beta",
description: "Machine learning integration project",
status: "Completed",
lastUpdated: "2024-03-10",
},
{
id: 3,
title: "Project Gamma",
description: "Cloud infrastructure optimization",
status: "Planning",
lastUpdated: "2024-03-05",
},
];
// Card component
const Card: React.FC<CardProps> = ({ data, onUpdate }) => (
<div className="bg-white text-black rounded-lg shadow-md p-6 mb-4 hover:shadow-lg transition-shadow">
<div className="flex justify-between items-start">
<div>
<h3 className="text-xl font-semibold mb-2">{data.title}</h3>
<p className="mb-2">{data.description}</p>
<div className="flex items-center gap-4">
<span className="text-sm text-gray-500">Status: {data.status}</span>
<span className="text-sm text-gray-500">
Last Updated: {data.lastUpdated}
</span>
</div>
</div>
<button
onClick={() => onUpdate(data.id)}
className="text-blue-500 hover:text-blue-700 p-2"
aria-label="Update"
>
<div className="flex flex-col">
<div>
<Pencil />
</div>
<div className="mt-5">
<ScanSearch />
</div>
</div>
</button>
</div>
</div>
);
function app000002() {
const [modifyEnable, setModifyEnable] = React.useState(false);
const [selectedId, setSelectedId] = React.useState<number | null>(null);
const handleUpdate = (id: number) => {
console.log(`Update clicked for item ${id}`);
// Add your update logic here
};
const handleCreate = () => {
console.log("Create clicked");
// Add your create logic here
};
return (
<div className="container mx-auto p-6">
<div className="flex justify-between items-center mb-6">
<h1 className="text-2xl font-bold">Projects Dashboard</h1>
<button
onClick={handleCreate}
className="bg-blue-500 text-white px-4 py-2 rounded-lg flex items-center gap-2 hover:bg-blue-600 transition-colors"
>
<Plus />
Create New
</button>
</div>
{!selectedId ? (
<div className="grid gap-4">
{mockData.map((item) => (
<Card
key={item.id}
data={item}
onUpdate={() => setSelectedId(item.id)}
/>
))}
</div>
) : (
<>
<div
key={selectedId}
className="flex min-h-full justify-between items-center mb-6"
>
<input
type="text"
className="border border-gray-300 rounded-lg p-2 w-full"
placeholder="Enter new title"
/>
</div>
</>
)}
</div>
);
}
export default app000002;

View File

@@ -1,156 +0,0 @@
"use client";
import React, { useEffect } from "react";
import {
PeopleFormData,
PeopleSchema,
} from "../Pages/people/superusers/peopleschema1";
import PeoplePageForm1 from "../Pages/people/superusers/peopleform1";
import PeoplePage1 from "../Pages/people/superusers/peoplepage1";
import PeopleInfo1 from "../Pages/people/superusers/peopleinfo1";
import { peopleList } from "@/apicalls/people/people";
interface Pagination {
page: number;
size: number;
totalCount: number;
allCount: number;
totalPages: number;
orderField: string[];
orderType: string[];
pageCount: number;
}
const defaultPagination: Pagination = {
page: 1,
size: 1,
totalCount: 0,
allCount: 0,
totalPages: 0,
orderField: ["uu_id"],
orderType: ["asc"],
pageCount: 0,
};
function app000003() {
const [modifyEnable, setModifyEnable] = React.useState<boolean | null>(false);
const [isCreate, setIsCreate] = React.useState<boolean | null>(false);
const [selectedId, setSelectedId] = React.useState<string | null>(null);
const [tableData, setTableData] = React.useState<PeopleFormData[]>([]);
const [pagination, setPagination] =
React.useState<Pagination>(defaultPagination);
const fecthData = async ({
// Add any parameters if needed
page = 1,
pageSize = 10,
orderBy = ["asc"],
orderType = ["uu_id"],
query = {},
}) => {
// Simulate an API call
const result = await peopleList({
page,
size: pageSize,
orderField: orderType,
orderType: orderBy,
query: query,
});
setTableData(result?.data || []);
setPagination(result?.pagination || {});
};
const fetchDataRef = React.useCallback(({
page = 1,
pageSize = 10,
orderBy = ["asc"],
orderType = ["uu_id"],
query = {},
}) => {
peopleList({
page,
size: pageSize,
orderField: orderType,
orderType: orderBy,
query: query,
}).then(result => {
setTableData(result?.data || []);
setPagination(result?.pagination || {});
});
}, []);
useEffect(() => {
const timer = setTimeout(() => {
fetchDataRef({
page: pagination.page,
pageSize: pagination.size,
orderBy: pagination.orderField,
orderType: pagination.orderType,
query: {},
});
}, 300); // 300ms debounce
return () => clearTimeout(timer);
}, [pagination.page, pagination.size, fetchDataRef]);
const onSubmit = (data: PeopleFormData) => {
console.log("Form data:", data);
// Submit to API or do other operations
};
const handleUpdateModify = (uuid: string) => {
setSelectedId(uuid);
setModifyEnable(false);
};
const handleView = (uuid: string) => {
setSelectedId(uuid);
setModifyEnable(true);
};
return (
<>
<div className="h-screen overflow-y-auto">
<PeopleInfo1
pagination={pagination}
setPagination={setPagination}
selectedId={selectedId}
setIsCreate={() => setIsCreate(true)}
/>
{!isCreate ? (
<div className="min-w-full mx-4 p-6 rounded-lg shadow-md ">
{!selectedId ? (
<PeoplePage1
data={tableData}
handleUpdateModify={handleUpdateModify}
handleView={handleView}
/>
) : (
<PeoplePageForm1
data={tableData.find((item) => item.uu_id === selectedId) || {}}
onSubmit={onSubmit}
modifyEnable={modifyEnable}
setSelectedId={() => setSelectedId(null)}
/>
)}
</div>
) : (
<>
<PeoplePageForm1
data={{
build_date: new Date(),
decision_period_date: new Date(),
}}
onSubmit={onSubmit}
modifyEnable={modifyEnable}
setSelectedId={() => setIsCreate(null)}
/>
</>
)}
</div>
</>
);
}
export default app000003;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000004() {
return <div>app000004</div>;
}
export default app000004;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000005() {
return <div>app000005</div>;
}
export default app000005;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000006() {
return <div>app000006</div>;
}
export default app000006;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000007() {
return <div>app000007</div>;
}
export default app000007;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000008() {
return <div>app000008</div>;
}
export default app000008;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000009() {
return <div>app000009</div>;
}
export default app000009;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000010() {
return <div>app000010</div>;
}
export default app000010;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000011() {
return <div>app000011</div>;
}
export default app000011;

View File

@@ -1,9 +0,0 @@
import React from 'react'
function app000012() {
return (
<div>app000012</div>
)
}
export default app000012

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000013() {
return <div>app000013</div>;
}
export default app000013;

View File

@@ -1,9 +0,0 @@
import React from 'react'
function app000014() {
return (
<div>app000014</div>
)
}
export default app000014

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000015() {
return <div>app000015</div>;
}
export default app000015;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000016() {
return <div>app000016</div>;
}
export default app000016;

View File

@@ -1,7 +0,0 @@
import React from "react";
function app000017() {
return <div>app000017</div>;
}
export default app000017;

View File

@@ -1,9 +0,0 @@
import React from 'react'
function app000018() {
return (
<div>app000018</div>
)
}
export default app000018

View File

@@ -1,9 +0,0 @@
import React from 'react'
function app000019() {
return (
<div>app000019</div>
)
}
export default app000019

View File

@@ -1,43 +1,66 @@
import React from "react";
import { PageProps } from "./interFaces";
import App000001 from "./app000001";
import App000002 from "./app000002";
import app000003 from "./app000003";
import PeopleSuperUserApp from "../Pages/people/superusers/app";
export const PageIndex = {
app000001: App000001,
app000002: App000002,
app000003: app000003,
// Ensure all components in PageIndex accept PageProps
type PageComponent = React.ComponentType<PageProps>;
export const PageIndex: Record<string, PageComponent> = {
app000003: PeopleSuperUserApp as unknown as PageComponent,
};
function UnAuthorizedPage({ lang, queryParams }: PageProps) {
// Language dictionary for internationalization
const languageDictionary = {
en: {
title: "Unauthorized Access",
message1: "You do not have permission to access this page.",
message2: "Please contact the administrator.",
footer: `© ${new Date().getFullYear()} My Application`
},
tr: {
title: "Yetkisiz Erişim",
message1: "Bu sayfaya erişim izniniz yok.",
message2: "Lütfen yönetici ile iletişime geçin.",
footer: `© ${new Date().getFullYear()} Uygulamam`
}
};
const UnAuthorizedPage: React.FC<PageProps> = ({ lang = "en", queryParams }) => {
// Use the language dictionary based on the lang prop, defaulting to English
const t = languageDictionary[lang as keyof typeof languageDictionary] || languageDictionary.en;
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">Unauthorized Access</h1>
<h1 className="text-2xl font-bold">{t.title}</h1>
</header>
<main className="flex-grow p-4 bg-gray-100">
<p className="text-gray-700">
You do not have permission to access this page.
{t.message1}
</p>
<p className="text-gray-700">Please contact the administrator.</p>
<p className="text-gray-700">{t.message2}</p>
</main>
<footer className="bg-gray-800 text-white p-4 text-center">
<p>&copy; 2023 My Application</p>
<p>{t.footer}</p>
</footer>
</div>
</>
);
}
};
export function retrievePage(pageId: string): React.ComponentType<PageProps> {
const PageComponent = PageIndex[pageId as keyof typeof PageIndex];
if (!PageComponent) {
try {
const PageComponent = PageIndex[pageId as keyof typeof PageIndex];
if (!PageComponent) {
console.log(`Page component not found for pageId: ${pageId}`);
return UnAuthorizedPage;
}
return PageComponent;
} catch (error) {
console.error(`Error retrieving page component for pageId: ${pageId}`, error);
return UnAuthorizedPage;
}
return PageComponent;
}
export default retrievePage;