diff --git a/src/partials/tagging/OtpAuthModal.tsx b/src/partials/tagging/OtpAuthModal.tsx
index 66a8470..0f87e13 100644
--- a/src/partials/tagging/OtpAuthModal.tsx
+++ b/src/partials/tagging/OtpAuthModal.tsx
@@ -12,7 +12,7 @@ export const OtpAuthModal = ({ item, getData }: any) => {
const [selectedUser, setSelectedUser] = useState<(string | number)[]>([]);
const { data: usersData } = useApiRequest({
- api: `/auth/api/v1/organization/${item?.id}/org_users/`,
+ api: `/auth/api/v1/organization/${item?.assigned_org?.id}/org_users/`,
method: "get",
queryKey: ["orgUsers", item?.id],
});
@@ -23,7 +23,7 @@ export const OtpAuthModal = ({ item, getData }: any) => {
});
const usersOptions =
- usersData?.results?.map((user: any) => ({
+ usersData?.map((user: any) => ({
key: user?.user_receiver,
value: `${user?.first_name} ${user?.last_name} - ${user?.mobile}`,
})) ?? [];
@@ -31,7 +31,7 @@ export const OtpAuthModal = ({ item, getData }: any) => {
const onSubmit = async () => {
if (selectedUser.length === 0) return;
- const selected = usersData?.results?.find(
+ const selected = usersData?.find(
(u: any) => u.user_receiver === selectedUser[0],
);
diff --git a/src/partials/tagging/OtpVerifyModal.tsx b/src/partials/tagging/OtpVerifyModal.tsx
new file mode 100644
index 0000000..f19cd99
--- /dev/null
+++ b/src/partials/tagging/OtpVerifyModal.tsx
@@ -0,0 +1,46 @@
+import { useState } from "react";
+import { Grid } from "../../components/Grid/Grid";
+import Button from "../../components/Button/Button";
+import Textfield from "../../components/Textfeild/Textfeild";
+import { useApiMutation } from "../../utils/useApiRequest";
+import { useToast } from "../../hooks/useToast";
+import { useModalStore } from "../../context/zustand-store/appStore";
+
+export const OtpVerifyModal = ({ item, getData }: any) => {
+ const showToast = useToast();
+ const { closeModal } = useModalStore();
+ const [code, setCode] = useState("");
+
+ const mutation = useApiMutation({
+ api: `/tag/web/api/v1/tag_distribution_batch/${item?.id}/otp_auth/?otp_type=check`,
+ method: "post",
+ });
+
+ const onSubmit = async () => {
+ if (!code) return;
+
+ try {
+ await mutation.mutateAsync({ code: String(code) });
+ showToast("احراز با موفقیت انجام شد", "success");
+ getData();
+ closeModal();
+ } catch (error: any) {
+ showToast(error?.response?.data?.message || "خطا در احراز!", "error");
+ }
+ };
+
+ return (
+
+ setCode(e.target.value)}
+ />
+
+
+
+ );
+};
diff --git a/src/partials/tagging/TagActiveDistributions.tsx b/src/partials/tagging/TagActiveDistributions.tsx
index fc42a61..005bf83 100644
--- a/src/partials/tagging/TagActiveDistributions.tsx
+++ b/src/partials/tagging/TagActiveDistributions.tsx
@@ -2,6 +2,7 @@ import { useEffect, useState } from "react";
import {
Bars3Icon,
CheckBadgeIcon,
+ ClockIcon,
CubeIcon,
SparklesIcon,
StopCircleIcon,
@@ -24,6 +25,7 @@ import { BooleanQuestion } from "../../components/BooleanQuestion/BooleanQuestio
import { TableButton } from "../../components/TableButton/TableButton";
import { DistributionSpeciesModal } from "./DistributionSpeciesModal";
import { OtpAuthModal } from "./OtpAuthModal";
+import { OtpVerifyModal } from "./OtpVerifyModal";
import { useNavigate } from "@tanstack/react-router";
import { TAG_DISTRIBUTION } from "../../routes/paths";
import { DocumentOperation } from "../../components/DocumentOperation/DocumentOperation";
@@ -224,29 +226,56 @@ export default function TagActiveDistributions() {
تایید سند خروج
),
- item?.otp_status ? (
+ item?.otp_status === "accept" ? (
- احراز شده
+ احراز شده
+
+ ) : item?.otp_status === "pending" ? (
+
+
+ ارسال شده
) : (
- احراز نشده
+ ارسال نشده
),
- ,
+ item?.otp_status !== "accept" ? (
+
+
+ {item?.otp_status === "pending" && (
+
+ )}
+
+ ) : (
+ "احراز شده"
+ ),