// app/routes/dashboard.settings.tsx import { json, type LoaderFunctionArgs, type ActionFunctionArgs } from "@remix-run/node"; import { Form, useLoaderData, useNavigation } from "@remix-run/react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Button } from "~/components/ui/button"; import { Input } from "~/components/ui/input"; import { Label } from "~/components/ui/label"; import { Textarea } from "~/components/ui/textarea"; import { Separator } from "~/components/ui/separator"; import { Badge } from "~/components/ui/badge"; import { Building2, MapPin, Save, User } from "lucide-react"; // Loader untuk mengambil data profil perusahaan export async function loader({ request }: LoaderFunctionArgs) { // Simulasi data - ganti dengan query database Anda const companyProfile = { id: "1", name: "PT. Kelola Sampah Indonesia", email: "admin@kelolasampah.co.id", phone: "+62 21 1234 5678", website: "https://kelolasampah.co.id", description: "Perusahaan pengelolaan sampah terpadu dengan fokus pada daur ulang dan pengelolaan limbah yang ramah lingkungan.", address: { street: "Jl. Lingkungan Hijau No. 123", city: "Jakarta", province: "DKI Jakarta", postalCode: "12345", country: "Indonesia" }, establishedYear: "2020", licenseNumber: "LIC-2020-001" }; return json({ companyProfile }); } // Action untuk handle form submission export async function action({ request }: ActionFunctionArgs) { const formData = await request.formData(); const intent = formData.get("intent"); if (intent === "updateProfile") { // Handle update profil perusahaan const profileData = { name: formData.get("name"), email: formData.get("email"), phone: formData.get("phone"), website: formData.get("website"), description: formData.get("description"), establishedYear: formData.get("establishedYear"), licenseNumber: formData.get("licenseNumber") }; // Simulasi update - ganti dengan update database Anda console.log("Updating profile:", profileData); return json({ success: true, message: "Profil perusahaan berhasil diperbarui" }); } if (intent === "updateAddress") { // Handle update alamat const addressData = { street: formData.get("street"), city: formData.get("city"), province: formData.get("province"), postalCode: formData.get("postalCode"), country: formData.get("country") }; // Simulasi update - ganti dengan update database Anda console.log("Updating address:", addressData); return json({ success: true, message: "Alamat perusahaan berhasil diperbarui" }); } return json({ success: false, message: "Invalid action" }); } export default function SettingsPage() { const { companyProfile } = useLoaderData(); const navigation = useNavigation(); const isSubmitting = navigation.state === "submitting"; return (

Pengaturan

Kelola profil perusahaan dan informasi alamat Anda

{/* Main Grid Layout */}
{/* Left Column - Profil Perusahaan */}
Profil Perusahaan
Informasi dasar tentang perusahaan pengelola sampah