✨ Refuse documents working
This commit is contained in:
parent
ad874c6c93
commit
223e7b5c90
@ -13,7 +13,8 @@ export interface IGetDocumentsparams {
|
|||||||
// TODO Type getbyuid query params
|
// TODO Type getbyuid query params
|
||||||
|
|
||||||
export type IPutDocumentsParams = {
|
export type IPutDocumentsParams = {
|
||||||
document_status?: EDocumentStatus
|
document_status?: EDocumentStatus;
|
||||||
|
refused_reason?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface IPostDocumentsParams {}
|
export interface IPostDocumentsParams {}
|
||||||
|
@ -66,6 +66,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
|
|
||||||
this.hasPrevious = this.hasPrevious.bind(this);
|
this.hasPrevious = this.hasPrevious.bind(this);
|
||||||
this.hasNext = this.hasNext.bind(this);
|
this.hasNext = this.hasNext.bind(this);
|
||||||
|
this.refuseDocument = this.refuseDocument.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override render(): JSX.Element | null {
|
public override render(): JSX.Element | null {
|
||||||
@ -156,7 +157,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
<Confirm
|
<Confirm
|
||||||
isOpen={this.state.isRefuseModalVisible}
|
isOpen={this.state.isRefuseModalVisible}
|
||||||
onClose={this.closeModals}
|
onClose={this.closeModals}
|
||||||
onAccept={this.closeModals}
|
onAccept={this.refuseDocument}
|
||||||
closeBtn
|
closeBtn
|
||||||
header={"Refuser le document ?"}
|
header={"Refuser le document ?"}
|
||||||
cancelText={"Annuler"}
|
cancelText={"Annuler"}
|
||||||
@ -244,6 +245,23 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
return index < this.state.document!.files!.length;
|
return index < this.state.document!.files!.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async refuseDocument(){
|
||||||
|
try{
|
||||||
|
await Documents.getInstance().put(this.props.documentUid, {
|
||||||
|
document_status: EDocumentStatus.REFUSED,
|
||||||
|
refused_reason: this.state.refuseText,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.props.router.push(
|
||||||
|
Module.getInstance()
|
||||||
|
.get()
|
||||||
|
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid),
|
||||||
|
);
|
||||||
|
}catch(e){
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async validateAnchoring() {
|
private async validateAnchoring() {
|
||||||
this.setState({
|
this.setState({
|
||||||
hasValidateAnchoring: true,
|
hasValidateAnchoring: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user