display suggestion for tags when create or update documen form
This commit is contained in:
parent
a52cf0bc39
commit
97a32b8f42
@ -10,6 +10,7 @@ import {
|
||||
import TagInput from "../common/TagInput";
|
||||
import {
|
||||
useDocumentDetails,
|
||||
useDocumentTags,
|
||||
useUpdateDocument,
|
||||
useUploadDocument,
|
||||
} from "../../hooks/useDocument";
|
||||
@ -133,6 +134,7 @@ const ManageDocument = ({ closeModal, Document_Entity, Entity }) => {
|
||||
const { DocumentTypes, isLoading: isTypeLoading } = useDocumentTypes(
|
||||
categoryId || null
|
||||
);
|
||||
const {data:DocumentTags} = useDocumentTags()
|
||||
|
||||
// Update schema whenever document type changes
|
||||
useEffect(() => {
|
||||
@ -380,7 +382,7 @@ const ManageDocument = ({ closeModal, Document_Entity, Entity }) => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<TagInput name="tags" label="Tags" placeholder="Tags.." />
|
||||
<TagInput name="tags" label="Tags" placeholder="Tags.." options={DocumentTags} />
|
||||
{errors.tags && (
|
||||
<small className="danger-text">{errors.tags.message}</small>
|
||||
)}
|
||||
|
@ -102,6 +102,15 @@ export const useDocumentVersion = (id)=>{
|
||||
enabled:!!id
|
||||
})
|
||||
}
|
||||
|
||||
export const useDocumentTags =()=>{
|
||||
return useQuery({
|
||||
queryKey:["DocumentTag"],
|
||||
queryFn:async()=> {const resp = await DocumentRepository.getDocumentTags()
|
||||
return resp.data
|
||||
}
|
||||
})
|
||||
}
|
||||
//----------------------- MUTATION -------------------------
|
||||
|
||||
export const useUploadDocument = (onSuccessCallBack) => {
|
||||
|
@ -18,7 +18,9 @@ export const DocumentRepository = {
|
||||
|
||||
verifyDocument:(id,isVerify)=>api.post(`/api/Document/verify/${id}/?isVerify=${isVerify}`),
|
||||
|
||||
deleteDocument:(id,isActive)=>api.delete(`/api/Document/delete/${id}/?isActive=${isActive}`)
|
||||
deleteDocument:(id,isActive)=>api.delete(`/api/Document/delete/${id}/?isActive=${isActive}`),
|
||||
|
||||
getDocumentTags:()=>api.get('/api/Document/get/tags')
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user