fix column
This commit is contained in:
parent
9f433d3f9b
commit
293f2c9d84
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
.ant-btn-default {
|
.ant-btn-default {
|
||||||
padding: 7px 11px;
|
padding: 7px 11px;
|
||||||
height: var(--fieldHeight);
|
min-height: var(--fieldHeight);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -45,12 +45,12 @@
|
||||||
|
|
||||||
/// input hight
|
/// input hight
|
||||||
.ant-form-item-control-input-content {
|
.ant-form-item-control-input-content {
|
||||||
height: var(--fieldHeight);
|
min-height: var(--fieldHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
//// date picker
|
//// date picker
|
||||||
.ant-picker-large {
|
.ant-picker-large {
|
||||||
height: var(--fieldHeight);
|
min-height: var(--fieldHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// text area
|
/// text area
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,10 @@ const DataTable: React.FC<DataTableProps> = ({
|
||||||
nextIcon: <>{t("practical.next")}</>,
|
nextIcon: <>{t("practical.next")}</>,
|
||||||
prevIcon: <> {t("practical.prev")} </>,
|
prevIcon: <> {t("practical.prev")} </>,
|
||||||
className: "pagination_antd",
|
className: "pagination_antd",
|
||||||
|
showSizeChanger:false
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ const usePagination = (data: Data) => {
|
||||||
current: data?.meta?.current_page || 1,
|
current: data?.meta?.current_page || 1,
|
||||||
pageSize: data?.meta?.per_page || 2,
|
pageSize: data?.meta?.per_page || 2,
|
||||||
total: data?.meta?.total || 0,
|
total: data?.meta?.total || 0,
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -21,6 +22,7 @@ const usePagination = (data: Data) => {
|
||||||
current: data?.meta?.current_page || 1,
|
current: data?.meta?.current_page || 1,
|
||||||
pageSize: data?.meta?.per_page || 2,
|
pageSize: data?.meta?.per_page || 2,
|
||||||
total: data?.meta?.total || 0,
|
total: data?.meta?.total || 0,
|
||||||
|
|
||||||
});
|
});
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,7 @@ export const useColumns = () => {
|
||||||
// ),
|
// ),
|
||||||
title: t("columns.procedure"),
|
title: t("columns.procedure"),
|
||||||
key: "actions",
|
key: "actions",
|
||||||
align: "end",
|
align: "center",
|
||||||
width: "25vw",
|
|
||||||
render: (_text, record, index) => {
|
render: (_text, record, index) => {
|
||||||
return (
|
return (
|
||||||
<ActionButtons
|
<ActionButtons
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import { toast } from "react-toastify";
|
||||||
const AcceptModal = lazy(() => import("./Model/AcceptModal"));
|
const AcceptModal = lazy(() => import("./Model/AcceptModal"));
|
||||||
|
|
||||||
const AddPage: React.FC = () => {
|
const AddPage: React.FC = () => {
|
||||||
const { mutateAsync } = useAddQuestionAsync();
|
const { mutateAsync,isLoading:LoadingAsync } = useAddQuestionAsync();
|
||||||
const { mutate, isLoading, isSuccess } = useAddQuestion();
|
const { mutate, isLoading, isSuccess } = useAddQuestion();
|
||||||
const { isBseQuestion, setTagsSearch, objectToEdit, setSuccess } =
|
const { isBseQuestion, setTagsSearch, objectToEdit, setSuccess } =
|
||||||
useObjectToEdit();
|
useObjectToEdit();
|
||||||
|
|
@ -72,13 +72,6 @@ const AddPage: React.FC = () => {
|
||||||
const isValidAnswers = answers?.some(
|
const isValidAnswers = answers?.some(
|
||||||
(answer: any) => answer?.isCorrect === 1,
|
(answer: any) => answer?.isCorrect === 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!isValidAnswers) {
|
|
||||||
toast.error(
|
|
||||||
t("validation.at_least_one_answer_should_be_correct"),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mutate({
|
mutate({
|
||||||
...item,
|
...item,
|
||||||
|
|
@ -134,7 +127,7 @@ const AddPage: React.FC = () => {
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
navigate(-1);
|
navigate(-1);
|
||||||
};
|
};
|
||||||
|
const Loading = LoadingAsync || isLoading
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("all api success");
|
console.log("all api success");
|
||||||
if (isSuccess) {
|
if (isSuccess) {
|
||||||
|
|
@ -156,10 +149,10 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
<div className="exercise_add_buttons">
|
<div className="exercise_add_buttons">
|
||||||
<div onClick={handleCancel}>{t("practical.back")}</div>
|
<div onClick={handleCancel}>{t("practical.back")}</div>
|
||||||
<button disabled={isLoading} className="relative" type="submit">
|
<button disabled={Loading} className="relative" type="submit">
|
||||||
{t("practical.add")}
|
{t("practical.add")}
|
||||||
|
|
||||||
{isLoading && (
|
{Loading && (
|
||||||
<span className="Spinier_Div">
|
<span className="Spinier_Div">
|
||||||
<Spin />
|
<Spin />
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -187,10 +180,10 @@ const AddPage: React.FC = () => {
|
||||||
|
|
||||||
<div className="exercise_add_buttons">
|
<div className="exercise_add_buttons">
|
||||||
<div onClick={handleCancel}>{t("practical.back")}</div>
|
<div onClick={handleCancel}>{t("practical.back")}</div>
|
||||||
<button disabled={isLoading} className="relative" type="submit">
|
<button disabled={Loading} className="relative" type="submit">
|
||||||
{t("practical.add")}
|
{t("practical.add")}
|
||||||
|
|
||||||
{isLoading && (
|
{Loading && (
|
||||||
<span className="Spinier_Div">
|
<span className="Spinier_Div">
|
||||||
<Spin />
|
<Spin />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
useUpdateQuestion,
|
useUpdateQuestion,
|
||||||
} from "../../../api/Question";
|
} from "../../../api/Question";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
||||||
import { ParamsEnum } from "../../../enums/params";
|
import { ParamsEnum } from "../../../enums/params";
|
||||||
import { useObjectToEdit } from "../../../zustand/ObjectToEditState";
|
import { useObjectToEdit } from "../../../zustand/ObjectToEditState";
|
||||||
import { removeStringKeys } from "../../../utils/removeStringKeys";
|
import { removeStringKeys } from "../../../utils/removeStringKeys";
|
||||||
|
|
@ -24,6 +24,7 @@ import ModelForm from "./Model/ModelForm";
|
||||||
import BaseForm from "./Model/Malty/Form";
|
import BaseForm from "./Model/Malty/Form";
|
||||||
import { Question } from "../../../types/Item";
|
import { Question } from "../../../types/Item";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
|
import { deletePathSegments } from "../../../utils/deletePathSegments";
|
||||||
|
|
||||||
const EditPage: React.FC = () => {
|
const EditPage: React.FC = () => {
|
||||||
const { subject_id, lesson_id, question_id } = useParams<ParamsEnum>();
|
const { subject_id, lesson_id, question_id } = useParams<ParamsEnum>();
|
||||||
|
|
@ -32,7 +33,7 @@ const EditPage: React.FC = () => {
|
||||||
|
|
||||||
const { mutate, isSuccess, isLoading } = useUpdateQuestion();
|
const { mutate, isSuccess, isLoading } = useUpdateQuestion();
|
||||||
const { mutate: DeleteQuestion } = useDeleteQuestion();
|
const { mutate: DeleteQuestion } = useDeleteQuestion();
|
||||||
const { mutate: mutateAdd } = useAddQuestion();
|
const { mutate: mutateAdd , isLoading:LoadingAsync } = useAddQuestion();
|
||||||
|
|
||||||
const { data, isLoading: dataLoading } = useGetAllQuestion({
|
const { data, isLoading: dataLoading } = useGetAllQuestion({
|
||||||
show: question_id,
|
show: question_id,
|
||||||
|
|
@ -178,17 +179,22 @@ const EditPage: React.FC = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const location = useLocation();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
navigate(-1);
|
navigate(-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (isSuccess) {
|
useEffect(() => {
|
||||||
// toast.success(t("validation.the_possess_done_successful"));
|
if (isSuccess) {
|
||||||
// navigate(-1);
|
toast.success(t("validation.the_possess_done_successful"));
|
||||||
// }
|
navigate(deletePathSegments(location.pathname, 2));
|
||||||
// }, [isSuccess]);
|
}
|
||||||
|
}, [isSuccess]);
|
||||||
|
|
||||||
|
const Loading = LoadingAsync || isLoading
|
||||||
|
|
||||||
if (dataLoading || QuestionsDataLoading) {
|
if (dataLoading || QuestionsDataLoading) {
|
||||||
return <SpinContainer />;
|
return <SpinContainer />;
|
||||||
|
|
@ -212,10 +218,10 @@ const EditPage: React.FC = () => {
|
||||||
<BaseForm />
|
<BaseForm />
|
||||||
<div className="exercise_add_buttons">
|
<div className="exercise_add_buttons">
|
||||||
<div onClick={handleCancel}>{t("practical.back")}</div>
|
<div onClick={handleCancel}>{t("practical.back")}</div>
|
||||||
<button disabled={isLoading} className="relative" type="submit">
|
<button disabled={Loading} className="relative" type="submit">
|
||||||
{t("practical.edit")}
|
{t("practical.edit")}
|
||||||
|
|
||||||
{isLoading && (
|
{Loading && (
|
||||||
<span className="Spinier_Div">
|
<span className="Spinier_Div">
|
||||||
<Spin />
|
<Spin />
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -246,10 +252,10 @@ const EditPage: React.FC = () => {
|
||||||
<ModelForm />
|
<ModelForm />
|
||||||
<div className="exercise_add_buttons">
|
<div className="exercise_add_buttons">
|
||||||
<div onClick={handleCancel}>{t("practical.back")}</div>
|
<div onClick={handleCancel}>{t("practical.back")}</div>
|
||||||
<button disabled={isLoading} className="relative" type="submit">
|
<button disabled={Loading} className="relative" type="submit">
|
||||||
{t("practical.edit")}
|
{t("practical.edit")}
|
||||||
|
|
||||||
{isLoading && (
|
{Loading && (
|
||||||
<span className="Spinier_Div">
|
<span className="Spinier_Div">
|
||||||
<Spin />
|
<Spin />
|
||||||
</span>
|
</span>
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ const Dummy = () => {
|
||||||
const { FilterButton, FilterBody } = useFilter();
|
const { FilterButton, FilterBody } = useFilter();
|
||||||
return (
|
return (
|
||||||
<div className="DummyHomePage">
|
<div className="DummyHomePage">
|
||||||
<FilterButton />
|
{/* <FilterButton />
|
||||||
<FilterBody>karim</FilterBody>
|
<FilterBody>karim</FilterBody> */}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
15
src/utils/deletePathSegments copy.ts
Normal file
15
src/utils/deletePathSegments copy.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
export const deletePathSegments = (path: string, num: number): string => {
|
||||||
|
// Split the path by '/'
|
||||||
|
const segments = path.split("/");
|
||||||
|
|
||||||
|
// Handle cases where the number of segments to delete is greater than available segments
|
||||||
|
if (num >= segments.length - 1) {
|
||||||
|
return "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the specified number of segments from the end
|
||||||
|
const newSegments = segments.slice(0, -num);
|
||||||
|
|
||||||
|
// Join the remaining segments back into a path
|
||||||
|
return newSegments.join("/");
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user