dashboard updated
This commit is contained in:
parent
9c42225080
commit
ea8f29d6f4
|
|
@ -15,4 +15,24 @@ async function retrieveBuildList(payload: FilterListInterface) {
|
||||||
return tokenResponse;
|
return tokenResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { retrieveBuildList };
|
async function updateBuild(payload: any) {
|
||||||
|
const tokenResponse: any = await fetchDataWithToken(
|
||||||
|
"/building/build/update",
|
||||||
|
payload,
|
||||||
|
"POST",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
return tokenResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createBuild(payload: any) {
|
||||||
|
const tokenResponse: any = await fetchDataWithToken(
|
||||||
|
"/building/build/create",
|
||||||
|
payload,
|
||||||
|
"POST",
|
||||||
|
false
|
||||||
|
);
|
||||||
|
return tokenResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { retrieveBuildList, updateBuild, createBuild };
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,11 @@ import CreateButton from "@/components/ContextComponents/Commons/ButtonCreate";
|
||||||
import BuildUpdatePage from "@/components/ContextComponents/Building/Build/BuildUpdate";
|
import BuildUpdatePage from "@/components/ContextComponents/Building/Build/BuildUpdate";
|
||||||
|
|
||||||
import { retrieveAvailableEvents } from "@/(apicalls)/cookies/token";
|
import { retrieveAvailableEvents } from "@/(apicalls)/cookies/token";
|
||||||
import { retrieveBuildList } from "@/(apicalls)/building/build";
|
import {
|
||||||
|
retrieveBuildList,
|
||||||
|
updateBuild,
|
||||||
|
createBuild,
|
||||||
|
} from "@/(apicalls)/building/build";
|
||||||
import {
|
import {
|
||||||
retrieveHeadersEndpoint,
|
retrieveHeadersEndpoint,
|
||||||
retrieveHeadersAndValidationByEndpoint,
|
retrieveHeadersAndValidationByEndpoint,
|
||||||
|
|
@ -59,6 +63,7 @@ const Build: React.FC = () => {
|
||||||
isFormEnabled={isFormEnabled}
|
isFormEnabled={isFormEnabled}
|
||||||
pageToSet={
|
pageToSet={
|
||||||
<BuildUpdatePage
|
<BuildUpdatePage
|
||||||
|
saveFunction={updateBuild}
|
||||||
validation={updateValidation}
|
validation={updateValidation}
|
||||||
tableSelectedRow={tableSelectedRow}
|
tableSelectedRow={tableSelectedRow}
|
||||||
setTableSelectedRow={setTableSelectedRow}
|
setTableSelectedRow={setTableSelectedRow}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import IsNotAllowed from "@/components/ContextComponents/Commons/PageisNotAllowe
|
||||||
interface BuildUpdatePageButtonProps {
|
interface BuildUpdatePageButtonProps {
|
||||||
validation: any;
|
validation: any;
|
||||||
tableSelectedRow: any;
|
tableSelectedRow: any;
|
||||||
|
saveFunction: any;
|
||||||
setTableSelectedRow: React.Dispatch<React.SetStateAction<any>>;
|
setTableSelectedRow: React.Dispatch<React.SetStateAction<any>>;
|
||||||
formPageFunction: React.Dispatch<React.SetStateAction<React.JSX.Element>>;
|
formPageFunction: React.Dispatch<React.SetStateAction<React.JSX.Element>>;
|
||||||
isFormEnabledFunction: React.Dispatch<React.SetStateAction<boolean>>;
|
isFormEnabledFunction: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
|
|
@ -13,6 +14,7 @@ interface BuildUpdatePageButtonProps {
|
||||||
const BuildUpdatePage: React.FC<BuildUpdatePageButtonProps> = ({
|
const BuildUpdatePage: React.FC<BuildUpdatePageButtonProps> = ({
|
||||||
validation,
|
validation,
|
||||||
tableSelectedRow,
|
tableSelectedRow,
|
||||||
|
saveFunction,
|
||||||
setTableSelectedRow,
|
setTableSelectedRow,
|
||||||
formPageFunction,
|
formPageFunction,
|
||||||
isFormEnabledFunction,
|
isFormEnabledFunction,
|
||||||
|
|
@ -23,10 +25,10 @@ const BuildUpdatePage: React.FC<BuildUpdatePageButtonProps> = ({
|
||||||
title="Bina Güncelle Sayfasına Hoş geldiniz"
|
title="Bina Güncelle Sayfasına Hoş geldiniz"
|
||||||
validation={validation}
|
validation={validation}
|
||||||
tableSelectedRow={tableSelectedRow}
|
tableSelectedRow={tableSelectedRow}
|
||||||
|
saveFunction={saveFunction}
|
||||||
setTableSelectedRow={setTableSelectedRow}
|
setTableSelectedRow={setTableSelectedRow}
|
||||||
formPageFunction={formPageFunction}
|
formPageFunction={formPageFunction}
|
||||||
isFormEnabledFunction={isFormEnabledFunction}
|
isFormEnabledFunction={isFormEnabledFunction}
|
||||||
onClickAction={() => console.log("Create button clicked")}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -18,20 +18,20 @@ interface UpdatePageButtonProps {
|
||||||
title: string;
|
title: string;
|
||||||
validation: any;
|
validation: any;
|
||||||
tableSelectedRow: any;
|
tableSelectedRow: any;
|
||||||
|
saveFunction: any;
|
||||||
setTableSelectedRow: React.Dispatch<React.SetStateAction<any>>;
|
setTableSelectedRow: React.Dispatch<React.SetStateAction<any>>;
|
||||||
formPageFunction: React.Dispatch<React.SetStateAction<React.JSX.Element>>;
|
formPageFunction: React.Dispatch<React.SetStateAction<React.JSX.Element>>;
|
||||||
isFormEnabledFunction: React.Dispatch<React.SetStateAction<boolean>>;
|
isFormEnabledFunction: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
onClickAction: () => void;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const PageUpdate: React.FC<UpdatePageButtonProps> = ({
|
const PageUpdate: React.FC<UpdatePageButtonProps> = ({
|
||||||
title,
|
title,
|
||||||
validation,
|
validation,
|
||||||
tableSelectedRow,
|
tableSelectedRow,
|
||||||
|
saveFunction,
|
||||||
setTableSelectedRow,
|
setTableSelectedRow,
|
||||||
formPageFunction,
|
formPageFunction,
|
||||||
isFormEnabledFunction,
|
isFormEnabledFunction,
|
||||||
onClickAction,
|
|
||||||
}) => {
|
}) => {
|
||||||
const [validatedData, setValidatedData] = React.useState({});
|
const [validatedData, setValidatedData] = React.useState({});
|
||||||
const [zodValidation, setZodValidation] = React.useState(z.object({}));
|
const [zodValidation, setZodValidation] = React.useState(z.object({}));
|
||||||
|
|
@ -76,8 +76,9 @@ const PageUpdate: React.FC<UpdatePageButtonProps> = ({
|
||||||
setTableSelectedRow({});
|
setTableSelectedRow({});
|
||||||
isFormEnabledFunction(false);
|
isFormEnabledFunction(false);
|
||||||
}
|
}
|
||||||
function onSubmit() {
|
function onSubmit(values: z.infer<typeof zodValidation>) {
|
||||||
console.log("onSubmit");
|
console.log("onSubmit", values);
|
||||||
|
// saveFunction(validatedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
@ -109,7 +110,7 @@ const PageUpdate: React.FC<UpdatePageButtonProps> = ({
|
||||||
/>
|
/>
|
||||||
<div className="absolute right-0">
|
<div className="absolute right-0">
|
||||||
<EventButton
|
<EventButton
|
||||||
onClick={() => onClickAction()}
|
onClick={() => onSubmit()}
|
||||||
label="Kaydet"
|
label="Kaydet"
|
||||||
bgColor="bg-emerald-700"
|
bgColor="bg-emerald-700"
|
||||||
icon={
|
icon={
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue