Inspector operation changed

Kahdooie
Hossein Rahmani 2024-02-10 09:55:19 +03:30
parent 74246639e3
commit c3e22fae22
1 changed files with 22 additions and 3 deletions

View File

@ -33,7 +33,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { OperateByInspector } from "@/utils/inspectorApi";
import { toast } from "sonner";
import { Decrypt, formatBytes } from "@/lib/utils";
import { useState } from "react";
import { useEffect, useRef, useState } from "react";
import { getOptions } from "@/utils/commonApi";
import AttachmentsDialog from "./AttachmentsDialog";
import { DialogTrigger } from "./ui/dialog";
@ -53,6 +53,7 @@ export default function InspectorOperations({
key2: any;
}) {
const [file, setFile] = useState<File[]>([]);
const [check, setCheck] = useState<any>(false);
// Queries
const { data, isLoading, refetch } = useQuery({
@ -275,15 +276,24 @@ export default function InspectorOperations({
<FormItem className="">
<FormControl dir="rtl">
<RadioGroup
onValueChange={field.onChange}
onValueChange={(value) => {
console.log(field.value);
field.onChange(value);
setCheck(false);
}}
// defaultValue={field.value}
className="flex space-y-1 text-sm"
>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem
onClick={() => {
// @ts-expect-error
form.setValue("type", "private");
}}
value="private"
className="ml-2 "
checked={form.getValues("type") == "private"}
disabled={possibleOperations.length == 0}
/>
</FormControl>
@ -294,6 +304,7 @@ export default function InspectorOperations({
<RadioGroupItem
value="public"
className="ml-2 "
checked={form.getValues("type") == "public"}
disabled={possibleOperations.length == 0}
/>
</FormControl>
@ -315,7 +326,15 @@ export default function InspectorOperations({
<FormItem className="flex-1 ">
{/* <FormLabel>Email</FormLabel> */}
<Select
onValueChange={field.onChange}
onValueChange={(value) => {
field.onChange(value);
setCheck(false);
if (value == "2") {
setCheck(true);
// @ts-expect-error
form.setValue("type", "public");
}
}}
defaultValue={field.value}
dir="rtl"
>