diff --git a/src/app/admin/organizations/profile/page.tsx b/src/app/admin/organizations/[id]/page.tsx similarity index 81% rename from src/app/admin/organizations/profile/page.tsx rename to src/app/admin/organizations/[id]/page.tsx index 2760aa1..6543c4b 100644 --- a/src/app/admin/organizations/profile/page.tsx +++ b/src/app/admin/organizations/[id]/page.tsx @@ -4,18 +4,27 @@ import Image from "next/image" import axios from "axios"; import { useSession } from "next-auth/react"; import { useQuery } from "@tanstack/react-query"; -import { adminProfile } from "#/types"; +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: adminProfile, isLoading } = useQuery({ + const { data: companyInfos, isLoading } = useQuery({ enabled: status === 'authenticated', queryKey: ["stats", session?.user.access_token], queryFn: async () => { try { const response = await axios.get( - 'https://private-docs-api.intside.co/users/me', { + `https://private-docs-api.intside.co/companies/${uid}`, { headers: { 'Authorization': `Bearer ${session?.user.access_token}` } @@ -23,21 +32,23 @@ export default function Profile() { ) if (response.data) { - return response.data as adminProfile + return response.data as CompanyById } } catch (error: any) { console.error(error) } } }) + const adminId = companyInfos?.owner + - const { data: adminOrganization } = useQuery({ + const { data: adminInfos } = useQuery({ enabled: status === 'authenticated', queryKey: ["stats", session?.user.access_token], queryFn: async () => { try { const response = await axios.get( - 'https://private-docs-api.intside.co/users/me', { + `https://private-docs-api.intside.co/users/${companyInfos}`, { headers: { 'Authorization': `Bearer ${session?.user.access_token}` } @@ -45,24 +56,24 @@ export default function Profile() { ) if (response.data) { - return response.data as adminProfile + return response.data.data as Owner } } catch (error: any) { console.error(error) } } }) - + console.log(`https://private-docs-api.intside.co/users/${companyInfos}`); + return ( <> - {/* { adminProfile.map() } */} - + {/* {companyInfos[0]?.id} */}
-

Pentatonic

+

{companyInfos?.name || "Pentatonic"}

@@ -76,7 +87,7 @@ export default function Profile() {

Adresse e-mail

-

{adminProfile?.email}

+

{adminInfos?.email || "email"}

@@ -86,11 +97,11 @@ export default function Profile() {

Prénom

-

{adminProfile?.first_name}

+

{adminInfos?.first_name || "nom"}

Nom

-

{adminProfile?.last_name}

+

{adminInfos?.last_name || "nom"}

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..bd0caac --- /dev/null +++ b/src/app/admin/organizations/[id]/update/page.tsx @@ -0,0 +1,99 @@ +"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 } from "#/types"; +import FloatingLabelInput from "#/components/floatingLabelInput"; + +export default function Update() { + + + + const { data: session, status } = useSession(); + + const { data: company, isLoading } = useQuery({ + enabled: status === 'authenticated', + queryKey: ["stats", session?.user.access_token], + queryFn: async () => { + try { + const response = await axios.get( + 'https://private-docs-api.intside.co/companies', { + headers: { + 'Authorization': `Bearer ${session?.user.access_token}` + } + } + ) + + if (response.data) { + return response.data.data as Company + } + } catch (error: any) { + console.error(error) + } + } + }) + + const { data: adminOrganization } = useQuery({ + enabled: status === 'authenticated', + queryKey: ["stats", session?.user.access_token], + queryFn: async () => { + try { + const response = await axios.get( + 'https://private-docs-api.intside.co/users/me', { + headers: { + 'Authorization': `Bearer ${session?.user.access_token}` + } + } + ) + + if (response.data) { + return response.data as Company + } + } catch (error: any) { + console.error(error) + } + } + }) + + + return ( + <> + {/* { company.map() } */} + +
+
+
+
+

Pentatonic

+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ + + +
+
+
+
+ + ) +} \ No newline at end of file diff --git a/src/app/admin/organizations/page.tsx b/src/app/admin/organizations/page.tsx index d6a7ebc..6a23f0d 100644 --- a/src/app/admin/organizations/page.tsx +++ b/src/app/admin/organizations/page.tsx @@ -4,7 +4,7 @@ import Link from "next/link"; export default function Organizations (){ return ( <> - Organization Profile + Organization Profile ) } \ No newline at end of file diff --git a/src/app/globals.css b/src/app/globals.css index e0dabe1..27f84be 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -83,7 +83,25 @@ body { background-color: var(--primary); font-size: 14px; font-weight: 600; + border: 1px solid var(--primary); border-radius: 100px; + cursor: pointer; +} + +.cta.cancel{ + color: var(--secondary); + border: 1px solid var(--gray); + background-color: var(--gray); +} + +.cta.info{ + color: var(--primary); + background-color: var(--background); +} + +.cta.danger{ + border: 1px solid var(--danger); + background-color: var(--danger); } diff --git a/src/assets/css/admin.css b/src/assets/css/admin.css index ca8a9e5..f0ed29d 100644 --- a/src/assets/css/admin.css +++ b/src/assets/css/admin.css @@ -1,3 +1,5 @@ +/* Sidebar */ + .sidebar{ border-right: 1px solid var(--cinder); position: fixed; @@ -28,6 +30,7 @@ margin-bottom: -11px; } +/* Border */ .icon-border{ border: 1px solid var(--cinder); padding: 8px; @@ -51,9 +54,12 @@ gap: 10px; } +/* Main */ + .p-container { height: 100vh; border: 1px solid var(--gray); + overflow: hidden; } .icon-rounded{ @@ -65,4 +71,16 @@ align-items: center; background-color: var(--bluegray); border-radius: 100px; +} +.labels-container{ + min-width: 100%; + display: flex; + flex-wrap: wrap; + gap: 24px; +} +.labels-container .label-container{ + width: 40%; +} +.labels-container .floating-label div.relative{ + width: 100%; } \ No newline at end of file diff --git a/src/components/floatingLabelInput.tsx b/src/components/floatingLabelInput.tsx index ca2d750..d11e439 100644 --- a/src/components/floatingLabelInput.tsx +++ b/src/components/floatingLabelInput.tsx @@ -79,7 +79,7 @@ export default function FloatingLabelInput({