diff --git a/apps/web/src/app/[lang]/app/[type]/breadcrumb.tsx b/apps/web/src/app/[lang]/app/[type]/breadcrumb.tsx deleted file mode 100644 index 03a37be14..000000000 --- a/apps/web/src/app/[lang]/app/[type]/breadcrumb.tsx +++ /dev/null @@ -1,56 +0,0 @@ -"use client"; - -import { usePathname } from "next/navigation"; -import { BreadcrumbNavigation } from "@repo/ui/theme/breadcrumb-navigation"; -import type { NavbarItemType } from "@repo/ui/theme/types"; -import { useMemo } from "react"; - -export function getActiveSubNavbarItem( - navbarItem: NavbarItemType | undefined, - pathName: string, -) { - if (!navbarItem?.subNavbarItems) return null; - - if (navbarItem.key === "/") { - return navbarItem.subNavbarItems.find((item) => - pathName.startsWith(item.key), - ); - } - - const tempPath = pathName.split(`${navbarItem.key}/`)[1]?.split("/")[0]; - if (!tempPath) return null; - - const subPath = `${navbarItem.key}/${tempPath}`; - return navbarItem.subNavbarItems.find((item) => item.key === subPath); -} -//Yeni tasarıma göre yapıldı, eski tasarıma uyarlandı, değişecek. -export function BreadcrumbCallback({ - navbarItems, -}: { - navbarItems: NavbarItemType[]; -}) { - const pathName = usePathname(); - const { - navigation, - // mainNavbarItem, - // subNavbarItem, - // sectionNavbarItem, - // activeNavbarItem, - } = useMemo(() => { - const nav: NavbarItemType[] = [navbarItems[0]]; - let navItem = getActiveSubNavbarItem(nav[0], pathName); - while (navItem) { - nav.push(navItem); - navItem = getActiveSubNavbarItem(navItem, pathName); - } - return { - navigation: nav, - // mainNavbarItem: nav?.[1], - // subNavbarItem: nav?.[2], - // sectionNavbarItem: nav?.[3], - // activeNavbarItem: nav?.[nav.length - 1], - }; - }, [navbarItems, pathName]); - - return ; -} diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/layout.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/layout.tsx deleted file mode 100644 index 0b1314345..000000000 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/layout.tsx +++ /dev/null @@ -1,109 +0,0 @@ -"use client"; - -import type { ISection } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import { - SectionLayout, - SectionLayoutContent, -} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { useEffect, useState } from "react"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; -import { getResourceDataClient } from "src/language-data/CRMService"; -import { useLocale } from "src/providers/locale"; -import { getBaseLink } from "src/utils"; -import { dataConfigOfCrm } from "../../data"; - -interface LayoutProps { - children: JSX.Element; - params: { - lang: string; - type: string; - data: string; - }; -} - -type SectionNavbarItems = ISection[]; - -export default function Layout({ children, params }: LayoutProps) { - const [navbarItems, setNavbarItems] = useState([]); - const { resources } = useLocale(); - const languageData = getResourceDataClient(resources, params.lang); - const pathname = usePathname(); - const path = pathname.split("crm/")[1]; - - //TODO make this page serverside - useEffect(() => { - const tempNavbarItems = Object.entries(dataConfigOfCrm.companies.pages) - .filter(([e]) => e !== "displayName" && e !== "default") - .map(([key, value]: [string, unknown]) => { - let name = ""; - if ( - value && - typeof value === "object" && - "title" in value && - typeof value.title === "string" - ) { - name = - languageData[ - value.title.replaceAll(" ", "") as keyof typeof languageData - ]; - } - return { - id: key, - name: name || key, - link: getBaseLink(`crm/${key}`, true, params.lang, true, params.type), - }; - }); - setNavbarItems(tempNavbarItems); - }, []); - - function pageHeaderData() { - if (params.data === "merchants") { - return { - title: languageData.Merchants, - description: languageData["Merchants.Description"], - }; - } - if (params.data === "refund-points") { - return { - title: languageData.RefundPoints, - description: languageData["RefundPoints.Description"], - }; - } - if (params.data === "tax-free") { - return { - title: languageData.TaxFree, - description: languageData["TaxFree.Description"], - }; - } - if (params.data === "tax-offices") { - return { - title: languageData.TaxOffices, - description: languageData["TaxOffices.Description"], - }; - } - return { - title: languageData.Customs, - description: languageData["Customs.Description"], - }; - } - const { title, description } = pageHeaderData(); - - return ( - <> - - {navbarItems.length > 0 && ( - - - {children} - - - )} - - ); -} diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/action.ts b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/action.ts new file mode 100644 index 000000000..4a60adea4 --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/action.ts @@ -0,0 +1,115 @@ +"use server"; +import type { + ApiError, + UniRefund_CRMService_AddressTypes_UpdateAddressTypeDto, + UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, + UniRefund_CRMService_Organizations_UpdateOrganizationDto, + UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto, +} from "@ayasofyazilim/saas/CRMService"; +import { revalidatePath } from "next/cache"; +import { getCRMServiceClient } from "src/lib"; + +export async function getCRMMerchantDetailServer(body: { id: string }) { + "use server"; + const response = await getCRMServiceClient().then((client) => + client.merchant + .getApiCrmServiceMerchantsByIdDetail({ + id: body.id, + }) + .then((apiResponse) => { + return { + data: apiResponse, + status: 200, + }; + }) + .catch((error: ApiError) => { + return { + data: error, + status: error.status, + }; + }), + ); + revalidatePath("/"); + return response; +} +export async function getCRMDetailServer(data: string, body: { id: string }) { + "use server"; + const client = await getCRMServiceClient(); + let response; + if (data === "refund-points") { + response = await client.refundPoint.getApiCrmServiceRefundPointsByIdDetail({ + id: body.id, + }); + } else if (data === "customs") { + response = await client.customs.getApiCrmServiceCustomsByIdDetail({ + id: body.id, + }); + } else if (data === "tax-free") { + response = await client.taxFree.getApiCrmServiceTaxFreesByIdDetail({ + id: body.id, + }); + } else if (data === "tax-offices") { + response = await client.taxOffice.getApiCrmServiceTaxOfficesByIdDetail({ + id: body.id, + }); + } + revalidatePath("/"); + return { + data: response, + status: 200, + }; +} +export async function updateMerchantCRMDetailServer( + id: string, + organizationId: string, + type: "merchant", + requestBody: UniRefund_CRMService_Organizations_UpdateOrganizationDto, +) { + "use server"; + try { + const client = await getCRMServiceClient(); + await client.merchant.putApiCrmServiceMerchantsByIdOrganizationsByOrganizationId( + { + id, + organizationId, + requestBody, + }, + ); + revalidatePath("/"); + return true; + } catch (error) { + return error; + } +} +export async function updateCRMDetailServer( + id: string, + requestBody: + | UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto + | UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto + | UniRefund_CRMService_AddressTypes_UpdateAddressTypeDto, +) { + "use server"; + try { + const client = await getCRMServiceClient(); + if ("emailAddress" in requestBody) { + await client.emailCommonData.putApiCrmServiceEmailsById({ + id, + requestBody, + }); + } else if ("addressLine" in requestBody) { + await client.addressType.putApiCrmServiceAddressesById({ + id, + requestBody, + }); + } else if ("localNumber" in requestBody) { + await client.telephoneType.putApiCrmServiceTelephonesById({ + id, + requestBody, + }); + } + revalidatePath("/"); + return true; + } catch (error) { + return error; + } +} diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/form.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/form.tsx similarity index 94% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/form.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/form.tsx index b42f12ab9..7303c6c6b 100644 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/form.tsx +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/form.tsx @@ -1,9 +1,18 @@ "use client"; import { Card } from "@/components/ui/card"; import { toast } from "@/components/ui/sonner"; +import type { + UniRefund_CRMService_AddressTypes_UpdateAddressTypeDto, + UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, + UniRefund_CRMService_Merchants_MerchantDto, + UniRefund_CRMService_Organizations_UpdateOrganizationDto, + UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto, + Volo_Abp_Application_Dtos_PagedResultDto_15, + Volo_Abp_Application_Dtos_PagedResultDto_18, +} from "@ayasofyazilim/saas/CRMService"; +import { $UniRefund_CRMService_Individuals_IndividualProfileDto } from "@ayasofyazilim/saas/CRMService"; import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; import jsonToCSV from "@repo/ayasofyazilim-ui/lib/json-to-csv"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; import type { TableAction } from "@repo/ayasofyazilim-ui/molecules/tables"; import DataTable from "@repo/ayasofyazilim-ui/molecules/tables"; import AutoForm, { @@ -13,29 +22,17 @@ import { SectionLayout, SectionLayoutContent, } from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import type { - UniRefund_CRMService_Merchants_MerchantDto, - Volo_Abp_Application_Dtos_PagedResultDto_18, - Volo_Abp_Application_Dtos_PagedResultDto_15, - UniRefund_CRMService_Organizations_UpdateOrganizationDto, - UniRefund_CRMService_EmailCommonDatas_UpdateEmailCommonDataDto, - UniRefund_CRMService_TelephoneTypes_UpdateTelephoneTypeDto, - UniRefund_CRMService_AddressTypes_UpdateAddressTypeDto, -} from "@ayasofyazilim/saas/CRMService"; -import { $UniRefund_CRMService_Individuals_IndividualProfileDto } from "@ayasofyazilim/saas/CRMService"; import { getResourceDataClient } from "src/language-data/CRMService"; import { useLocale } from "src/providers/locale"; -import type { TableData } from "src/utils"; import { getBaseLink } from "src/utils"; import { isPhoneValid, splitPhone } from "src/utils-phone"; import { deleteSubMerchantByMerchantId, getAllIndividuals, getSubCompanyByMerchantId, -} from "../../../actions/merchant"; +} from "../../actions/merchant"; import { address, dataConfigOfCrm, @@ -43,11 +40,11 @@ import { localNumber, organization, telephone, -} from "../../../data"; +} from "../../data"; import { updateCRMDetailServer, updateMerchantCRMDetailServer, -} from "../../../actions/action"; +} from "../../actions/action"; export default function Form({ crmDetailData, @@ -60,9 +57,6 @@ export default function Form({ lang: string; }; }) { - const [formData] = useState( - dataConfigOfCrm.companies.pages[params.data], - ); const router = useRouter(); const [SubCompaniesData, setSubCompaniesData] = useState(); @@ -246,20 +240,6 @@ export default function Form({ return (
- { void handleIndividualSave(val as CreateIndividualDto); diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/page.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/page.tsx similarity index 96% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/page.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/page.tsx index c2518bedc..24cb68eb0 100644 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/page.tsx @@ -2,7 +2,7 @@ import { getCRMDetailServer, getCRMMerchantDetailServer, -} from "../../../actions/action"; +} from "../../actions/action"; import Form from "./form"; async function getCrmDetailData(data: string, id: string) { diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/subcompany/new/layout.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/subcompany/new/layout.tsx similarity index 100% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/subcompany/new/layout.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/subcompany/new/layout.tsx diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/subcompany/new/page.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/subcompany/new/page.tsx similarity index 98% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/subcompany/new/page.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/subcompany/new/page.tsx index 3b4217c0e..73eb7d5bd 100644 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/[id]/subcompany/new/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/[id]/subcompany/new/page.tsx @@ -9,7 +9,7 @@ import { getBaseLink } from "src/utils"; import { isPhoneValid, splitPhone } from "src/utils-phone"; import { getResourceDataClient } from "src/language-data/CRMService"; import { useLocale } from "src/providers/locale"; -import { dataConfigOfCrm } from "../../../../../data"; +import { dataConfigOfCrm } from "../../../../data"; import type { CreateOrganizationDto } from "../../../new/page"; interface FormSchema { diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/new/page.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/new/page.tsx similarity index 64% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/new/page.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/new/page.tsx index 54d5d300e..6ed333dc4 100644 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(alternative)/new/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/new/page.tsx @@ -1,21 +1,18 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access -- TODO: we need to fix this*/ "use client"; -import { Card, CardContent } from "@/components/ui/card"; import { toast } from "@/components/ui/sonner"; import { createZodObject } from "@repo/ayasofyazilim-ui/lib/create-zod-object"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; import AutoForm, { AutoFormSubmit, } from "@repo/ayasofyazilim-ui/organisms/auto-form"; -import Link from "next/link"; import { useRouter } from "next/navigation"; import { useState } from "react"; +import { getResourceDataClient } from "src/language-data/CRMService"; +import { useLocale } from "src/providers/locale"; import type { TableData } from "src/utils"; import { getBaseLink } from "src/utils"; import { isPhoneValid, splitPhone } from "src/utils-phone"; -import { getResourceDataClient } from "src/language-data/CRMService"; -import { useLocale } from "src/providers/locale"; -import { dataConfigOfCrm } from "../../../data"; +import { dataConfigOfCrm } from "../../data"; export interface CreateOrganizationDto { organization: Record; @@ -125,63 +122,41 @@ export default function Page({ }; return ( - <> - -
- - - { - void handleSave(val as CreateOrganizationDto); - }} - > - - {languageData.Save} - - - - -
- + { + void handleSave(val as CreateOrganizationDto); + }} + > + + {languageData.Save} + + ); } diff --git a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/page.tsx b/apps/web/src/app/[lang]/app/[type]/crm/[data]/page.tsx similarity index 99% rename from apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/page.tsx rename to apps/web/src/app/[lang]/app/[type]/crm/[data]/page.tsx index 348e78497..0e5572bb2 100644 --- a/apps/web/src/app/[lang]/app/[type]/crm/[data]/(main)/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/crm/[data]/page.tsx @@ -13,7 +13,7 @@ import { getResourceDataClient } from "src/language-data/CRMService"; import { useLocale } from "src/providers/locale"; import type { TableData } from "src/utils"; import { getBaseLink } from "src/utils"; -import { dataConfigOfCrm } from "../../data"; +import { dataConfigOfCrm } from "../data"; async function controlledFetch( url: string, diff --git a/apps/web/src/app/[lang]/app/[type]/dashboard/[domain]/layout.tsx b/apps/web/src/app/[lang]/app/[type]/dashboard/[domain]/layout.tsx deleted file mode 100644 index c8180b1f6..000000000 --- a/apps/web/src/app/[lang]/app/[type]/dashboard/[domain]/layout.tsx +++ /dev/null @@ -1,88 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument -- TODO: we need to fix this*/ -"use client"; - -import { - SectionLayout, - SectionLayoutContent, -} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { useEffect, useState } from "react"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; -import { getResourceDataClient } from "src/language-data/IdentityService"; -import { useLocale } from "src/providers/locale"; -import { getBaseLink } from "src/utils"; -import { dataConfig } from "../data"; - -interface LayoutProps { - children: JSX.Element; - params?: any; -} - -export default function Layout({ children, params }: LayoutProps) { - const [navbarItems, setNavbarItems] = useState([]); - const { resources } = useLocale(); - - const languageData = getResourceDataClient(resources, params.lang); - const pathname = usePathname(); - const path = pathname.split("dashboard/")[1]; - const activePage = path.split("/")[1]; - - useEffect(() => { - const tempNavbarItems = Object.entries(dataConfig[params.domain]) - .filter(([e]) => e !== "displayName" && e !== "default") - .map(([key]: [string, unknown]) => { - return { - id: `${params.domain}/${key}`, - name: - languageData[ - (key[0].toUpperCase() + key.slice(1)) as keyof typeof languageData - ] || key, - link: getBaseLink( - `dashboard/${params.domain}/${key}`, - true, - params.lang, - true, - params.type, - ), - }; - }); - setNavbarItems(tempNavbarItems); - }, []); - return ( - <> - - {navbarItems.length > 0 && ( - - - {children} - - - )} - - ); -} diff --git a/apps/web/src/app/[lang]/app/[type]/dashboard/data.ts b/apps/web/src/app/[lang]/app/[type]/dashboard/data.ts index 070e25fa3..e1d8f9a59 100644 --- a/apps/web/src/app/[lang]/app/[type]/dashboard/data.ts +++ b/apps/web/src/app/[lang]/app/[type]/dashboard/data.ts @@ -268,7 +268,7 @@ export const dataConfig: Record = { schema: $Volo_Abp_LanguageManagement_Dto_UpdateLanguageDto, }, }, - languageTexts: { + "language-texts": { title: "Language Text", detailedFilters: [ { name: "filter", displayName: "Search", type: "string", value: "" }, @@ -453,7 +453,7 @@ export const dataConfig: Record = { schema: $Volo_Abp_Identity_IdentityUserDto, }, }, - claimType: { + "claim-type": { title: "Claim Type", detailedFilters: [ { name: "filter", displayName: "Search", type: "string", value: "" }, @@ -509,7 +509,7 @@ export const dataConfig: Record = { }, }, }, - securityLogs: { + "security-logs": { title: "Security Logs", detailedFilters: [ { @@ -565,10 +565,10 @@ export const dataConfig: Record = { title: "Organization", }, }, - auditLogs: { + "audit-logs": { displayName: "Audit Logs", - default: "auditLogs", - auditLogs: { + default: "audit-logs", + "audit-logs": { title: "Audit Logs", detailedFilters: [ { @@ -642,10 +642,10 @@ export const dataConfig: Record = { }, }, }, - textTemplates: { - displayName: "TextTemplates", - default: "textTemplates", - textTemplates: { + "text-templates": { + displayName: "Text Templates", + default: "text-templates", + "text-templates": { title: "Text Templates", tableSchema: { excludeList: ["name", "additionalProperties"], diff --git a/apps/web/src/app/[lang]/app/[type]/layout.tsx b/apps/web/src/app/[lang]/app/[type]/layout.tsx index 2e1e6e670..940009ac6 100644 --- a/apps/web/src/app/[lang]/app/[type]/layout.tsx +++ b/apps/web/src/app/[lang]/app/[type]/layout.tsx @@ -1,326 +1,57 @@ "use server"; -import { GearIcon } from "@radix-ui/react-icons"; -import { MainLayout } from "@repo/ui/main-layout"; -import { ProfileMenu } from "@repo/ui/upwithcrowd/profile-menu"; -import { - BriefcaseBusiness, - Building2, - ClipboardList, - DollarSign, - Home, - Languages, - Layers, - LayoutDashboard, - Plane, - Presentation, - Projector, - ShieldAlert, - SlidersHorizontal, - User, - UserCircle, - Worm, - WrenchIcon, -} from "lucide-react"; -import { redirect } from "next/navigation"; -import { auth } from "auth"; -import { signOutServer } from "auth-action"; +import MainAdminLayout from "@repo/ui/theme/main-admin-layout"; +import { LogOut } from "lucide-react"; +import unirefund from "public/unirefund.png"; import { getResourceData } from "src/language-data/AbpUiNavigation"; -import { generateNavigationItems, getBaseLink } from "src/utils"; -import { BreadcrumbCallback } from "./breadcrumb"; -import { dataConfigOfCrm } from "./crm/data"; -import { dataConfig } from "./dashboard/data"; -import { dataConfigOfManagement } from "./management/data"; -import type { NavigationItmes } from "./menu-data"; -import { navigationItemsTemp } from "./menu-data"; -import { getNavbarFromDB } from "./navbar-data"; +import { getBaseLink } from "src/utils"; +import { signOutServer } from "auth-action"; +import { getNavbarFromDB } from "./navbar/navbar-data"; +import { getProfileMenuFromDB } from "./navbar/navbar-profile-data"; interface LayoutProps { params: { lang: string; type: string }; children: JSX.Element; } -const appName = process.env.APPLICATION_NAME || "UNIREFUND"; export default async function Layout({ children, params, }: LayoutProps): Promise { - const types = ["admin", "user", "entrepreneur", "investor"]; - const { type } = params; - if (!types.includes(type)) { - redirect("/404"); - } - const navbarResources = { "Menu:Reports": "Reports" }; - const { languageData, resources } = await getResourceData(params.lang); - - const navbarbread = getNavbarFromDB( - `/${params.lang}/app/${params.type}`, - languageData, - ); - const session = await auth(); - const user = session?.user; - - const arrayOf = [ - "openiddict", - "admin", - "saas", - "identity", - "auditLogs", - "textTemplates", - ]; - const arrayOfManagement = ["setting"]; - const arrayOfCrm = ["companies"]; - - const userNavigation = { - username: user?.userName ?? "undefined", - initials: user?.name?.substring(0, 2).toUpperCase(), - user, - email: user?.email ?? undefined, - imageURL: `https://placehold.co/100x100/DB0000/white?text=${user?.name?.substring(0, 2).toUpperCase()}`, - menuLinks: - appName === "UNIREFUND" || - appName === "TAHSILET" || - appName === "AYSHOPGO" - ? [ - { - href: getBaseLink( - `app/${type}/settings/profile`, - true, - params.lang, - ), - title: languageData.UserSettings, - icon: , - }, - ] - : [ - { - href: getBaseLink(`public`, true, params.lang), - title: languageData.HomePage, - icon: , - }, - { - href: getBaseLink(`app/admin`, true, params.lang), - title: languageData.AdminCenter, - icon: , - }, - { - href: getBaseLink(`app/entrepreneur`, true, params.lang), - title: languageData.EntrepreneurCenter, - icon: , - }, - { - href: getBaseLink(`app/investor`, true, params.lang), - title: languageData.InvestorCenter, - icon: , - }, - ], - isLoggedIn: Boolean(user), - className: "bg-transparent", - signOutFunction: signOutServer, - languageData, - }; - const dashboards = generateNavigationItems( - dataConfig, - arrayOf, - languageData, - type, - "dashboard", - params.lang, - , - ); + const { lang } = params; + const { languageData } = await getResourceData(lang); - const managements = generateNavigationItems( - dataConfigOfManagement, - arrayOfManagement, - languageData, - type, - "management", - params.lang, - , - ); - managements.push({ - key: "tenantSettings", - title: languageData.TenantSettings, - href: getBaseLink( - `app/${type}/management/tenant-settings/home`, - true, - params.lang, - ), - icon: , - type: "admin", - appType: "unirefund", - }); + const prefix = "app/admin"; + const appName = process.env.APPLICATION_NAME || "UNIREFUND"; + const baseURL = getBaseLink("/", true, lang); - const crms = generateNavigationItems( - dataConfigOfCrm, - arrayOfCrm, + const navbarFromDB = getNavbarFromDB( + `${lang}/${prefix}`, languageData, - type, - "crm", - params.lang, - , + appName, ); - const navigationItemsFull: NavigationItmes[] = [ - { - key: "reports", - title: navbarResources["Menu:Reports"], - href: getBaseLink(`app/${type}/`, true, params.lang), - icon: , - type: ["admin", "user", "entrepreneur", "investor"], - appType: "unirefund", - }, - { - key: "dashboard", - title: languageData.Dashboard, - href: getBaseLink(`app/${type}/dashboard`, true, params.lang), - icon: , - submenu: dashboards, - type: "admin", - appType: "all", - }, - { - key: "management", - title: languageData.Management, - href: getBaseLink(`app/${type}/management`, true, params.lang), - icon: , - submenu: managements, - type: "admin", - appType: "unirefund", - }, - { - key: "crm", - title: languageData.Crm, - href: getBaseLink(`app/${type}/crm`, true, params.lang), - icon: , - submenu: crms, - type: "admin", - appType: "unirefund", - }, - ...crms, - { - key: "profile", - title: languageData.Profile, - href: getBaseLink(`app/${type}/profile`, true, params.lang), - icon: , - type: ["admin", "user", "entrepreneur", "investor"], - appType: "upwithcrowd", - }, - { - key: "traveller", - title: languageData.Traveller, - href: getBaseLink(`app/${type}/traveller`, true, params.lang), - icon: , - type: "admin", - appType: "unirefund", - }, - { - key: "projects", - title: languageData.Campaigns, - icon: , - href: getBaseLink(`app/${type}/projects`, true, params.lang), - type: ["admin", "entrepreneur", "investor"], - appType: "upwithcrowd", - }, + const profileMenuProps = getProfileMenuFromDB(languageData); + profileMenuProps.menu.secondary = [ { - key: "languageManagement", - title: languageData.LanguageManagement || "Language Management", - icon: , - href: getBaseLink(`app/${type}/language-management`, true, params.lang), - type: "admin", - appType: "upwithcrowd", - }, - { - key: "investments", - title: "Investments", - icon: , - href: getBaseLink(`app/${type}/investments`, true, params.lang), - type: "investor", - appType: "admin", - }, - { - key: "customers", - title: languageData.Customers, - href: getBaseLink(`app/${type}/customers`, true, params.lang), - icon: , - type: "admin", - appType: "ayshopgo", - }, - { - key: "contracts", - appType: "unirefund", - type: "admin", - title: languageData.Contracts, - href: getBaseLink(`app/${type}/contracts`, true, params.lang), - icon: , - submenu: [ - { - key: "contracts", - title: languageData.Contracts, - href: getBaseLink( - `app/${type}/contracts/contracts`, - true, - params.lang, - ), - }, - { - key: "rebateTables", - title: languageData.RebateTables, - href: getBaseLink( - `app/${type}/contracts/rebate/company-settings`, - true, - params.lang, - ), - }, - { - key: "refundTables", - title: languageData.RefundTables, - href: getBaseLink( - `app/${type}/contracts/refund/refund-tables`, - true, - params.lang, - ), - }, - { - key: "refundFees", - title: languageData.RefundFees, - href: getBaseLink( - `app/${type}/contracts/refund/refund-fees`, - true, - params.lang, - ), - }, - ], + href: undefined, + onClick: signOutServer, + name: languageData.LogOut, + icon: , }, ]; - - const presentation = [...navigationItemsFull, ...navigationItemsTemp]; - const filteredNavigationItems = presentation.filter((item) => { - return ( - (item.appType === appName.toLowerCase() || item.appType === "all") && - (item.type === type || item.type.includes(type)) - ); - }); - return ( - - - //
- } - > -
- - +
+ +
{children}
- +
); } diff --git a/apps/web/src/app/[lang]/app/[type]/management/[domain]/layout.tsx b/apps/web/src/app/[lang]/app/[type]/management/[domain]/layout.tsx deleted file mode 100644 index 619b40f77..000000000 --- a/apps/web/src/app/[lang]/app/[type]/management/[domain]/layout.tsx +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument -- TODO: we need to fix this*/ -"use client"; - -import { - SectionLayout, - SectionLayoutContent, -} from "@repo/ayasofyazilim-ui/templates/section-layout-v2"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { useEffect, useState } from "react"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; -import { getResourceDataClient } from "src/language-data/SettingService"; -import { useLocale } from "src/providers/locale"; -import { getBaseLink } from "src/utils"; -import { dataConfigOfManagement } from "../data"; - -interface LayoutProps { - children: JSX.Element; - params?: any; -} - -export default function Layout({ children, params }: LayoutProps) { - const [navbarItems, setNavbarItems] = useState([]); - const { resources } = useLocale(); - - const languageData = getResourceDataClient(resources, params.lang); - const pathname = usePathname(); - const path = pathname.split("management/")[1]; - const activePage = path.split("/")[1]; - - function pageHeaderData() { - if (activePage === "vats") { - return { - title: languageData.Vat, - description: languageData["Vat.Description"], - }; - } - if (activePage === "productGroups") { - return { - title: languageData.ProductGroup, - description: languageData["ProductGroup.Description"], - }; - } - return { - title: languageData.ProductGroupVAT, - description: languageData["ProductGroupVAT.Description"], - }; - } - - const { title, description } = pageHeaderData(); - useEffect(() => { - const tempNavbarItems = Object.entries( - dataConfigOfManagement[params.domain], - ) - .filter(([e]) => e !== "displayName" && e !== "default") - .map(([key, value]: [string, unknown]) => { - let name = ""; - if ( - value && - typeof value === "object" && - "title" in value && - typeof value.title === "string" - ) { - name = - languageData[ - value.title.replaceAll(" ", "") as keyof typeof languageData - ]; - } - return { - id: `${params.domain}/${key}`, - name: name || key, - link: getBaseLink( - `management/${params.domain}/${key}`, - true, - params.lang, - true, - params.type, - ), - }; - }); - setNavbarItems(tempNavbarItems); - }, []); - - return ( - <> - - {navbarItems.length > 0 && ( - - - {children} - - - )} - - ); -} diff --git a/apps/web/src/app/[lang]/app/[type]/management/data.ts b/apps/web/src/app/[lang]/app/[type]/management/data.ts index c9dc08eb7..9b974d0fc 100644 --- a/apps/web/src/app/[lang]/app/[type]/management/data.ts +++ b/apps/web/src/app/[lang]/app/[type]/management/data.ts @@ -76,7 +76,7 @@ export const dataConfigOfManagement: Record = { schema: $UniRefund_SettingService_Vats_VatDetailDto, }, }, - productGroups: { + "product-groups": { title: "Product Group", createFormSchema: { formPositions: [ @@ -124,7 +124,7 @@ export const dataConfigOfManagement: Record = { }, }, }, - productGroupsVats: { + "product-groups-vats": { title: "Product Group VAT", filterBy: "", createFormSchema: { @@ -135,7 +135,9 @@ export const dataConfigOfManagement: Record = { productGroupId: { data: () => { return fetch( - getBaseLink("api/management/productGroups?maxResultCount=1000"), + getBaseLink( + "api/management/product-groups?maxResultCount=1000", + ), ) .then((data) => data.json()) .then( diff --git a/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/group.tsx b/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/group.tsx index 3af1e8b37..ba673eea2 100644 --- a/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/group.tsx +++ b/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/group.tsx @@ -1,5 +1,4 @@ "use client"; -import { Card } from "@/components/ui/card"; import type { UniRefund_SettingService_CountrySettings_CountrySettingDto } from "@ayasofyazilim/saas/SettingService"; import { SettingsView } from "@repo/ui/settings-view"; import type { ResourceResult } from "src/utils"; @@ -21,13 +20,11 @@ export default function TenantSettingsPage({ ); } return ( - - - + ); } diff --git a/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/page.tsx b/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/page.tsx index 4003c7cf7..170bef417 100644 --- a/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/management/tenant-settings/[group]/page.tsx @@ -1,7 +1,6 @@ "use server"; import type { UniRefund_SettingService_CountrySettings_CountrySettingDto } from "@ayasofyazilim/saas/SettingService"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; import { getResourceData } from "src/language-data/SettingService"; import { getSettingServiceClient } from "src/lib"; import TenantSettingsPage from "./group"; @@ -23,18 +22,12 @@ export default async function Page({ tenantSettings = mockSettingsResponse; } - const { languageData, resources } = await getResourceData(params.lang); + const { resources } = await getResourceData(params.lang); return ( - <> - - - + ); } diff --git a/apps/web/src/app/[lang]/app/[type]/menu-data.tsx b/apps/web/src/app/[lang]/app/[type]/menu-data.tsx deleted file mode 100644 index c658be1f2..000000000 --- a/apps/web/src/app/[lang]/app/[type]/menu-data.tsx +++ /dev/null @@ -1,327 +0,0 @@ -import type { NavigationItem } from "@repo/ui/main-layout"; -import { - Presentation, - AlertCircle, - Settings, - BarChart, - Layers, - FileText, - ClipboardList, - Book, - File, - Database, - Network, - Globe, -} from "lucide-react"; -import { getBaseLink } from "src/utils"; - -export type NavigationItmes = NavigationItem & { - type: string | string[]; - appType?: string; -}; - -export const navigationItemsTemp: NavigationItmes[] = [ - { - key: "operations", - title: "Operations", - href: "/operations", - type: "admin", - appType: "unirefund", - icon: , - submenu: [ - { - key: "tax_free_tags", - title: "Tax Free Tags", - href: getBaseLink("app/admin/operations/details", true), - icon: , - }, - { - key: "issue", - wip: true, - title: "Issue", - href: "/operation/issue", - icon: , - }, - { - key: "settings", - wip: true, - title: "Settings", - href: "/operation/settings", - icon: , - }, - ], - }, - { - key: "devices", - wip: true, - title: "Devices", - href: "/devices", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "registered_errors", - wip: true, - title: "Registered Errors", - href: "/registered-errors", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "config", - wip: true, - title: "Config", - href: "/config", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "groups", - wip: true, - title: "Groups", - href: "/groups", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "finance", - wip: true, - title: "Finance", - href: "/finance", - type: "admin", - appType: "unirefund", - icon: , - submenu: [ - { - key: "reports", - wip: true, - title: "Reports", - href: "/finance/reports", - icon: , - }, - { - key: "invoices", - wip: true, - title: "Invoices", - href: "/finance/invoices", - icon: , - }, - { - key: "import_payments", - wip: true, - title: "Import Payments", - href: "/finance/import-payments", - icon: , - }, - { - key: "rebates", - wip: true, - title: "Rebates", - href: "/finance/rebates", - icon: , - }, - { - key: "bookkeeping", - wip: true, - title: "Bookkeeping", - href: "/finance/bookkeeping", - icon: , - }, - { - key: "age", - wip: true, - title: "Age", - href: "/finance/age", - icon: , - }, - { - key: "balance", - wip: true, - title: "Balance", - href: "/finance/balance", - icon: , - }, - { - key: "invoicing_management", - wip: true, - title: "Invoicing Management", - href: "/finance/invoicing-management", - icon: , - }, - ], - }, - { - key: "settings", - wip: true, - title: "Settings", - href: "/settings", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "logs", - wip: true, - title: "Logs", - href: "/logs", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "api_logs", - wip: true, - title: "API Logs", - href: "/api-logs", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "systems", - wip: true, - title: "Systems", - href: "/systems", - type: "admin", - appType: "unirefund", - icon: , - }, - { - key: "reports", - wip: true, - title: "Reports", - href: "/operation/reports", - icon: , - type: "admin", - appType: "unirefund", - submenu: [ - { - key: "daily_report", - wip: true, - title: "Daily Report", - href: "/operation/reports/daily-report", - icon: , - }, - { - key: "dashboard", - wip: true, - title: "Dashboard", - href: "/operation/reports/dashboard", - icon: , - }, - { - key: "issued", - wip: true, - title: "Issued", - href: "/operation/reports/issued", - icon: , - }, - { - key: "by_store", - wip: true, - title: "By Store", - href: "/operation/reports/by-store", - icon: , - }, - { - key: "validation", - wip: true, - title: "Validation", - href: "/operation/reports/validation", - icon: , - }, - { - key: "invoice", - wip: true, - title: "Invoice", - href: "/operation/reports/invoice", - icon: , - }, - { - key: "travellers", - wip: true, - title: "Travellers", - href: "/operation/reports/travellers", - icon: , - }, - { - key: "validation_rules_hits", - wip: true, - title: "Validation Rules Hits", - href: "/operation/reports/validation-rules-hits", - icon: , - }, - { - key: "others", - wip: true, - title: "Others", - href: "/operation/reports/others", - icon: , - }, - { - key: "change_report", - wip: true, - title: "Change Report", - href: "/operation/reports/change-report", - icon: , - }, - ], - }, - { - key: "refund", - wip: true, - title: "Refund", - href: "/operation/refund", - icon: , - type: "admin", - appType: "unirefund", - submenu: [ - { - key: "refunds", - wip: true, - title: "Refunds", - href: "/operation/refund/refunds", - icon: , - }, - { - key: "travellers", - wip: true, - title: "Travellers", - href: "/operation/refund/travellers", - icon: , - }, - { - key: "sticker_status", - wip: true, - title: "Sticker Status", - href: "/operation/refund/sticker-status", - icon: , - }, - { - key: "reconciliation", - wip: true, - title: "Reconciliation", - href: "/operation/refund/reconciliation", - icon: , - }, - { - key: "card_payments", - wip: true, - title: "Card Payments", - href: "/operation/refund/card-payments", - icon: , - }, - { - key: "payment_requests", - wip: true, - title: "Payment Requests", - href: "/operation/refund/payment-requests", - icon: , - }, - ], - }, -]; diff --git a/apps/web/src/app/[lang]/app/[type]/navbar-data.tsx b/apps/web/src/app/[lang]/app/[type]/navbar-data.tsx deleted file mode 100644 index 8b54a01f4..000000000 --- a/apps/web/src/app/[lang]/app/[type]/navbar-data.tsx +++ /dev/null @@ -1,497 +0,0 @@ -import type { NavbarItemType } from "@repo/ui/theme/types"; -import type { AbpUiNavigationResource } from "src/language-data/AbpUiNavigation"; - -export function getNavbarFromDB( - prefix: string, - languageData: AbpUiNavigationResource, -) { - const navbarDataFromDB: NavbarItemType[] = [ - { - key: "/", - displayName: "Home", - description: "Description", - href: "", - icon: "home", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "home", - displayName: "Home", - description: "Description", - href: "/home", - icon: "home", - parentNavbarItemKey: "home", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard", - displayName: "Dashboard", - description: "Description", - href: "dashboard/openiddict/applications", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "dashboard/openiddict", - displayName: "Open Id Dict", - description: "Description", - href: "dashboard/openiddict/applications", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/openiddict/applications", - displayName: "Applications", - description: "Description", - href: "dashboard/openiddict/applications", - icon: "dashboard", - parentNavbarItemKey: "dashboard/openiddict", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/openiddict/scopes", - displayName: "Scopes", - description: "Description", - href: "dashboard/openiddict/scopes", - icon: "dashboard", - parentNavbarItemKey: "dashboard/openiddict", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "dashboard/admin", - displayName: "Admin Management", - description: "Description", - href: "dashboard/admin/languages", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/admin/languages", - displayName: "Languages", - description: "Description", - href: "dashboard/admin/languages", - icon: "dashboard", - parentNavbarItemKey: "dashboard/admin", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/admin/languageTexts", - displayName: "Language Texts", - description: "Description", - href: "dashboard/admin/languageTexts", - icon: "dashboard", - parentNavbarItemKey: "dashboard/admin", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "dashboard/saas", - displayName: "Saas Management", - description: "Description", - href: "dashboard/saas/edition", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/saas/edition", - displayName: "Edition", - description: "Description", - href: "dashboard/saas/edition", - icon: "dashboard", - parentNavbarItemKey: "dashboard/saas", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/saas/tenant", - displayName: "Tenant", - description: "Description", - href: "dashboard/saas/tenant", - icon: "dashboard", - parentNavbarItemKey: "dashboard/saas", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "dashboard/identity", - displayName: "Identity Management", - description: "Description", - href: "dashboard/identity/role", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/identity/role", - displayName: "Role", - description: "Description", - href: "dashboard/identity/role", - icon: "dashboard", - parentNavbarItemKey: "dashboard/identity", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/identity/user", - displayName: "User", - description: "Description", - href: "dashboard/identity/user", - icon: "dashboard", - parentNavbarItemKey: "dashboard/identity", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/identity/claimType", - displayName: "Claim Type", - description: "Description", - href: "dashboard/identity/claimType", - icon: "dashboard", - parentNavbarItemKey: "dashboard/identity", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/identity/securityLogs", - displayName: "Security Logs", - description: "Description", - href: "dashboard/identity/securityLogs", - icon: "dashboard", - parentNavbarItemKey: "dashboard/identity", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "dashboard/identity/organization", - displayName: "Organization", - description: "Description", - href: "dashboard/identity/organization", - icon: "dashboard", - parentNavbarItemKey: "dashboard/identity", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "dashboard/auditLogs", - displayName: "Audit Logs", - description: "Description", - href: "dashboard/auditLogs/auditLogs", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/auditLogs", - displayName: "Audit Logs", - description: "Description", - href: "dashboard/auditLogs/auditLogs", - icon: "dashboard", - parentNavbarItemKey: "dashboard/auditLogs", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "dashboard/textTemplates", - displayName: "Text Templates", - description: "Description", - href: "dashboard/textTemplates/textTemplates", - icon: "dashboard", - parentNavbarItemKey: "dashboard", - subNavbarItems: [ - { - key: "dashboard/textTemplates", - displayName: "Text Templates", - description: "Description", - href: "dashboard/textTemplates/textTemplates", - icon: "dashboard", - parentNavbarItemKey: "dashboard/textTemplates", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "management", - displayName: "Management", - description: "Description", - href: "management/setting/vats", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "management/setting", - displayName: "VAT Settings", - description: "Description", - href: "management/setting/vats", - icon: "dashboard", - parentNavbarItemKey: "management", - subNavbarItems: [ - { - key: "management/setting/vats", - displayName: "VAT", - description: "Description", - href: "management/setting/vats", - icon: "dashboard", - parentNavbarItemKey: "management/setting", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "management/setting/productGroups", - displayName: "Product Group", - description: "Description", - href: "management/setting/productGroups", - icon: "dashboard", - parentNavbarItemKey: "management/setting", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "management/setting/productGroupsVats", - displayName: "Product Group VAT", - description: "Description", - href: "management/setting/productGroupsVats", - icon: "dashboard", - parentNavbarItemKey: "management/setting", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "management/tenant-settings", - displayName: "Tenant Settings", - description: "Description", - href: "management/tenant-settings", - icon: "dashboard", - parentNavbarItemKey: "management", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "crm", - displayName: "CRM", - description: "Description", - href: "crm/merchants", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "crm/merchants", - displayName: "Merchants", - description: "Description", - href: "crm/merchants", - icon: "dashboard", - parentNavbarItemKey: "crm", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "crm/refund-points", - displayName: "Refund Points", - description: "Description", - href: "crm/refund-points", - icon: "dashboard", - parentNavbarItemKey: "crm", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "crm/customs", - displayName: "Customs", - description: "Description", - href: "crm/customs", - icon: "dashboard", - parentNavbarItemKey: "crm", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "crm/tax-free", - displayName: "Tax Free", - description: "Description", - href: "crm/tax-free", - icon: "dashboard", - parentNavbarItemKey: "crm", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "crm/tax-offices", - displayName: "Tax Offices", - description: "Description", - href: "crm/tax-offices", - icon: "dashboard", - parentNavbarItemKey: "crm", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "traveller", - displayName: "Traveller", - description: "Description", - href: "traveller", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "contracts", - displayName: "Contracts", - description: "Description", - href: "contracts/contracts", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "contracts/contracts", - displayName: "Contracts", - description: "Description", - href: "contracts/contracts", - icon: "dashboard", - parentNavbarItemKey: "contracts", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "contracts/rebate", - displayName: "Rebate", - description: "Description", - href: "contracts/rebate/company-settings", - icon: "dashboard", - parentNavbarItemKey: "contracts", - subNavbarItems: [ - { - key: "contracts/rebate/company-settings", - displayName: "Company Settings", - description: "Description", - href: "contracts/rebate/company-settings", - icon: "dashboard", - parentNavbarItemKey: "contracts/rebate", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "contracts/rebate/templates", - displayName: "Templates", - description: "Description", - href: "contracts/rebate/templates", - icon: "dashboard", - parentNavbarItemKey: "contracts/rebate", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "contracts/refund", - displayName: "Refund", - description: "Description", - href: "contracts/refund/refund-tables", - icon: "dashboard", - parentNavbarItemKey: "contracts", - subNavbarItems: [ - { - key: "contracts/refund/refund-tables", - displayName: "Refund Tables", - description: "Description", - href: "contracts/refund/refund-tables", - icon: "dashboard", - parentNavbarItemKey: "contracts/refund", - subNavbarItems: null, - displayOrder: 1, - }, - { - key: "contracts/refund/refund-fees", - displayName: "Refund Fees", - description: "Description", - href: "contracts/refund/refund-fees", - icon: "dashboard", - parentNavbarItemKey: "contracts/refund", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - { - key: "operations", - displayName: "Operations", - description: "Description", - href: "operations/details", - icon: "dashboard", - parentNavbarItemKey: null, - subNavbarItems: [ - { - key: "operations/details", - displayName: "Tax Free Tags", - description: "Description", - href: "operations/details", - icon: "dashboard", - parentNavbarItemKey: "operations", - subNavbarItems: null, - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - ], - displayOrder: 1, - }, - ]; - function processItems(items: NavbarItemType[]) { - items.forEach((item) => { - item.href = `${prefix}/${item.href}`; - if (item.key !== "/") { - item.key = `${prefix}/${item.key}`; - } - - //İleride displayname'in veritabanından çevrili gelmiş olmasını bekliyoruz. - item.displayName = - languageData[ - ( - item.displayName[0].toUpperCase() + item.displayName.slice(1) - ).replaceAll(" ", "") as keyof typeof languageData - ] || `**${item.displayName}`; - if (item.subNavbarItems) { - processItems(item.subNavbarItems); - } - }); - } - - processItems(navbarDataFromDB); - return navbarDataFromDB; -} diff --git a/apps/web/src/app/[lang]/app/[type]/navbar/groups.tsx b/apps/web/src/app/[lang]/app/[type]/navbar/groups.tsx new file mode 100644 index 000000000..4b2879ce3 --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/navbar/groups.tsx @@ -0,0 +1,345 @@ +import type { NavbarItemsFromDB } from "@repo/ui/theme/types"; + +export const dashboard: NavbarItemsFromDB[] = [ + { + key: "dashboard", + displayName: "Dashboard", + description: "View and manage your dashboard settings.", + href: "dashboard/openiddict/applications", + icon: "dashboard", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + { + key: "dashboard/openiddict", + displayName: "Open Id Dict", + description: "Manage Open ID dict settings.", + href: "dashboard/openiddict/applications", + icon: "id", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, + { + key: "dashboard/openiddict/applications", + displayName: "Applications", + description: "Manage applications within Open Id Dict.", + href: "dashboard/openiddict/applications", + icon: "app", + parentNavbarItemKey: "dashboard/openiddict", + displayOrder: 1, + }, + { + key: "dashboard/openiddict/scopes", + displayName: "Scopes", + description: "View and manage scopes for Open Id Dict.", + href: "dashboard/openiddict/scopes", + icon: "scope", + parentNavbarItemKey: "dashboard/openiddict", + displayOrder: 1, + }, + { + key: "dashboard/admin", + displayName: "Admin Management", + description: "Access administrative tools and settings.", + href: "dashboard/admin/languages", + icon: "management", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, + { + key: "dashboard/admin/languages", + displayName: "Languages", + description: "Manage language settings and translations.", + href: "dashboard/admin/languages", + icon: "language", + parentNavbarItemKey: "dashboard/admin", + displayOrder: 1, + }, + { + key: "dashboard/admin/language-texts", + displayName: "Language Texts", + description: "Edit and review language texts.", + href: "dashboard/admin/language-texts", + icon: "book", + parentNavbarItemKey: "dashboard/admin", + displayOrder: 1, + }, + { + key: "dashboard/saas", + displayName: "Saas Management", + description: "Manage SaaS configurations and settings.", + href: "dashboard/saas/edition", + icon: "management", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, + { + key: "dashboard/saas/edition", + displayName: "Edition", + description: "Manage SaaS editions and plans.", + href: "dashboard/saas/edition", + icon: "edition", + parentNavbarItemKey: "dashboard/saas", + displayOrder: 1, + }, + { + key: "dashboard/saas/tenant", + displayName: "Tenant", + description: "Manage SaaS tenant settings and configurations.", + href: "dashboard/saas/tenant", + icon: "globe", + parentNavbarItemKey: "dashboard/saas", + displayOrder: 1, + }, + { + key: "dashboard/identity", + displayName: "Identity Management", + description: "Manage user identities and roles.", + href: "dashboard/identity/role", + icon: "management", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, + { + key: "dashboard/identity/role", + displayName: "Role", + description: "Manage user roles and permissions.", + href: "dashboard/identity/role", + icon: "role", + parentNavbarItemKey: "dashboard/identity", + displayOrder: 1, + }, + { + key: "dashboard/identity/user", + displayName: "User", + description: "Manage user accounts and profiles.", + href: "dashboard/identity/user", + icon: "identity", + parentNavbarItemKey: "dashboard/identity", + displayOrder: 1, + }, + { + key: "dashboard/identity/claim-type", + displayName: "Claim Type", + description: "Manage claim types for user identities.", + href: "dashboard/identity/claim-type", + icon: "scan", + parentNavbarItemKey: "dashboard/identity", + displayOrder: 1, + }, + { + key: "dashboard/identity/security-logs", + displayName: "Security Logs", + description: "View security logs and audit trails.", + href: "dashboard/identity/security-logs", + icon: "lock", + parentNavbarItemKey: "dashboard/identity", + displayOrder: 1, + }, + { + key: "dashboard/identity/organization", + displayName: "Organization", + description: "Manage organizational settings and structure.", + href: "dashboard/identity/organization", + icon: "building", + parentNavbarItemKey: "dashboard/identity", + displayOrder: 1, + }, + { + key: "dashboard/audit-logs/audit-logs", + displayName: "Audit Logs", + description: "View and analyze audit logs.", + href: "dashboard/audit-logs/audit-logs", + icon: "log", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, + { + key: "dashboard/text-templates/text-templates", + displayName: "Text Templates", + description: "Manage and create text templates.", + href: "dashboard/text-templates/text-templates", + icon: "text", + parentNavbarItemKey: "dashboard", + displayOrder: 1, + }, +]; +export const management: NavbarItemsFromDB[] = [ + { + key: "management", + displayName: "Management", + description: "Access management settings and tools.", + href: "management/setting/vats", + icon: "management", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + { + key: "management/setting", + displayName: "VAT Settings", + description: "Configure VAT settings and rules.", + href: "management/setting/vats", + icon: "settings", + parentNavbarItemKey: "management", + displayOrder: 1, + }, + { + key: "management/setting/vats", + displayName: "VAT", + description: "Manage VAT settings and rates.", + href: "management/setting/vats", + icon: "vat", + parentNavbarItemKey: "management/setting", + displayOrder: 1, + }, + { + key: "management/setting/product-groups", + displayName: "Product Group", + description: "Manage product groups and categories.", + href: "management/setting/product-groups", + icon: "product", + parentNavbarItemKey: "management/setting", + displayOrder: 1, + }, + { + key: "management/setting/product-groups-vats", + displayName: "Product Group VAT", + description: "Manage VAT settings for product groups.", + href: "management/setting/product-groups-vats", + icon: "productGroup", + parentNavbarItemKey: "management/setting", + displayOrder: 1, + }, + { + key: "management/tenant-settings", + displayName: "Tenant Settings", + description: "Manage settings for tenants.", + href: "management/tenant-settings", + icon: "settings", + parentNavbarItemKey: "management", + displayOrder: 1, + }, +]; + +export const crm: NavbarItemsFromDB[] = [ + { + key: "crm", + displayName: "CRM", + description: "Manage customer relationship management settings.", + href: "crm/merchants", + icon: "layer", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + { + key: "crm/merchants", + displayName: "Merchants", + description: "Manage merchant accounts and details.", + href: "crm/merchants", + icon: "shop", + parentNavbarItemKey: "crm", + displayOrder: 1, + }, + { + key: "crm/refund-points", + displayName: "Refund Points", + description: "Manage refund points and settings.", + href: "crm/refund-points", + icon: "refund", + parentNavbarItemKey: "crm", + displayOrder: 1, + }, + { + key: "crm/customs", + displayName: "Customs", + description: "Manage customs settings and configurations.", + href: "crm/customs", + icon: "container", + parentNavbarItemKey: "crm", + displayOrder: 1, + }, + { + key: "crm/tax-free", + displayName: "Tax Free", + description: "Manage tax-free settings and exemptions.", + href: "crm/tax-free", + icon: "tax", + parentNavbarItemKey: "crm", + displayOrder: 1, + }, + { + key: "crm/tax-offices", + displayName: "Tax Offices", + description: "Manage tax office details and settings.", + href: "crm/tax-offices", + icon: "taxOffice", + parentNavbarItemKey: "crm", + displayOrder: 1, + }, +]; + +export const contracts: NavbarItemsFromDB[] = [ + { + key: "contracts/contracts", + displayName: "Contracts", + description: "View and manage contract details.", + href: "contracts/contracts", + icon: "dashboard", + parentNavbarItemKey: "contracts", + displayOrder: 1, + }, + { + key: "contracts/rebate", + displayName: "Rebate", + description: "Manage rebate settings and configurations.", + href: "contracts/rebate/company-settings", + icon: "percent", + parentNavbarItemKey: "contracts", + displayOrder: 1, + }, + { + key: "contracts/rebate/company-settings", + displayName: "Company Settings", + description: "Manage company-specific rebate settings.", + href: "contracts/rebate/company-settings", + icon: "settings", + parentNavbarItemKey: "contracts/rebate", + displayOrder: 1, + }, + { + key: "contracts/rebate/templates", + displayName: "Templates", + description: "Manage rebate templates and configurations.", + href: "contracts/rebate/templates", + icon: "template", + parentNavbarItemKey: "contracts/rebate", + displayOrder: 1, + }, + { + key: "contracts/refund", + displayName: "Refund", + description: "Manage refund settings and details.", + href: "contracts/refund/refund-tables", + icon: "refund", + parentNavbarItemKey: "contracts", + displayOrder: 1, + }, + { + key: "contracts/refund/refund-tables", + displayName: "Refund Tables", + description: "Manage refund tables and configurations.", + href: "contracts/refund/refund-tables", + icon: "table", + parentNavbarItemKey: "contracts/refund", + displayOrder: 1, + }, + { + key: "contracts/refund/refund-fees", + displayName: "Refund Fees", + description: "Manage refund fees and settings.", + href: "contracts/refund/refund-fees", + icon: "refund", + parentNavbarItemKey: "contracts/refund", + displayOrder: 1, + }, +]; diff --git a/apps/web/src/app/[lang]/app/[type]/navbar/navbar-data.tsx b/apps/web/src/app/[lang]/app/[type]/navbar/navbar-data.tsx new file mode 100644 index 000000000..5909ce2d9 --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/navbar/navbar-data.tsx @@ -0,0 +1,51 @@ +import type { NavbarItemsFromDB } from "@repo/ui/theme/types"; +import type { AbpUiNavigationResource } from "src/language-data/AbpUiNavigation"; +import { unirefundNavbarDataFromDB } from "./projects/unirefund"; +import { ayshopgoNavbarDataFromDB } from "./projects/ayshopgo"; + +const dbData = { + UNIREFUND: unirefundNavbarDataFromDB, + UPWITHCROWD: unirefundNavbarDataFromDB, + TAHSILET: unirefundNavbarDataFromDB, + AYSHOPGO: ayshopgoNavbarDataFromDB, +}; + +export function getNavbarFromDB( + prefix: string, + languageData: AbpUiNavigationResource, + appName: string, +) { + const navbarDataFromDB: NavbarItemsFromDB[] = + dbData[appName as keyof typeof dbData]; + + function processItems(items: NavbarItemsFromDB[]) { + items.forEach((item) => { + if (item.href) { + item.href = `${prefix}/${item.href}`; + } + + if (item.parentNavbarItemKey === "/") { + item.parentNavbarItemKey = prefix; + } else { + item.parentNavbarItemKey = `${prefix}/${item.parentNavbarItemKey}`; + } + + if (item.key && item.key !== "/") { + item.key = `${prefix}/${item.key}`; + } else { + item.key = prefix; + } + + //İleride displayname'in veritabanından çevrili gelmiş olmasını bekliyoruz. + item.displayName = + languageData[ + ( + item.displayName[0].toUpperCase() + item.displayName.slice(1) + ).replaceAll(" ", "") as keyof typeof languageData + ] || `**${item.displayName}`; + }); + } + + processItems(navbarDataFromDB); + return navbarDataFromDB; +} diff --git a/apps/web/src/app/[lang]/app/[type]/navbar/navbar-profile-data.tsx b/apps/web/src/app/[lang]/app/[type]/navbar/navbar-profile-data.tsx new file mode 100644 index 000000000..73e0ea3cc --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/navbar/navbar-profile-data.tsx @@ -0,0 +1,48 @@ +import { HeartFilledIcon } from "@radix-ui/react-icons"; +import type { ProfileMenuProps } from "@repo/ui/theme/types"; +import { Layers, Settings, User } from "lucide-react"; +import type { AbpUiNavigationResource } from "src/language-data/AbpUiNavigation"; + +export function getProfileMenuFromDB(languageData: AbpUiNavigationResource) { + const profileMenu: ProfileMenuProps = { + info: { + name: "Neil Sims", + email: "name@flowbite.com", + image: "https://flowbite.com/docs/images/people/profile-picture-5.jpg", + }, + menuTitle: languageData.Profile, + menu: { + account: [ + { + icon: , + href: "#", + onClick: undefined, + name: languageData.Profile, + }, + { + href: "#", + onClick: undefined, + name: languageData.UserSettings, + icon: , + }, + ], + primary: [ + { + href: "#", + onClick: undefined, + name: languageData.OurTeam, + icon: , + }, + { + href: "#", + onClick: undefined, + name: languageData.Management, + icon: , + }, + ], + secondary: [], + }, + }; + + return profileMenu; +} diff --git a/apps/web/src/app/[lang]/app/[type]/navbar/projects/ayshopgo.tsx b/apps/web/src/app/[lang]/app/[type]/navbar/projects/ayshopgo.tsx new file mode 100644 index 000000000..5fc6dc89a --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/navbar/projects/ayshopgo.tsx @@ -0,0 +1,33 @@ +import type { NavbarItemsFromDB } from "@repo/ui/theme/types"; +import { dashboard } from "../groups"; + +export const ayshopgoNavbarDataFromDB: NavbarItemsFromDB[] = [ + { + key: "/", + displayName: "Home", + description: "Go back to the home page.", + href: "home", + icon: "home", + parentNavbarItemKey: null, + displayOrder: 1, + }, + { + key: "home", + displayName: "Home", + description: "Go back to the home page.", + href: "/home", + icon: "home", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + ...dashboard, + { + key: "customers", + displayName: "Customers", + description: "Access management settings and tools.", + href: "customers", + icon: "management", + parentNavbarItemKey: "/", + displayOrder: 1, + }, +]; diff --git a/apps/web/src/app/[lang]/app/[type]/navbar/projects/unirefund.tsx b/apps/web/src/app/[lang]/app/[type]/navbar/projects/unirefund.tsx new file mode 100644 index 000000000..d7b174092 --- /dev/null +++ b/apps/web/src/app/[lang]/app/[type]/navbar/projects/unirefund.tsx @@ -0,0 +1,54 @@ +import type { NavbarItemsFromDB } from "@repo/ui/theme/types"; +import { contracts, crm, dashboard, management } from "../groups"; + +export const unirefundNavbarDataFromDB: NavbarItemsFromDB[] = [ + { + key: "/", + displayName: "Home", + description: "Go back to the home page.", + href: "home", + icon: "home", + parentNavbarItemKey: null, + displayOrder: 1, + }, + { + key: "home", + displayName: "Home", + description: "Go back to the home page.", + href: "/home", + icon: "home", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + ...dashboard, + ...management, + ...crm, + ...contracts, + { + key: "traveller", + displayName: "Traveller", + description: "Manage traveller-related settings.", + href: "traveller", + icon: "plane", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + { + key: "operations", + displayName: "Operations", + description: "Access and manage operational settings.", + href: "operations/details", + icon: "operation", + parentNavbarItemKey: "/", + displayOrder: 1, + }, + { + key: "operations/details", + displayName: "Tax Free Tags", + description: "Manage tax-free tags and settings.", + href: "operations/details", + icon: "dashboard", + parentNavbarItemKey: "operations", + displayOrder: 1, + }, +]; diff --git a/apps/web/src/app/[lang]/app/[type]/operations/details/add/page.tsx b/apps/web/src/app/[lang]/app/[type]/operations/details/add/page.tsx index 1a075086a..39e90eca2 100644 --- a/apps/web/src/app/[lang]/app/[type]/operations/details/add/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/operations/details/add/page.tsx @@ -53,14 +53,8 @@ export default function Page() { ]; return ( -
-
-
- - - -
-
-
+ + + ); } diff --git a/apps/web/src/app/[lang]/app/[type]/operations/details/layout.tsx b/apps/web/src/app/[lang]/app/[type]/operations/details/layout.tsx deleted file mode 100644 index 406e011fe..000000000 --- a/apps/web/src/app/[lang]/app/[type]/operations/details/layout.tsx +++ /dev/null @@ -1,27 +0,0 @@ -"use client"; -import { Card } from "@/components/ui/card"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import { getBaseLink } from "src/utils"; - -interface LayoutProps { - children: JSX.Element; -} - -export default function Layout({ children }: LayoutProps): JSX.Element { - const pathname = usePathname(); - const path = pathname.split("en/app/admin/details")[1]; - - return ( - <> - - {children} - - ); -} diff --git a/apps/web/src/app/[lang]/app/[type]/projects/@admin/[projectId]/details/form.tsx b/apps/web/src/app/[lang]/app/[type]/projects/@admin/[projectId]/details/form.tsx index aa84c0e28..d29d21013 100644 --- a/apps/web/src/app/[lang]/app/[type]/projects/@admin/[projectId]/details/form.tsx +++ b/apps/web/src/app/[lang]/app/[type]/projects/@admin/[projectId]/details/form.tsx @@ -34,7 +34,6 @@ export default function ProjectForm({ sectionData }: ProjectFormProps) { return ( diff --git a/apps/web/src/app/[lang]/app/[type]/projects/@entrepreneur/[projectId]/details/form.tsx b/apps/web/src/app/[lang]/app/[type]/projects/@entrepreneur/[projectId]/details/form.tsx index 6c479476e..0b48c72b6 100644 --- a/apps/web/src/app/[lang]/app/[type]/projects/@entrepreneur/[projectId]/details/form.tsx +++ b/apps/web/src/app/[lang]/app/[type]/projects/@entrepreneur/[projectId]/details/form.tsx @@ -64,7 +64,6 @@ export default function ProjectForm({ return ( diff --git a/apps/web/src/app/[lang]/app/[type]/traveller/page.tsx b/apps/web/src/app/[lang]/app/[type]/traveller/page.tsx index 42f644c17..03e884d89 100644 --- a/apps/web/src/app/[lang]/app/[type]/traveller/page.tsx +++ b/apps/web/src/app/[lang]/app/[type]/traveller/page.tsx @@ -1,21 +1,8 @@ "use server"; -import React from "react"; -import { Card } from "@/components/ui/card"; -import { PageHeader } from "@repo/ayasofyazilim-ui/molecules/page-header"; import { getResourceData } from "src/language-data/TravellerService"; import Table from "./table"; export default async function Page({ params }: { params: { lang: string } }) { const { languageData } = await getResourceData(params.lang); - return ( - <> - - - - - - ); + return
; } diff --git a/apps/web/src/app/api/admin/[data]/route.ts b/apps/web/src/app/api/admin/[data]/route.ts index a14ee5db0..2c2ba7622 100644 --- a/apps/web/src/app/api/admin/[data]/route.ts +++ b/apps/web/src/app/api/admin/[data]/route.ts @@ -85,7 +85,7 @@ const clients: Clients = { delete: async (id: string) => tenant.deleteApiSaasTenantsById({ id }), }; }, - claimType: async () => { + "claim-type": async () => { const client = await getIdentityServiceClient(); const claimType = client.claimType; @@ -196,7 +196,7 @@ const clients: Clients = { }, }; }, - securityLogs: async () => { + "security-logs": async () => { const client = await getIdentityServiceClient(); const securityLogs = client.securityLog; @@ -225,7 +225,7 @@ const clients: Clients = { }; }, - auditLogs: async () => { + "audit-logs": async () => { const client = await getAdministrationServiceClient(); const auditLogs = client.auditLogs; @@ -260,7 +260,7 @@ const clients: Clients = { }; }, - textTemplates: async () => { + "text-templates": async () => { const client = await getAdministrationServiceClient(); const textTemplates = client.textTemplateDefinitions; return { @@ -273,7 +273,7 @@ const clients: Clients = { }; }, - languageTexts: async () => { + "language-texts": async () => { const client = await getAdministrationServiceClient(); const languageTexts = client.languageTexts; diff --git a/apps/web/src/app/api/management/[data]/route.ts b/apps/web/src/app/api/management/[data]/route.ts index 6caca8f9f..bd969b22f 100644 --- a/apps/web/src/app/api/management/[data]/route.ts +++ b/apps/web/src/app/api/management/[data]/route.ts @@ -27,7 +27,7 @@ const clients: Clients = { delete: async (id: string) => vats.deleteApiSettingServiceVatById({ id }), }; }, - productGroups: async () => { + "product-groups": async () => { const client = await getSettingServiceClient(); const productGroups = client.productGroup; return { @@ -49,7 +49,7 @@ const clients: Clients = { }; }, - productGroupsVats: async () => { + "product-groups-vats": async () => { const client = await getSettingServiceClient(); const productGroupVats = client.productGroupVat; return { diff --git a/packages/ayasofyazilim-ui b/packages/ayasofyazilim-ui index cfde1c940..ce12d2e2b 160000 --- a/packages/ayasofyazilim-ui +++ b/packages/ayasofyazilim-ui @@ -1 +1 @@ -Subproject commit cfde1c9402a5bb9536f3a6a7d42018eaaf7f461a +Subproject commit ce12d2e2bff4d7ed0dcaaf3200ebb9975dfff06c diff --git a/packages/ui/src/theme/main-admin-layout/components/profile-menu/index.tsx b/packages/ui/src/theme/main-admin-layout/components/profile-menu/index.tsx index 671346811..5d40299e2 100644 --- a/packages/ui/src/theme/main-admin-layout/components/profile-menu/index.tsx +++ b/packages/ui/src/theme/main-admin-layout/components/profile-menu/index.tsx @@ -36,13 +36,24 @@ function ProfileMenu() { @@ -55,13 +66,24 @@ function ProfileMenu() { @@ -74,13 +96,24 @@ function ProfileMenu() { diff --git a/packages/ui/src/theme/main-admin-layout/header-section.tsx b/packages/ui/src/theme/main-admin-layout/header-section.tsx index 22ff93c8a..6ec091f2c 100644 --- a/packages/ui/src/theme/main-admin-layout/header-section.tsx +++ b/packages/ui/src/theme/main-admin-layout/header-section.tsx @@ -75,14 +75,14 @@ export function HeaderSection() { const sectionLayoutItems = breadcrumbItems[ breadcrumbItems.length - 1 - ].subNavbarItems.map((item) => ({ + ]?.subNavbarItems?.map((item) => ({ id: item.key, name: item.displayName, link: item.href ? "/" + item.href : undefined, })); const activeSectionLayoutItem = - breadcrumbItems[breadcrumbItems.length - 1].key; + breadcrumbItems[breadcrumbItems.length - 1]?.key; return { activeNavItem: item, diff --git a/packages/ui/src/theme/types/index.tsx b/packages/ui/src/theme/types/index.tsx index 26e1d5421..143b59e51 100644 --- a/packages/ui/src/theme/types/index.tsx +++ b/packages/ui/src/theme/types/index.tsx @@ -14,7 +14,10 @@ export type BreadcrumbItemType = NavbarItemsFromDB & { export type NavbarItemType = NavbarItemsFromDB & { subNavbarItems: NavbarItemType[] | null; }; -type ProfileMenuLink = { name: string; href: string; icon: JSX.Element }; +type ProfileMenuLink = { name: string; icon: JSX.Element } & ( + | { onClick: () => void | Promise; href: undefined } + | { href: string; onClick: undefined } +); export type ProfileMenuProps = { info: {