✨ Parcours d'ancrage ok
This commit is contained in:
parent
add3d44e0b
commit
07a360f338
@ -24,7 +24,6 @@ export default function Navigation() {
|
|||||||
redirectUrl: notification.notification.redirection_url,
|
redirectUrl: notification.notification.redirection_url,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.log(notifications);
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -36,6 +36,7 @@ type IState = {
|
|||||||
isValidateModalVisible: boolean;
|
isValidateModalVisible: boolean;
|
||||||
hasValidateAnchoring: boolean;
|
hasValidateAnchoring: boolean;
|
||||||
isVerifDeleteModalVisible: boolean;
|
isVerifDeleteModalVisible: boolean;
|
||||||
|
isAnchored: boolean | null;
|
||||||
};
|
};
|
||||||
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||||
public constructor(props: IPropsClass) {
|
public constructor(props: IPropsClass) {
|
||||||
@ -47,6 +48,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
isValidateModalVisible: false,
|
isValidateModalVisible: false,
|
||||||
hasValidateAnchoring: false,
|
hasValidateAnchoring: false,
|
||||||
isVerifDeleteModalVisible: false,
|
isVerifDeleteModalVisible: false,
|
||||||
|
isAnchored: null,
|
||||||
};
|
};
|
||||||
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
this.onSelectedFolder = this.onSelectedFolder.bind(this);
|
||||||
this.openArchivedModal = this.openArchivedModal.bind(this);
|
this.openArchivedModal = this.openArchivedModal.bind(this);
|
||||||
@ -60,6 +62,7 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.openValidateModal = this.openValidateModal.bind(this);
|
this.openValidateModal = this.openValidateModal.bind(this);
|
||||||
this.openVerifDeleteFolder = this.openVerifDeleteFolder.bind(this);
|
this.openVerifDeleteFolder = this.openVerifDeleteFolder.bind(this);
|
||||||
this.closeVerifDeleteFolder = this.closeVerifDeleteFolder.bind(this);
|
this.closeVerifDeleteFolder = this.closeVerifDeleteFolder.bind(this);
|
||||||
|
this.verifyAnchorStatus = this.verifyAnchorStatus.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Message if the user has not created any folder yet
|
// TODO: Message if the user has not created any folder yet
|
||||||
@ -109,16 +112,20 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
Archiver le dossier
|
Archiver le dossier
|
||||||
</Button>
|
</Button>
|
||||||
{this.everyDocumentValidated() && (
|
{this.everyDocumentValidated() && (
|
||||||
<Button variant={EButtonVariant.PRIMARY} onClick={this.openValidateModal}>
|
<>
|
||||||
Ancrer le dossier
|
{this.state.isAnchored === null && (
|
||||||
</Button>
|
<Button variant={EButtonVariant.PRIMARY} onClick={this.openValidateModal}>
|
||||||
)}
|
Ancrer le dossier
|
||||||
{this.everyDocumentValidated() && (
|
</Button>
|
||||||
<Button
|
)}
|
||||||
variant={EButtonVariant.PRIMARY}
|
{this.state.isAnchored === true && (
|
||||||
onClick={() => this.downloadAnchoringProof(this.state.selectedFolder?.uid)}>
|
<Button
|
||||||
Télécharger la preuve d'ancrage
|
variant={EButtonVariant.PRIMARY}
|
||||||
</Button>
|
onClick={() => this.downloadAnchoringProof(this.state.selectedFolder?.uid)}>
|
||||||
|
Télécharger la preuve d'ancrage
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
{!this.doesFolderHaveCustomer() && (
|
{!this.doesFolderHaveCustomer() && (
|
||||||
<span className={classes["delete-folder"]} onClick={this.openVerifDeleteFolder}>
|
<span className={classes["delete-folder"]} onClick={this.openVerifDeleteFolder}>
|
||||||
@ -207,11 +214,30 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
public override async componentDidMount() {
|
public override async componentDidMount() {
|
||||||
this.setState({
|
const selectedFolder = await this.getFolder();
|
||||||
selectedFolder: (await this.getFolder()) as OfficeFolder,
|
this.setState(
|
||||||
});
|
{
|
||||||
|
selectedFolder,
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
this.verifyAnchorStatus();
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async verifyAnchorStatus() {
|
||||||
|
if (!this.state.selectedFolder || !this.state.selectedFolder.uid) return;
|
||||||
|
try {
|
||||||
|
const anchorStatus = await OfficeFolderAnchors.getInstance().get(this.state.selectedFolder.uid!);
|
||||||
|
this.setState({
|
||||||
|
isAnchored: anchorStatus.status === "VERIFIED_ON_CHAIN",
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
this.setState({
|
||||||
|
isAnchored: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
public openVerifDeleteFolder() {
|
public openVerifDeleteFolder() {
|
||||||
this.setState({
|
this.setState({
|
||||||
isVerifDeleteModalVisible: true,
|
isVerifDeleteModalVisible: true,
|
||||||
@ -267,15 +293,11 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
|||||||
private async anchorFolder() {
|
private async anchorFolder() {
|
||||||
if (!this.state.selectedFolder?.uid) return;
|
if (!this.state.selectedFolder?.uid) return;
|
||||||
const anchor = await OfficeFolderAnchors.getInstance().post(this.state.selectedFolder.uid);
|
const anchor = await OfficeFolderAnchors.getInstance().post(this.state.selectedFolder.uid);
|
||||||
console.log(anchor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async downloadAnchoringProof(uid?: string) {
|
private async downloadAnchoringProof(uid?: string) {
|
||||||
if (!uid) return;
|
if (!uid) return;
|
||||||
|
|
||||||
const anchor = await OfficeFolderAnchors.getInstance().get(uid);
|
|
||||||
if (anchor.status !== "VERIFIED_ON_CHAIN") return;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
const file: Blob = await OfficeFolderAnchors.getInstance().download(uid);
|
||||||
const url = window.URL.createObjectURL(file);
|
const url = window.URL.createObjectURL(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user