+
{children}
diff --git a/src/app/admin/organizations/[id]/page.tsx b/src/app/admin/organizations/[id]/page.tsx
new file mode 100644
index 0000000..59de245
--- /dev/null
+++ b/src/app/admin/organizations/[id]/page.tsx
@@ -0,0 +1,164 @@
+"use client"
+import { icons } from "#/assets/icons"
+import Image from "next/image"
+import axios from "axios";
+import { useSession } from "next-auth/react";
+import { useQuery } from "@tanstack/react-query";
+import { Company, CompanyById, Owner } from "#/types";
+import Link from "next/link";
+import { usePathname } from "next/navigation";
+
+
+export default function Profile() {
+
+ const pathname = usePathname();
+
+ const segments = pathname.split("/");
+ const uid = segments[segments.length - 1];
+
+
+ const { data: session, status } = useSession();
+
+ const { data: companyInfos, isLoading } = useQuery({
+ enabled: status === 'authenticated',
+ queryKey: ["companyStats", session?.user.access_token],
+ queryFn: async () => {
+ try {
+ const response = await axios.get(
+ `https://private-docs-api.intside.co/companies/${uid}`, {
+ headers: {
+ 'Authorization': `Bearer ${session?.user.access_token}`
+ },
+ params: {
+ details: true
+ }
+ }
+ );
+
+ if (response.data) {
+ return response.data as CompanyById;
+ }
+ } catch (error: any) {
+ console.error(error);
+ }
+ }
+ });
+
+ /*
+ const adminId = companyInfos?.owner;
+ console.log('will run the admin request');
+
+ const { data: adminInfos } = useQuery({
+ enabled: !!adminId && status === 'authenticated', // Only run when adminId is available
+ queryKey: ["admin", adminId], // Ensure adminId is used in the query key
+ queryFn: async () => {
+ console.log('running the admin request');
+ //console.log('url :', `https://private-docs-api.intside.co/users/${adminId}`);
+
+ try {
+ const response = await axios.get(
+ `https://private-docs-api.intside.co/users/${adminId}`, { // Use adminId instead of companyInfos
+ headers: {
+ 'Authorization': `Bearer ${session?.user.access_token}`
+ }
+ }
+ );
+
+ if (response.data) {
+ return response.data as Owner;
+ }
+ } catch (error) {
+ console.error(error);
+ }
+ }
+
+ });
+*/
+
+ return (
+ <>
+ {/* {companyInfos[0]?.id} */}
+
+
+
+
+
{companyInfos?.name || "Pentatonic"}
+
+ Modifier
+
+
+
+
Détails de l'admin
+
+
+
+
+
+
+
Adresse e-mail
+
{companyInfos?.owner?.email || "email"}
+
+
+
+
+
+
+
+
+
Prénom
+
{companyInfos?.owner?.first_name || "nom"}
+
+
+
Nom
+
{companyInfos?.owner?.last_name || "nom"}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Documents
+
{companyInfos?.total_documents || "0"}
+
+
+
+
+
+
+
+
Utilisateurs
+
{companyInfos?.total_users || "0"}
+
+
+
+
+
+
+
+
Taille des fichiers
+
{companyInfos?.total_documents_sizes + " "}GB
+
+
+
+
+
+
+
+
Dernière utilisation
+
{companyInfos?.last_use || "-"}
+
+
+
+
+
+
+ >
+ )
+}
\ No newline at end of file
diff --git a/src/app/admin/organizations/[id]/update/page.tsx b/src/app/admin/organizations/[id]/update/page.tsx
new file mode 100644
index 0000000..d7e2e60
--- /dev/null
+++ b/src/app/admin/organizations/[id]/update/page.tsx
@@ -0,0 +1,147 @@
+"use client"
+import { icons } from "#/assets/icons"
+import Image from "next/image"
+import axios from "axios";
+import { useSession } from "next-auth/react";
+import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { Company, CompanyById } from "#/types";
+import FloatingLabelInput from "#/components/floatingLabelInput";
+import { usePathname } from "next/navigation";
+import Link from "next/link";
+import Form from "#/components/form/form";
+import { adminSchema } from "#/schema/loginSchema";
+
+export default function Update() {
+
+ const pathname = usePathname();
+
+ const segments = pathname.split("/");
+ const uid = segments[segments.length - 2];
+ const queryClient = useQueryClient()
+
+
+ const { data: session, status } = useSession();
+
+ const { data: companyInfos, refetch, isLoading } = useQuery({
+ enabled: status === 'authenticated',
+ queryKey: ["companyStats", session?.user.access_token],
+ queryFn: async () => {
+ try {
+ const response = await axios.get(
+ `https://private-docs-api.intside.co/users/${uid}`, {
+ headers: {
+ 'Authorization': `Bearer ${session?.user.access_token}`
+ },
+ params: {
+ details: true
+ }
+ }
+ );
+
+ if (response.data) {
+ return response.data as CompanyById;
+ }
+ } catch (error: any) {
+ console.error(error);
+ }
+ }
+ });
+
+ const { mutate, isPending } = useMutation({
+ mutationFn: async (id: string) => {
+ try {
+ const response = await axios.delete(
+ `https://private-docs-api.intside.co/companies/${id}/`, {
+ headers: {
+ 'Authorization': `Bearer ${session?.user.access_token}`
+ }
+ }
+ )
+
+ if (response.status === 200 || response.status === 201) {
+ console.log('Suppresion réussie !')
+ }
+ } catch (error) {
+ console.error(error)
+ }
+ },
+ onSuccess: () => {
+ queryClient.invalidateQueries({ queryKey: ["companies"] })
+
+ refetch()
+ }
+ })
+
+
+ return (
+ <>
+ {/* { company.map() } */}
+
+
+ {/*