Refuse documents (#30)
This commit is contained in:
commit
5f083e1b6c
@ -13,7 +13,8 @@ export interface IGetDocumentsparams {
|
||||
// TODO Type getbyuid query params
|
||||
|
||||
export type IPutDocumentsParams = {
|
||||
document_status?: EDocumentStatus
|
||||
document_status?: EDocumentStatus;
|
||||
refused_reason?: string;
|
||||
};
|
||||
|
||||
export interface IPostDocumentsParams {}
|
||||
|
@ -66,6 +66,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
this.hasPrevious = this.hasPrevious.bind(this);
|
||||
this.hasNext = this.hasNext.bind(this);
|
||||
this.refuseDocument = this.refuseDocument.bind(this);
|
||||
}
|
||||
|
||||
public override render(): JSX.Element | null {
|
||||
@ -156,7 +157,7 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
<Confirm
|
||||
isOpen={this.state.isRefuseModalVisible}
|
||||
onClose={this.closeModals}
|
||||
onAccept={this.closeModals}
|
||||
onAccept={this.refuseDocument}
|
||||
closeBtn
|
||||
header={"Refuser le document ?"}
|
||||
cancelText={"Annuler"}
|
||||
@ -244,6 +245,23 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
|
||||
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() {
|
||||
this.setState({
|
||||
hasValidateAnchoring: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user