"use client"; import React, { useState } from "react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { User, Building, Save, Filter, Search, Link } from "lucide-react"; import { PageProps, LanguageTranslation, } from "@/components/validations/translations/translation"; interface ApplicationData { name: string; application_code: string; site_url: string; application_type: string; description: string; } const translations: Record = { typeSelection: { en: "Type Selection", tr: "Tür Seçimi", }, filterSelection: { en: "Filter Selection", tr: "Filtre Seçimi", }, employee: { en: "Employee", tr: "Çalışan", }, occupant: { en: "Occupant", tr: "Sakin", }, search: { en: "Search", tr: "Ara", }, siteUrl: { en: "Site URL", tr: "Site URL", }, applicationType: { en: "Application Type", tr: "Uygulama Türü", }, availableApplications: { en: "Available Applications", tr: "Mevcut Uygulamalar", }, code: { en: "Code", tr: "Kod", }, url: { en: "URL", tr: "URL", }, type: { en: "Type", tr: "Tür", }, }; const ApplicationPage: React.FC = ({ lang = "en" }) => { const [selectedType, setSelectedType] = useState<"employee" | "occupant">( "employee" ); const [selectedUrl, setSelectedUrl] = useState(""); const [selectedAppType, setSelectedAppType] = useState(""); const [searchQuery, setSearchQuery] = useState(""); const [applicationData, setApplicationData] = useState({ name: "", application_code: "", site_url: "", application_type: "", description: "", }); // Available options for dropdowns const urlOptions = [ "/dashboard", "/individual", "/user", "/settings", "/reports", ]; const typeOptions = ["info", "Dash", "Admin"]; // Handle selection button click const handleTypeSelect = (type: "employee" | "occupant") => { setSelectedType(type); }; // Handle application data input changes const handleInputChange = (name: string, value: string) => { setApplicationData({ ...applicationData, [name]: value, }); }; // Sample application data for the grid const sampleApplications = [ { name: "Dashboard", application_code: "app000001", site_url: "/dashboard", application_type: "info", description: "Dashboard Page", }, { name: "Individual", application_code: "app000003", site_url: "/individual", application_type: "Dash", description: "Individual Page for people", }, { name: "User", application_code: "app000004", site_url: "/user", application_type: "Dash", description: "Individual Page for user", }, { name: "Settings", application_code: "app000005", site_url: "/settings", application_type: "Admin", description: "Settings Page", }, { name: "Reports", application_code: "app000006", site_url: "/reports", application_type: "info", description: "Reports Page", }, ]; // Generate grid of application cards const renderApplicationGrid = () => { return sampleApplications.map((app, index) => (
{app.name}
{translations.code[lang]}: {app.application_code}
{translations.url[lang]}: {app.site_url}
{translations.type[lang]}: {app.application_type}
)); }; return (
{/* Selection Buttons */}
{/* User type selection - vertical on the left (w-1/2) */}
{translations.typeSelection[lang]}
{/* Filters on the right (w-1/2) */}
{translations.filterSelection[lang]}
{/* Search input */}
setSearchQuery(e.target.value)} className="pl-8 w-full h-10" />
{/* Site URL dropdown */}
{/* Grid of Application Cards */} {translations.availableApplications[lang]}
{renderApplicationGrid()}
{/* Application Data Form */} Application Details
handleInputChange("name", e.target.value)} />
handleInputChange("application_code", e.target.value) } />
handleInputChange("site_url", e.target.value)} />