people endpoints and super user events built
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import React from "react";
|
||||
import { Pencil, Plus } from "lucide-react";
|
||||
import { Pencil, Plus, ScanSearch } from "lucide-react";
|
||||
|
||||
// Define types
|
||||
interface CardData {
|
||||
@@ -43,11 +43,11 @@ const mockData: CardData[] = [
|
||||
|
||||
// Card component
|
||||
const Card: React.FC<CardProps> = ({ data, onUpdate }) => (
|
||||
<div className="bg-white rounded-lg shadow-md p-6 mb-4 hover:shadow-lg transition-shadow">
|
||||
<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="text-gray-600 mb-2">{data.description}</p>
|
||||
<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">
|
||||
@@ -60,13 +60,23 @@ const Card: React.FC<CardProps> = ({ data, onUpdate }) => (
|
||||
className="text-blue-500 hover:text-blue-700 p-2"
|
||||
aria-label="Update"
|
||||
>
|
||||
<Pencil />
|
||||
<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
|
||||
@@ -89,12 +99,30 @@ function app000002() {
|
||||
Create New
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4">
|
||||
{mockData.map((item) => (
|
||||
<Card key={item.id} data={item} onUpdate={handleUpdate} />
|
||||
))}
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,100 @@
|
||||
import React from "react";
|
||||
"use client";
|
||||
import React, { useEffect } from "react";
|
||||
import buildingsMockData from "./mock-data";
|
||||
|
||||
import { BuildingFormData } from "../Pages/build/buildschema1";
|
||||
import BuildPageForm1 from "../Pages/build/buildform1";
|
||||
import BuildPage1 from "../Pages/build/buildpage1";
|
||||
import BuildInfo1 from "../Pages/build/buildinfo1";
|
||||
|
||||
function app000003() {
|
||||
return <div>app000003</div>;
|
||||
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<BuildingFormData[]>([]);
|
||||
|
||||
const fecthData = async ({
|
||||
// Add any parameters if needed
|
||||
page = 1,
|
||||
pageSize = 10,
|
||||
orderBy = "asc",
|
||||
orderType = "name",
|
||||
query = {},
|
||||
}) => {
|
||||
// Simulate an API call
|
||||
const response = await new Promise((resolve) =>
|
||||
setTimeout(() => resolve(buildingsMockData), 1000)
|
||||
);
|
||||
setTableData(response as BuildingFormData[]);
|
||||
};
|
||||
// Fetch data when the component mounts
|
||||
|
||||
useEffect(() => {
|
||||
fecthData({
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
orderBy: "asc",
|
||||
orderType: "uu_id",
|
||||
query: {},
|
||||
});
|
||||
}, []);
|
||||
|
||||
const onSubmit = (data: BuildingFormData) => {
|
||||
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">
|
||||
<BuildInfo1
|
||||
data={tableData}
|
||||
selectedId={selectedId}
|
||||
setIsCreate={() => setIsCreate(true)}
|
||||
/>
|
||||
{!isCreate ? (
|
||||
<div className="min-w-full mx-4 p-6 rounded-lg shadow-md ">
|
||||
{!selectedId ? (
|
||||
<BuildPage1
|
||||
data={tableData}
|
||||
handleUpdateModify={handleUpdateModify}
|
||||
handleView={handleView}
|
||||
/>
|
||||
) : (
|
||||
<BuildPageForm1
|
||||
data={tableData.find((item) => item.uu_id === selectedId) || {}}
|
||||
onSubmit={onSubmit}
|
||||
modifyEnable={modifyEnable}
|
||||
setSelectedId={() => setSelectedId(null)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<BuildPageForm1
|
||||
data={{
|
||||
build_date: new Date(),
|
||||
decision_period_date: new Date(),
|
||||
}}
|
||||
onSubmit={onSubmit}
|
||||
modifyEnable={modifyEnable}
|
||||
setSelectedId={() => setIsCreate(null)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default app000003;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import React from "react";
|
||||
import App000001 from "./app000001";
|
||||
import App000002 from "./app000002";
|
||||
|
||||
import { PageProps } from "./interFaces";
|
||||
|
||||
export const PageIndexs = {
|
||||
import App000001 from "./app000001";
|
||||
import App000002 from "./app000002";
|
||||
import app000003 from "./app000003";
|
||||
|
||||
export const PageIndex = {
|
||||
app000001: App000001,
|
||||
app000002: App000002,
|
||||
app000003: app000003,
|
||||
};
|
||||
|
||||
function UnAuthorizedPage({ lang, queryParams }: PageProps) {
|
||||
@@ -30,12 +32,8 @@ function UnAuthorizedPage({ lang, queryParams }: PageProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export function retrievePage({
|
||||
pageId,
|
||||
}: {
|
||||
pageId: string;
|
||||
}): React.ComponentType<PageProps> {
|
||||
const PageComponent = PageIndexs[pageId as keyof typeof PageIndexs];
|
||||
export function retrievePage(pageId: string): React.ComponentType<PageProps> {
|
||||
const PageComponent = PageIndex[pageId as keyof typeof PageIndex];
|
||||
if (!PageComponent) {
|
||||
return UnAuthorizedPage;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user