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