more services added
This commit is contained in:
@@ -6,11 +6,20 @@ const formatServiceUrl = (url: string) => {
|
||||
const baseUrlAuth = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_AUTH_SERVICE_URL || "auth_service:8001"
|
||||
);
|
||||
const baseUrlPeople = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8002"
|
||||
const baseUrlRestriction = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_RESTRICTION_SERVICE_URL || "restriction_service:8002"
|
||||
);
|
||||
const baseUrlApplication = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8004"
|
||||
process.env.NEXT_PUBLIC_MANAGEMENT_SERVICE_URL || "management_service:8003"
|
||||
);
|
||||
const baseUrlAccount = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_ACCOUNT_SERVICE_URL || "account_service:8004"
|
||||
);
|
||||
const baseUrlBuilding = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_BUILDING_SERVICE_URL || "building_service:8006"
|
||||
);
|
||||
const baseUrlPeople = formatServiceUrl(
|
||||
process.env.NEXT_PUBLIC_VALIDATION_SERVICE_URL || "identity_service:8009"
|
||||
);
|
||||
|
||||
// Types for better type safety
|
||||
@@ -62,6 +71,9 @@ export {
|
||||
baseUrlAuth,
|
||||
baseUrlPeople,
|
||||
baseUrlApplication,
|
||||
baseUrlAccount,
|
||||
baseUrlBuilding,
|
||||
baseUrlRestriction,
|
||||
tokenSecret,
|
||||
cookieObject,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ interface AppendApplicationToService {
|
||||
interface RemoveApplicationFromService extends AppendApplicationToService { }
|
||||
|
||||
|
||||
|
||||
async function listApplicationsAvailable(payload: PaginationParams): Promise<PaginatedApiResponse<any>> {
|
||||
if (!payload.query.service_uu_id__ilike) {
|
||||
console.warn('Missing service_uu_id in query parameters');
|
||||
@@ -135,8 +134,8 @@ async function listAllApplications(payload: PaginationParams): Promise<Paginated
|
||||
query: payload.query,
|
||||
};
|
||||
|
||||
console.log('Sending request to backend with service_uu_id:', payload.query.service_uu_id);
|
||||
console.log('Full request body:', JSON.stringify(requestBody, null, 2));
|
||||
// console.log('Sending request to backend with service_uu_id:', payload.query.service_uu_id);
|
||||
// console.log('Full request body:', JSON.stringify(requestBody, null, 2));
|
||||
|
||||
const response = await fetchDataWithToken(
|
||||
applicationListEndpoint,
|
||||
@@ -147,7 +146,6 @@ async function listAllApplications(payload: PaginationParams): Promise<Paginated
|
||||
|
||||
if (response?.status === 200 || response?.status === 202) {
|
||||
const responseData = response.data as PaginatedApiResponse<any>;
|
||||
console.log('list_events_available responseData:', JSON.stringify(responseData, null, 2));
|
||||
return {
|
||||
data: responseData.data || [],
|
||||
pagination: collectPaginationFromApiResponse(responseData)
|
||||
|
||||
@@ -2,12 +2,10 @@ import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||
import { resolveWhichPageToRenderSingle } from "@/pages/resolver/resolver";
|
||||
|
||||
const PageToBeChildrendSingle: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
||||
const ApplicationToRender = resolveWhichPageToRenderSingle({ activePageUrl })
|
||||
if (ApplicationToRender) {
|
||||
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} />
|
||||
}
|
||||
else { return <ContentToRenderNoPage lang={lang} /> }
|
||||
const PageToBeChildrendSingle: React.FC<ContentProps> = async ({ lang, translations, activePageUrl, mode }) => {
|
||||
const ApplicationToRender = await resolveWhichPageToRenderSingle({ activePageUrl })
|
||||
if (!ApplicationToRender) return <ContentToRenderNoPage lang={lang} />
|
||||
return <ApplicationToRender lang={lang} translations={translations} activePageUrl={activePageUrl} mode={mode} />
|
||||
}
|
||||
|
||||
export default PageToBeChildrendSingle
|
||||
|
||||
@@ -6,12 +6,14 @@ import PageToBeChildrendSingle from "./PageToBeChildrendSingle";
|
||||
import PageToBeChildrendMulti from "./PageToBeChildrendMulti";
|
||||
|
||||
const ContentComponent: FC<ContentProps> = async ({ lang, translations, activePageUrl, isMulti, mode }) => {
|
||||
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'list'
|
||||
const modeFromQuery = ModeTypesList.includes(mode || '') ? mode : 'shortList'
|
||||
const renderProps = { lang, translations, activePageUrl, mode: modeFromQuery as ModeTypes }
|
||||
const PageToBeChildrend = isMulti ? PageToBeChildrendMulti : PageToBeChildrendSingle
|
||||
const loadingContent = <LoadingContent height="h-16" size="w-36 h-48" plane="h-full w-full" />
|
||||
const classNameDiv = "fixed top-24 left-80 right-0 py-10 px-15 border-emerald-150 border-l-2 overflow-y-auto h-[calc(100vh-64px)]"
|
||||
return <div className={classNameDiv}><Suspense fallback={loadingContent}><PageToBeChildrend {...renderProps} /></Suspense></div>;
|
||||
|
||||
// return <div className={classNameDiv}><Suspense fallback={loadingContent}><PageToBeChildrend {...renderProps} /></Suspense></div>;
|
||||
};
|
||||
|
||||
export default ContentComponent;
|
||||
|
||||
@@ -6,7 +6,6 @@ import { MenuSingleProps, SingleLayerItemProps } from "@/validations/mutual/dash
|
||||
import { langGetKey } from "@/lib/langGet";
|
||||
|
||||
const SingleLayerItem: FC<SingleLayerItemProps> = ({ isActive, innerText, url }) => {
|
||||
console.log({ isActive, innerText, url })
|
||||
let className = "py-3 px-4 text-sm rounded-xl cursor-pointer transition-colors duration-200 flex justify-between items-center w-full";
|
||||
if (isActive) { className += " bg-black text-white font-medium" }
|
||||
else { className += " bg-emerald-800 text-white hover:bg-emerald-700" }
|
||||
|
||||
@@ -44,7 +44,9 @@ const TableComponent: React.FC<TableComponentProps> = ({
|
||||
setPagination({ ...pagination, page: pagination.page < apiPagination.totalPage ? pagination.page + 1 : pagination.page });
|
||||
await fetchData();
|
||||
}
|
||||
|
||||
const fetchData = async () => {
|
||||
console.log('urls', urls)
|
||||
const response = await apiPostFetcher({
|
||||
url: urls.list,
|
||||
isNoCache: true,
|
||||
@@ -56,8 +58,9 @@ const TableComponent: React.FC<TableComponentProps> = ({
|
||||
query: pagination.query,
|
||||
},
|
||||
});
|
||||
if (response && response.data) {
|
||||
const oldData = response.data.data
|
||||
console.log('response.data', response)
|
||||
if (response.success && response.data) {
|
||||
const oldData = response.data
|
||||
setOrgTableData(oldData)
|
||||
if (schemas.table) {
|
||||
const newData = Object.entries(oldData).map(([key]) => {
|
||||
|
||||
@@ -18,7 +18,7 @@ const CreateForm: React.FC<CreateFormProps> = ({ schemas, labels, selectedRow })
|
||||
const handleSubmit = (data: any) => {
|
||||
console.log(data)
|
||||
}
|
||||
const form = useForm<FormData>({
|
||||
const form = useForm({
|
||||
resolver: zodResolver(createSchema),
|
||||
defaultValues: {},
|
||||
});
|
||||
|
||||
@@ -11,30 +11,18 @@ const ComponentTablePlain: React.FC<TableProps> = ({
|
||||
setTableData(data);
|
||||
}, [data]);
|
||||
|
||||
const renderColumns = () => {
|
||||
return [translations?.rows, ...columns].map((column, index) => {
|
||||
return (
|
||||
<TableHead key={`headers-${index}`}>{column}</TableHead>
|
||||
)
|
||||
})
|
||||
}
|
||||
const renderColumns = () => [translations?.rows, ...columns].map((column, index) => <TableHead key={`headers-${index}`}>{column}</TableHead>)
|
||||
const renderRows = () => (
|
||||
<>{tableData?.map((item: any, index: number) => {
|
||||
return (
|
||||
<TableRow key={`${index}-row`} >
|
||||
<TableCell>{index + 1}</TableCell>
|
||||
{
|
||||
Object.entries(item).map(([key, value]: [string, any]) => (
|
||||
<TableCell key={`${index}-column-${key}`}>{value}</TableCell>
|
||||
))
|
||||
Object.entries(item).map(([key, value]: [string, any]) => (<TableCell key={`${index}-column-${key}`}>{value}</TableCell>))
|
||||
}
|
||||
|
||||
{
|
||||
Object.values(redirectUrls?.table || {}).map((redirectUrl: any, index: number) => {
|
||||
return (
|
||||
<TableCell className="cursor-pointer w-4" key={`${index}-action-${index}`}
|
||||
onClick={() => setSelectedRow?.(orgData[index])}>{redirectUrl}</TableCell>
|
||||
)
|
||||
return <TableCell className="cursor-pointer w-4" key={`${index}-action-${index}`} onClick={() => setSelectedRow?.(orgData[index])}>{redirectUrl}</TableCell>
|
||||
})
|
||||
}
|
||||
</TableRow>
|
||||
@@ -48,9 +36,7 @@ const ComponentTablePlain: React.FC<TableProps> = ({
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-row justify-between gap-2">
|
||||
{Object.values(redirectUrls?.page || {}).map((action, index) => (
|
||||
<div className="flex flex-row justify-center items-center gap-2" key={`page-action-${index}`}>{action}</div>
|
||||
))}
|
||||
{Object.values(redirectUrls?.page || {}).map((action, index) => (<div className="flex flex-row justify-center items-center gap-2" key={`page-action-${index}`}>{action}</div>))}
|
||||
</div>
|
||||
{tableData ? renderTable : noDataFound}
|
||||
</>
|
||||
|
||||
@@ -26,7 +26,7 @@ const UpdateForm: React.FC<UpdateFormProps> = ({ schemas, selectedRow, rollbackT
|
||||
const handleSubmit = (data: any) => {
|
||||
console.log(data)
|
||||
}
|
||||
const form = useForm<FormData>({
|
||||
const form = useForm({
|
||||
resolver: zodResolver(updateSchema),
|
||||
defaultValues: selectedRow,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const BASE_URL = "http://localhost:3000";
|
||||
const API_URL = "http://localhost:3000/api";
|
||||
const BASE_URL = "http://localhost:3001";
|
||||
const API_URL = "http://localhost:3001/api";
|
||||
export const WEB_BASE_URL = process.env.WEB_BASE_URL || BASE_URL;
|
||||
export const API_BASE_URL = process.env.API_BASE_URL || API_URL;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
||||
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
||||
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
||||
|
||||
const contentApplicationEn = {
|
||||
...contentDefaultEn,
|
||||
title: "Application",
|
||||
content: "Application Content",
|
||||
button: "Application Button",
|
||||
};
|
||||
const footerApplicationEn = {
|
||||
...footerDefaultEn,
|
||||
page: "Application Footer",
|
||||
};
|
||||
const headerApplicationEn = {
|
||||
...headerDefaultEn,
|
||||
page: "Application Header",
|
||||
};
|
||||
|
||||
const menuApplicationEn = {
|
||||
application: "Application",
|
||||
};
|
||||
|
||||
const applicationEn = {
|
||||
header: headerApplicationEn,
|
||||
menu: menuApplicationEn,
|
||||
content: contentApplicationEn,
|
||||
footer: footerApplicationEn,
|
||||
};
|
||||
|
||||
const applicationFieldsEn = {
|
||||
uu_id: "UUID",
|
||||
name: "Name",
|
||||
application_code: "Application Code",
|
||||
site_url: "Site URL",
|
||||
application_type: "Application Type",
|
||||
application_for: "Application For",
|
||||
description: "Description",
|
||||
active: "Active",
|
||||
deleted: "Deleted",
|
||||
created_at: "Created At",
|
||||
updated_at: "Updated At",
|
||||
};
|
||||
|
||||
export {
|
||||
contentApplicationEn,
|
||||
footerApplicationEn,
|
||||
headerApplicationEn,
|
||||
menuApplicationEn,
|
||||
applicationEn,
|
||||
applicationFieldsEn,
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
import { applicationTr } from "./turkish";
|
||||
import { applicationEn } from "./english";
|
||||
|
||||
const application = {
|
||||
tr: applicationTr,
|
||||
en: applicationEn,
|
||||
};
|
||||
|
||||
export { application };
|
||||
@@ -0,0 +1,51 @@
|
||||
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
||||
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
||||
import { contentDefaultTr } from "@/languages/mutual/content/turkish";
|
||||
|
||||
const contentApplicationTr = {
|
||||
...contentDefaultTr,
|
||||
title: "Uygulama",
|
||||
description: "Uygulama",
|
||||
button: "Uygulama Buton",
|
||||
};
|
||||
const footerApplicationTr = {
|
||||
...footerDefaultTr,
|
||||
page: "Uygulama Footer",
|
||||
};
|
||||
const headerApplicationTr = {
|
||||
...headerDefaultTr,
|
||||
page: "Uygulama Header",
|
||||
};
|
||||
|
||||
const menuApplicationTr = {
|
||||
application: "Uygulama",
|
||||
};
|
||||
const applicationTr = {
|
||||
header: headerApplicationTr,
|
||||
menu: menuApplicationTr,
|
||||
content: contentApplicationTr,
|
||||
footer: footerApplicationTr,
|
||||
};
|
||||
|
||||
const applicationFieldsTr = {
|
||||
uu_id: "UUID",
|
||||
name: "İsim",
|
||||
application_code: "Uygulama Kodu",
|
||||
site_url: "Site URL",
|
||||
application_type: "Uygulama Tipi",
|
||||
application_for: "Uygulama için",
|
||||
description: "Açıklama",
|
||||
active: "Aktif",
|
||||
deleted: "Silindi",
|
||||
created_at: "Oluşturulma Tarihi",
|
||||
updated_at: "Güncellenme Tarihi",
|
||||
};
|
||||
|
||||
export {
|
||||
contentApplicationTr,
|
||||
footerApplicationTr,
|
||||
headerApplicationTr,
|
||||
menuApplicationTr,
|
||||
applicationTr,
|
||||
applicationFieldsTr,
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
const buildingEn = {
|
||||
building: "Building First Layer Label",
|
||||
};
|
||||
|
||||
const buildingPartsEn = {
|
||||
...buildingEn,
|
||||
parts: "Parts Second Layer Label",
|
||||
};
|
||||
|
||||
const buildingPartsFieldsEn = {
|
||||
"Users.uuid": "UUID",
|
||||
"Users.firstName": "First Name",
|
||||
"Users.lastName": "Last Name",
|
||||
"Users.email": "Email",
|
||||
"Users.phoneNumber": "Phone Number",
|
||||
"Users.country": "Country",
|
||||
"Users.description": "Description",
|
||||
"Users.isDeleted": "Is Deleted",
|
||||
"Users.isConfirmed": "Is Confirmed",
|
||||
"Users.createdAt": "Created At",
|
||||
"Users.updatedAt": "Updated At",
|
||||
};
|
||||
|
||||
export { buildingEn, buildingPartsEn, buildingPartsFieldsEn };
|
||||
@@ -1,23 +0,0 @@
|
||||
const buildingTr = {
|
||||
building: "Bina Birinci Seviye",
|
||||
};
|
||||
const buildingPartsTr = {
|
||||
...buildingTr,
|
||||
parts: "Parçalar İkinci Seviye",
|
||||
};
|
||||
|
||||
const buildingPartsFieldsTr = {
|
||||
"Users.uuid": "UUID",
|
||||
"Users.firstName": "Ad",
|
||||
"Users.lastName": "Soyad",
|
||||
"Users.email": "Email",
|
||||
"Users.phoneNumber": "Telefon Numarası",
|
||||
"Users.country": "Ülke",
|
||||
"Users.description": "Açıklama",
|
||||
"Users.isDeleted": "Silindi",
|
||||
"Users.isConfirmed": "Onaylandı",
|
||||
"Users.createdAt": "Oluşturulma Tarihi",
|
||||
"Users.updatedAt": "Güncellenme Tarihi",
|
||||
};
|
||||
|
||||
export { buildingTr, buildingPartsTr, buildingPartsFieldsTr };
|
||||
@@ -1,12 +1,11 @@
|
||||
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
||||
import { DynamicPage } from "@/validations/mutual/menu/menu";
|
||||
import { managementAccountTenantMain } from "./management/account/tenantSomething/index";
|
||||
import { managementAccountTenantMainSecond } from "./management/account/tenantSomethingSecond/index";
|
||||
import { application } from "./application";
|
||||
|
||||
const dynamicPagesIndex: Record<string, Record<LanguageTypes, DynamicPage>> = {
|
||||
dashboard: managementAccountTenantMain,
|
||||
application: managementAccountTenantMain,
|
||||
services: managementAccountTenantMainSecond,
|
||||
dashboard: application,
|
||||
application: application,
|
||||
services: application,
|
||||
};
|
||||
|
||||
export { dynamicPagesIndex };
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
||||
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
||||
import { managementAccountEn, managementAccountFieldsEn } from "../../english";
|
||||
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
||||
|
||||
const contentManagementAccountTenantSomethingEn = {
|
||||
...managementAccountFieldsEn,
|
||||
title: "Management Account Tenant Something",
|
||||
content: "Management Account Tenant Something Content",
|
||||
button: "Management Account Tenant Something Button",
|
||||
};
|
||||
const footerManagementAccountTenantSomethingEn = {
|
||||
...footerDefaultEn,
|
||||
page: "Management Account Tenant Something Footer",
|
||||
};
|
||||
const headerManagementAccountTenantSomethingEn = {
|
||||
...headerDefaultEn,
|
||||
page: "Management Account Tenant Something Header",
|
||||
};
|
||||
|
||||
const menuManagementAccountTenantSomethingEn = {
|
||||
...managementAccountEn,
|
||||
"tenant/something": "Tenant Info",
|
||||
};
|
||||
|
||||
const managementAccountTenantMainEn = {
|
||||
header: headerManagementAccountTenantSomethingEn,
|
||||
menu: menuManagementAccountTenantSomethingEn,
|
||||
content: contentManagementAccountTenantSomethingEn,
|
||||
footer: footerManagementAccountTenantSomethingEn,
|
||||
};
|
||||
|
||||
export {
|
||||
contentManagementAccountTenantSomethingEn,
|
||||
footerManagementAccountTenantSomethingEn,
|
||||
headerManagementAccountTenantSomethingEn,
|
||||
menuManagementAccountTenantSomethingEn,
|
||||
managementAccountTenantMainEn,
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
import { managementAccountTenantMainTr } from "./turkish";
|
||||
import { managementAccountTenantMainEn } from "./english";
|
||||
|
||||
const managementAccountTenantMain = {
|
||||
tr: managementAccountTenantMainTr,
|
||||
en: managementAccountTenantMainEn,
|
||||
}
|
||||
|
||||
export { managementAccountTenantMain }
|
||||
@@ -1,36 +0,0 @@
|
||||
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
||||
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
||||
import { managementAccountTr } from "../../turkish";
|
||||
|
||||
const contentManagementAccountTenantSomethingTr = {
|
||||
title: "Yönetim Hesap Kiracı Bilgileri",
|
||||
description: "Yönetim Hesap Kiracı Bilgileri",
|
||||
button: "Yönetim Hesap Kiracı Bilgileri Buton",
|
||||
};
|
||||
const footerManagementAccountTenantSomethingTr = {
|
||||
...footerDefaultTr,
|
||||
page: "Yönetim Hesap Kiracı Bilgileri Footer",
|
||||
};
|
||||
const headerManagementAccountTenantSomethingTr = {
|
||||
...headerDefaultTr,
|
||||
page: "Yönetim Hesap Kiracı Bilgileri Header",
|
||||
};
|
||||
|
||||
const menuManagementAccountTenantSomethingTr = {
|
||||
...managementAccountTr,
|
||||
"tenant/something": "Kiracı Bilgileri",
|
||||
};
|
||||
const managementAccountTenantMainTr = {
|
||||
header: headerManagementAccountTenantSomethingTr,
|
||||
menu: menuManagementAccountTenantSomethingTr,
|
||||
content: contentManagementAccountTenantSomethingTr,
|
||||
footer: footerManagementAccountTenantSomethingTr,
|
||||
};
|
||||
|
||||
export {
|
||||
contentManagementAccountTenantSomethingTr,
|
||||
footerManagementAccountTenantSomethingTr,
|
||||
headerManagementAccountTenantSomethingTr,
|
||||
menuManagementAccountTenantSomethingTr,
|
||||
managementAccountTenantMainTr,
|
||||
};
|
||||
@@ -1,40 +0,0 @@
|
||||
import { footerDefaultEn } from "@/languages/mutual/footer/english";
|
||||
import { headerDefaultEn } from "@/languages/mutual/header/english";
|
||||
import { contentDefaultEn } from "@/languages/mutual/content/english";
|
||||
import { managementAccountEn, managementAccountFieldsEn } from "../../english";
|
||||
|
||||
const contentManagementAccountTenantSomethingSecondEn = {
|
||||
...contentDefaultEn,
|
||||
...managementAccountFieldsEn,
|
||||
title: "Management Account Tenant Something",
|
||||
content: "Management Account Tenant Something Content",
|
||||
button: "Management Account Tenant Something Button",
|
||||
};
|
||||
const footerManagementAccountTenantSomethingSecondEn = {
|
||||
...footerDefaultEn,
|
||||
page: "Management Account Tenant Something Second Footer",
|
||||
};
|
||||
const headerManagementAccountTenantSomethingSecondEn = {
|
||||
...headerDefaultEn,
|
||||
page: "Management Account Tenant Something Second Header",
|
||||
};
|
||||
|
||||
const menuManagementAccountTenantSomethingSecondEn = {
|
||||
...managementAccountEn,
|
||||
"tenant/somethingSecond": "Tenant Info Second",
|
||||
};
|
||||
|
||||
const managementAccountTenantMainSecondEn = {
|
||||
header: headerManagementAccountTenantSomethingSecondEn,
|
||||
menu: menuManagementAccountTenantSomethingSecondEn,
|
||||
content: contentManagementAccountTenantSomethingSecondEn,
|
||||
footer: footerManagementAccountTenantSomethingSecondEn,
|
||||
};
|
||||
|
||||
export {
|
||||
contentManagementAccountTenantSomethingSecondEn,
|
||||
footerManagementAccountTenantSomethingSecondEn,
|
||||
headerManagementAccountTenantSomethingSecondEn,
|
||||
menuManagementAccountTenantSomethingSecondEn,
|
||||
managementAccountTenantMainSecondEn,
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
import { managementAccountTenantMainSecondTr } from "./turkish";
|
||||
import { managementAccountTenantMainSecondEn } from "./english";
|
||||
|
||||
const managementAccountTenantMainSecond = {
|
||||
tr: managementAccountTenantMainSecondTr,
|
||||
en: managementAccountTenantMainSecondEn,
|
||||
};
|
||||
|
||||
export { managementAccountTenantMainSecond };
|
||||
@@ -1,37 +0,0 @@
|
||||
import { footerDefaultTr } from "@/languages/mutual/footer/turkish";
|
||||
import { headerDefaultTr } from "@/languages/mutual/header/turkish";
|
||||
import { managementAccountTr, managementAccountFieldsTr } from "../../turkish";
|
||||
|
||||
const contentManagementAccountTenantSomethingSecondTr = {
|
||||
...managementAccountFieldsTr,
|
||||
title: "Yönetim Hesap Kiracı Bilgileri",
|
||||
description: "Yönetim Hesap Kiracı Bilgileri",
|
||||
button: "Yönetim Hesap Kiracı Bilgileri Buton",
|
||||
};
|
||||
const footerManagementAccountTenantSomethingSecondTr = {
|
||||
...footerDefaultTr,
|
||||
page: "Yönetim Hesap Kiracı Bilgileri Footer",
|
||||
};
|
||||
const headerManagementAccountTenantSomethingSecondTr = {
|
||||
...headerDefaultTr,
|
||||
page: "Yönetim Hesap Kiracı Bilgileri Header",
|
||||
};
|
||||
|
||||
const menuManagementAccountTenantSomethingSecondTr = {
|
||||
...managementAccountTr,
|
||||
"tenant/somethingSecond": "İkinci Kiracı Bilgileri",
|
||||
};
|
||||
const managementAccountTenantMainSecondTr = {
|
||||
header: headerManagementAccountTenantSomethingSecondTr,
|
||||
menu: menuManagementAccountTenantSomethingSecondTr,
|
||||
content: contentManagementAccountTenantSomethingSecondTr,
|
||||
footer: footerManagementAccountTenantSomethingSecondTr,
|
||||
};
|
||||
|
||||
export {
|
||||
contentManagementAccountTenantSomethingSecondTr,
|
||||
footerManagementAccountTenantSomethingSecondTr,
|
||||
headerManagementAccountTenantSomethingSecondTr,
|
||||
menuManagementAccountTenantSomethingSecondTr,
|
||||
managementAccountTenantMainSecondTr,
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
const managementEn = {
|
||||
management: "Management First Layer Label",
|
||||
};
|
||||
|
||||
const managementAccountEn = {
|
||||
...managementEn,
|
||||
account: "Account Second Layer Label",
|
||||
};
|
||||
|
||||
const managementAccountFieldsEn = {
|
||||
"User.firstName": "First Name",
|
||||
"User.lastName": "Last Name",
|
||||
"User.email": "Email",
|
||||
"User.phoneNumber": "Phone Number",
|
||||
"User.country": "Country",
|
||||
"User.description": "Description",
|
||||
"User.isDeleted": "Is Deleted",
|
||||
"User.isConfirmed": "Is Confirmed",
|
||||
"User.createdAt": "Created At",
|
||||
"User.updatedAt": "Updated At",
|
||||
};
|
||||
|
||||
export { managementEn, managementAccountEn, managementAccountFieldsEn };
|
||||
@@ -1,22 +0,0 @@
|
||||
const managementTr = {
|
||||
management: "Management Birinci Seviye",
|
||||
};
|
||||
const managementAccountTr = {
|
||||
...managementTr,
|
||||
account: "Account İkinci Seviye",
|
||||
};
|
||||
|
||||
const managementAccountFieldsTr = {
|
||||
"User.firstName": "Ad",
|
||||
"User.lastName": "Soyad",
|
||||
"User.email": "Email",
|
||||
"User.phoneNumber": "Telefon Numarası",
|
||||
"User.country": "Ülke",
|
||||
"User.description": "Açıklama",
|
||||
"User.isDeleted": "Silindi",
|
||||
"User.isConfirmed": "Onaylandı",
|
||||
"User.createdAt": "Oluşturulma Tarihi",
|
||||
"User.updatedAt": "Güncellenme Tarihi",
|
||||
};
|
||||
|
||||
export { managementTr, managementAccountTr, managementAccountFieldsTr };
|
||||
@@ -1,18 +1,8 @@
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import superUserTenantSomething from "./management/account/tenantSomething/page";
|
||||
import superUserTenantSomethingSecond from "./management/account/tenantSomethingSecond/page";
|
||||
import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page";
|
||||
|
||||
const pageIndexMulti: Record<string, Record<string, React.FC<ContentProps>>> = {
|
||||
"management/account/tenant/something": {
|
||||
superUserTenantSomething: superUserTenantSomething,
|
||||
},
|
||||
"management/account/tenant/somethingSecond": {
|
||||
superUserTenantSomething: superUserTenantSomethingSecond,
|
||||
},
|
||||
"building/parts/tenant/something": {
|
||||
superUserTenantSomething: superUserBuildingPartsTenantSomething,
|
||||
},
|
||||
};
|
||||
const pageIndexMulti: Record<
|
||||
string,
|
||||
Record<string, React.FC<ContentProps>>
|
||||
> = {};
|
||||
|
||||
export default pageIndexMulti;
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
'use client';
|
||||
import React, { useState } from "react";
|
||||
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
||||
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
||||
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
// This is a mock page dont use it
|
||||
const superUserTenantSomething: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||
const router = useRouter()
|
||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||
const pageUrl = `/${lang}/${activePageUrl}?mode=list`
|
||||
const urls = { list: "http://localhost:3000/api/tst" }
|
||||
const initPaginationDefault = { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} }
|
||||
const renderLastRowComponent = (reDirectUrl: string, IconToWrap: any) => {
|
||||
return (<Link className="flex items-center gap-2" replace href={reDirectUrl} ><IconToWrap /></Link>)
|
||||
}
|
||||
const redirectUrls = {
|
||||
table: {
|
||||
update: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=update`, PencilIcon),
|
||||
view: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=view`, EyeIcon),
|
||||
},
|
||||
page: {
|
||||
create: renderLastRowComponent(`/${lang}/${activePageUrl}?mode=create`, PlusCircle),
|
||||
}
|
||||
}
|
||||
const schemas = { list: {} }
|
||||
const columns = [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"email",
|
||||
"phoneNumber",
|
||||
"country",
|
||||
"description",
|
||||
"isDeleted",
|
||||
"isConfirmed",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
]
|
||||
const ListWithTableProps = {
|
||||
urls: {
|
||||
list: "http://localhost:3000/api/tst",
|
||||
},
|
||||
schemas: schemas,
|
||||
translations: translations,
|
||||
columns: columns,
|
||||
redirectUrls: redirectUrls,
|
||||
initPagination: initPaginationDefault,
|
||||
setSelectedRow: setSelectedRow,
|
||||
}
|
||||
const CreateFormProps = {
|
||||
schemas: schemas,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const UpdateFormProps = {
|
||||
rollbackTo: pageUrl,
|
||||
schemas: schemas,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const ViewFormProps = {
|
||||
rollbackTo: pageUrl,
|
||||
schemas: schemas,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
|
||||
const RenderBackToList = <div onClick={() => setSelectedRow(null)}>
|
||||
{renderLastRowComponent(pageUrl, ArrowLeftFromLineIcon)}
|
||||
</div>
|
||||
return (
|
||||
<>
|
||||
{JSON.stringify(translations)}
|
||||
{mode !== 'list' ? RenderBackToList : <TableComponent {...ListWithTableProps} />}
|
||||
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
||||
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
||||
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default superUserTenantSomething
|
||||
@@ -1,46 +0,0 @@
|
||||
import FullCardTableComp from "@/components/mutual/tableView/FullCardTableComp/component";
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
|
||||
// This is a mock page dont use it
|
||||
const superUserTenantSomethingSecond: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
||||
const urls = {
|
||||
list: "http://localhost:3000/api/tst",
|
||||
}
|
||||
const tableTranslations = {
|
||||
firstName: "First Name",
|
||||
lastName: "Last Name",
|
||||
email: "Email",
|
||||
phoneNumber: "Phone Number",
|
||||
country: "Country",
|
||||
description: "Description",
|
||||
isDeleted: "Is Deleted",
|
||||
isConfirmed: "Is Confirmed",
|
||||
createdAt: "Created At",
|
||||
updatedAt: "Updated At",
|
||||
}
|
||||
const columns = [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"email",
|
||||
"phoneNumber",
|
||||
"country",
|
||||
"description",
|
||||
"isDeleted",
|
||||
"isConfirmed",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
]
|
||||
const redirectUrls = {}
|
||||
const schemas = {}
|
||||
const initPaginationDefault = { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} }
|
||||
return (
|
||||
<>
|
||||
{JSON.stringify(translations)}
|
||||
<FullCardTableComp urls={urls} translations={tableTranslations} columns={columns}
|
||||
initPagination={initPaginationDefault} schemas={schemas} redirectUrls={redirectUrls} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export default superUserTenantSomethingSecond
|
||||
@@ -7,21 +7,24 @@ import pageIndexMulti from "@/pages/multi/index";
|
||||
import pageIndexSingle from "@/pages/single/index";
|
||||
import ContentToRenderNoPage from "@/pages/mutual/noContent/page";
|
||||
|
||||
function resolveWhichPageToRenderSingle({
|
||||
activePageUrl,
|
||||
}: ResolverProps): React.FC<ContentProps> {
|
||||
return activePageUrl in pageIndexSingle ? pageIndexSingle[activePageUrl] : ContentToRenderNoPage
|
||||
}
|
||||
|
||||
async function resolveWhichPageToRenderMulti({
|
||||
activePageUrl,
|
||||
}: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||
const pageToRender = await retrievePageToRender(activePageUrl) // TODO: Retrieve page to render
|
||||
async function resolveWhichPageToRenderSingle({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||
try {
|
||||
const ApplicationToRender = pageIndexMulti[activePageUrl][pageToRender]
|
||||
console.log('activePageUrl', activePageUrl)
|
||||
const ApplicationToRender = pageIndexSingle[`/${activePageUrl}`]
|
||||
return ApplicationToRender
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
console.error('resolveWhichPageToRenderSingle', error)
|
||||
}
|
||||
return ContentToRenderNoPage
|
||||
}
|
||||
|
||||
async function resolveWhichPageToRenderMulti({ activePageUrl }: ResolverProps): Promise<React.FC<ContentProps> | null> {
|
||||
const pageToRender = await retrievePageToRender(activePageUrl)
|
||||
try {
|
||||
const ApplicationToRender = pageIndexMulti[`${activePageUrl}`][pageToRender]
|
||||
return ApplicationToRender
|
||||
} catch (error) {
|
||||
console.error('resolveWhichPageToRenderMulti', error)
|
||||
}
|
||||
return ContentToRenderNoPage
|
||||
}
|
||||
|
||||
@@ -11,9 +11,8 @@ import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||
import { API_BASE_URL } from "@/config/config";
|
||||
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||
|
||||
|
||||
// This is a mock page dont use it
|
||||
const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||
const SuperUserApplicationPage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||
|
||||
const getSchema = getSchemaByLanguage(lang)
|
||||
@@ -33,7 +32,8 @@ const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translatio
|
||||
}
|
||||
}
|
||||
const listWithTableProps = {
|
||||
urls: { list: `${API_BASE_URL}/application/register` },
|
||||
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||
schemas: { table: getSchema.shortSchema },
|
||||
translations: translations,
|
||||
redirectUrls: redirectUrls,
|
||||
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||
@@ -70,4 +70,4 @@ const superUserApplicationRegister: React.FC<ContentProps> = ({ lang, translatio
|
||||
);
|
||||
}
|
||||
|
||||
export default superUserApplicationRegister
|
||||
export default SuperUserApplicationPage
|
||||
@@ -0,0 +1,74 @@
|
||||
'use client';
|
||||
import React, { useState } from "react";
|
||||
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
||||
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
||||
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
||||
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
||||
|
||||
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon, ExpandIcon } from "lucide-react";
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||
import { API_BASE_URL } from "@/config/config";
|
||||
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||
|
||||
|
||||
// This is a mock page dont use it
|
||||
const SuperUserDashboardPage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||
|
||||
const getSchema = getSchemaByLanguage(lang)
|
||||
const basePageUrl = `/panel/${lang}/${activePageUrl}?mode=`
|
||||
const isList = mode === 'shortList' || mode === 'fullList'
|
||||
const changeList = mode === 'shortList' ? `${basePageUrl}fullList` : `${basePageUrl}shortList`
|
||||
|
||||
const RenderBackToList = renderLastRowComponent(`${basePageUrl}shortList`, ArrowLeftFromLineIcon, "backToList")
|
||||
const redirectUrls = {
|
||||
table: {
|
||||
update: renderLastRowComponent(`${basePageUrl}update`, PencilIcon, "update"),
|
||||
view: renderLastRowComponent(`${basePageUrl}view`, EyeIcon, "view"),
|
||||
},
|
||||
page: {
|
||||
create: renderLastRowComponent(`${basePageUrl}create`, PlusCircle, "create"),
|
||||
size: renderLastRowComponent(changeList, ExpandIcon, "size-table"),
|
||||
}
|
||||
}
|
||||
const listWithTableProps = {
|
||||
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||
schemas: { table: getSchema.shortSchema },
|
||||
translations: translations,
|
||||
redirectUrls: redirectUrls,
|
||||
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||
setSelectedRow: setSelectedRow,
|
||||
}
|
||||
const CreateFormProps = {
|
||||
schemas: { create: getSchema.createSchema },
|
||||
labels: getSchema.labels,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const UpdateFormProps = {
|
||||
rollbackTo: changeList,
|
||||
schemas: { update: getSchema.updateSchema },
|
||||
labels: getSchema.labels,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const ViewFormProps = {
|
||||
rollbackTo: changeList,
|
||||
schemas: { view: getSchema.detailSchema },
|
||||
selectedRow: selectedRow,
|
||||
labels: getSchema.labels,
|
||||
}
|
||||
const shortAddProps = { ...listWithTableProps, schemas: { table: getSchema.shortSchema }, columns: { table: getSchema.shortColumns } }
|
||||
const fullAddProps = { ...listWithTableProps, schemas: { table: getSchema.detailSchema }, columns: { table: getSchema.columns } }
|
||||
return (
|
||||
<div>
|
||||
{!isList && RenderBackToList}
|
||||
{isList && mode === 'shortList' && <TableComponent {...shortAddProps} />}
|
||||
{isList && mode === 'fullList' && <TableComponent {...fullAddProps} />}
|
||||
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
||||
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
||||
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default SuperUserDashboardPage
|
||||
@@ -1,12 +1,12 @@
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import superUserTenantSomething from "./management/account/tenantSomething/page";
|
||||
import superUserTenantSomethingSecond from "./management/account/tenantSomethingSecond/page";
|
||||
import superUserBuildingPartsTenantSomething from "./building/parts/tenantSomething/page";
|
||||
import SuperUserApplicationPage from "./application/page";
|
||||
import SuperUserServicePage from "./services/page";
|
||||
import SuperUserDashboardPage from "./dashboard/page";
|
||||
|
||||
const pageIndexSingle: Record<string, React.FC<ContentProps>> = {
|
||||
dashboard: superUserTenantSomething,
|
||||
application: superUserTenantSomethingSecond,
|
||||
service: superUserBuildingPartsTenantSomething,
|
||||
"/dashboard": SuperUserDashboardPage,
|
||||
"/application": SuperUserApplicationPage,
|
||||
"/service": SuperUserServicePage,
|
||||
};
|
||||
|
||||
export default pageIndexSingle;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
|
||||
// This is a mock page dont use it
|
||||
const superUserTenantSomething: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
||||
return <>
|
||||
<h1 className="text-4xl font-bold mb-10">{JSON.stringify(translations)}{" "}{lang}{" "}{activePageUrl}</h1>
|
||||
<div className="h-16">Some Content 1</div>
|
||||
<div className="h-16">Some Content 2</div>
|
||||
<div className="h-16">Some Content 3</div>
|
||||
<div className="h-16">Some Content 4</div>
|
||||
<div className="h-16">Some Content 5</div>
|
||||
<div className="h-16">Some Content 6</div>
|
||||
<div className="h-16">Some Content 7</div>
|
||||
<div className="h-16">Some Content 8</div>
|
||||
<div className="h-16">Some Content 9</div>
|
||||
<div className="h-16">Some Content 10</div>
|
||||
<div className="h-16">Some Content 11</div>
|
||||
<div className="h-16">Some Content 12</div>
|
||||
<div className="h-16">Some Content 13</div>
|
||||
<div className="h-16">Some Content 14</div>
|
||||
<div className="h-16">Some Content 15</div>
|
||||
<div className="h-16">Some Content 16</div>
|
||||
</>
|
||||
}
|
||||
|
||||
|
||||
export default superUserTenantSomething
|
||||
@@ -1,27 +0,0 @@
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
|
||||
// This is a mock page dont use it
|
||||
const superUserTenantSomethingSecond: React.FC<ContentProps> = ({ lang, translations, activePageUrl }) => {
|
||||
return <>
|
||||
<h1 className="text-4xl font-bold mb-10">{JSON.stringify(translations)}{" "}{lang}{" "}{activePageUrl}</h1>
|
||||
<div className="h-16">Some Content 1</div>
|
||||
<div className="h-16">Some Content 2</div>
|
||||
<div className="h-16">Some Content 3</div>
|
||||
<div className="h-16">Some Content 4</div>
|
||||
<div className="h-16">Some Content 5</div>
|
||||
<div className="h-16">Some Content 6</div>
|
||||
<div className="h-16">Some Content 7</div>
|
||||
<div className="h-16">Some Content 8</div>
|
||||
<div className="h-16">Some Content 9</div>
|
||||
<div className="h-16">Some Content 10</div>
|
||||
<div className="h-16">Some Content 11</div>
|
||||
<div className="h-16">Some Content 12</div>
|
||||
<div className="h-16">Some Content 13</div>
|
||||
<div className="h-16">Some Content 14</div>
|
||||
<div className="h-16">Some Content 15</div>
|
||||
<div className="h-16">Some Content 16</div>
|
||||
</>
|
||||
}
|
||||
|
||||
|
||||
export default superUserTenantSomethingSecond
|
||||
@@ -0,0 +1,74 @@
|
||||
'use client';
|
||||
import React, { useState } from "react";
|
||||
import TableComponent from "@/components/mutual/tableView/FullTableComp/component";
|
||||
import CreateForm from "@/components/mutual/tableView/mutual/CreateForm";
|
||||
import UpdateForm from "@/components/mutual/tableView/mutual/UpdateForm";
|
||||
import ViewForm from "@/components/mutual/tableView/mutual/ViewForm";
|
||||
|
||||
import { EyeIcon, PencilIcon, PlusCircle, ArrowLeftFromLineIcon, ExpandIcon } from "lucide-react";
|
||||
import { ContentProps } from "@/validations/mutual/dashboard/props";
|
||||
import { getSchemaByLanguage } from "@/schemas/custom/application/schemas";
|
||||
import { API_BASE_URL } from "@/config/config";
|
||||
import { renderLastRowComponent } from "@/components/mutual/navigators/component";
|
||||
|
||||
|
||||
// This is a mock page dont use it
|
||||
const SuperUserServicePage: React.FC<ContentProps> = ({ lang, translations, activePageUrl, mode }) => {
|
||||
const [selectedRow, setSelectedRow] = useState<any>(null);
|
||||
|
||||
const getSchema = getSchemaByLanguage(lang)
|
||||
const basePageUrl = `/panel/${lang}/${activePageUrl}?mode=`
|
||||
const isList = mode === 'shortList' || mode === 'fullList'
|
||||
const changeList = mode === 'shortList' ? `${basePageUrl}fullList` : `${basePageUrl}shortList`
|
||||
|
||||
const RenderBackToList = renderLastRowComponent(`${basePageUrl}shortList`, ArrowLeftFromLineIcon, "backToList")
|
||||
const redirectUrls = {
|
||||
table: {
|
||||
update: renderLastRowComponent(`${basePageUrl}update`, PencilIcon, "update"),
|
||||
view: renderLastRowComponent(`${basePageUrl}view`, EyeIcon, "view"),
|
||||
},
|
||||
page: {
|
||||
create: renderLastRowComponent(`${basePageUrl}create`, PlusCircle, "create"),
|
||||
size: renderLastRowComponent(changeList, ExpandIcon, "size-table"),
|
||||
}
|
||||
}
|
||||
const listWithTableProps = {
|
||||
urls: { list: `${API_BASE_URL}/applications/pages` },
|
||||
schemas: { table: getSchema.shortSchema },
|
||||
translations: translations,
|
||||
redirectUrls: redirectUrls,
|
||||
initPagination: { page: 1, size: 10, orderFields: [], orderTypes: [], query: {} },
|
||||
setSelectedRow: setSelectedRow,
|
||||
}
|
||||
const CreateFormProps = {
|
||||
schemas: { create: getSchema.createSchema },
|
||||
labels: getSchema.labels,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const UpdateFormProps = {
|
||||
rollbackTo: changeList,
|
||||
schemas: { update: getSchema.updateSchema },
|
||||
labels: getSchema.labels,
|
||||
selectedRow: selectedRow,
|
||||
}
|
||||
const ViewFormProps = {
|
||||
rollbackTo: changeList,
|
||||
schemas: { view: getSchema.detailSchema },
|
||||
selectedRow: selectedRow,
|
||||
labels: getSchema.labels,
|
||||
}
|
||||
const shortAddProps = { ...listWithTableProps, schemas: { table: getSchema.shortSchema }, columns: { table: getSchema.shortColumns } }
|
||||
const fullAddProps = { ...listWithTableProps, schemas: { table: getSchema.detailSchema }, columns: { table: getSchema.columns } }
|
||||
return (
|
||||
<div>
|
||||
{!isList && RenderBackToList}
|
||||
{isList && mode === 'shortList' && <TableComponent {...shortAddProps} />}
|
||||
{isList && mode === 'fullList' && <TableComponent {...fullAddProps} />}
|
||||
{mode === 'create' && <CreateForm {...CreateFormProps} />}
|
||||
{mode === 'update' && <UpdateForm {...UpdateFormProps} />}
|
||||
{mode === 'view' && <ViewForm {...ViewFormProps} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default SuperUserServicePage
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { LanguageTypes } from "@/validations/mutual/language/validations";
|
||||
import { buildingPartsFieldsTr } from "@/languages/custom/building/turkish";
|
||||
import { buildingPartsFieldsEn } from "@/languages/custom/building/english";
|
||||
import { applicationFieldsTr } from "@/languages/custom/application/turkish";
|
||||
import { applicationFieldsEn } from "@/languages/custom/application/english";
|
||||
|
||||
interface ApplicationData {
|
||||
uu_id: string;
|
||||
@@ -18,8 +18,8 @@ interface ApplicationData {
|
||||
}
|
||||
|
||||
const labelTranslations = {
|
||||
tr: buildingPartsFieldsTr,
|
||||
en: buildingPartsFieldsEn,
|
||||
tr: applicationFieldsTr,
|
||||
en: applicationFieldsEn,
|
||||
};
|
||||
|
||||
const errorMessages = {
|
||||
|
||||
@@ -2,19 +2,19 @@ interface UpdateFormProps {
|
||||
schemas: Record<string, any>;
|
||||
selectedRow: Record<string, any>;
|
||||
rollbackTo: string;
|
||||
labels: Record<string, string>;
|
||||
labels: any;
|
||||
}
|
||||
interface CreateFormProps {
|
||||
schemas: Record<string, any>;
|
||||
selectedRow: Record<string, any>;
|
||||
labels: Record<string, string>;
|
||||
labels: any;
|
||||
}
|
||||
|
||||
interface ViewFormProps {
|
||||
schemas: Record<string, any>;
|
||||
selectedRow: Record<string, any>;
|
||||
rollbackTo: string;
|
||||
labels: Record<string, string>;
|
||||
labels: any;
|
||||
}
|
||||
|
||||
export type { UpdateFormProps, CreateFormProps, ViewFormProps };
|
||||
|
||||
Reference in New Issue
Block a user