This commit is contained in:
Hugo Lextrait 2023-05-10 15:35:06 +02:00
commit 6a0b63bd4c
6 changed files with 37 additions and 6 deletions

View File

@ -82,4 +82,10 @@
.text { .text {
margin-bottom: 12px; margin-bottom: 12px;
} }
}
.modal-content{
display: flex;
flex-direction: column;
gap: 16px;
} }

View File

@ -65,6 +65,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
} }
public override render(): JSX.Element { public override render(): JSX.Element {
console.log("Reason in state : ", this.state.refusedReason);
return ( return (
<div <div
className={classNames( className={classNames(
@ -138,12 +139,12 @@ export default class DepositDocument extends React.Component<IProps, IState> {
onAccept={this.onCloseModalShowRefusedReason} onAccept={this.onCloseModalShowRefusedReason}
closeBtn closeBtn
header={"Motif du refus"} header={"Motif du refus"}
confirmText={"Jai compris"}> confirmText={"J'ai compris"}>
<div className={classes["modal-content"]}> <div className={classes["modal-content"]}>
<Typography typo={ITypo.P_16} className={classes["text"]}> <Typography typo={ITypo.P_16} className={classes["text"]}>
Votre document a é refusé pour la raison suivante : Votre document a é refusé pour la raison suivante :
</Typography> </Typography>
<InputField textarea fakeplaceholder={"Description"} value={"this.state.refusedReason"} /> <InputField textarea fakeplaceholder={"Description"} defaultValue={this.state.refusedReason} readOnly />
</div> </div>
</Confirm> </Confirm>
; ;
@ -200,7 +201,7 @@ export default class DepositDocument extends React.Component<IProps, IState> {
return ( return (
<Typography typo={ITypo.CAPTION_14} color={ITypoColor.RE_HOVER}> <Typography typo={ITypo.CAPTION_14} color={ITypoColor.RE_HOVER}>
Document non conforme Document non conforme
{history.refused_reason !== "" && ( {history.refused_reason && history.refused_reason.length > 0 && (
<Button <Button
variant={EButtonVariant.LINE} variant={EButtonVariant.LINE}
className={classes["refused-button"]} className={classes["refused-button"]}

View File

@ -12,6 +12,10 @@
font-weight: 400; font-weight: 400;
font-size: 18px; font-size: 18px;
line-height: 22px; line-height: 22px;
&:read-only{
cursor: not-allowed;
}
} }
.input { .input {
@ -74,7 +78,6 @@
&::-webkit-outer-spin-button { &::-webkit-outer-spin-button {
-webkit-appearance: none; -webkit-appearance: none;
margin: 0; margin: 0;
-moz-appearance: textfield;
} }
/* For IE 10+ */ /* For IE 10+ */

View File

@ -51,7 +51,8 @@ export default class InputField extends BaseField<IProps> {
className={ className={
this.props.className ? [classes["textarea"], classes[this.props.className]].join(" ") : classes["textarea"] this.props.className ? [classes["textarea"], classes[this.props.className]].join(" ") : classes["textarea"]
} }
value={value}> value={value}
readOnly={this.props.readOnly}>
{value.toString()} {value.toString()}
</textarea> </textarea>
<div className={classes["fake-placeholder"]}> <div className={classes["fake-placeholder"]}>

View File

@ -79,16 +79,35 @@ export default class Modal extends React.Component<IProps, IState> {
willClose: false, willClose: false,
}); });
}, this.props.animationDelay); }, this.props.animationDelay);
document.body.style.overflow = "auto";
} }
if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen) { if (prevProps.isOpen !== this.props.isOpen && this.props.isOpen) {
this.setState({ isOpen: true }); this.setState({ isOpen: true });
document.body.style.overflow = "hidden";
} }
this.rootRefElement.current?.style.setProperty("--animation-delay", this.props.animationDelay!.toString().concat("ms")); this.rootRefElement.current?.style.setProperty("--animation-delay", this.props.animationDelay!.toString().concat("ms"));
} }
public override componentDidMount(): void {
document.addEventListener("keydown", this.handleKeyDown);
}
public override componentWillUnmount(): void {
document.body.style.overflow = "auto";
document.removeEventListener("keydown", this.handleKeyDown);
}
protected close() { protected close() {
if (this.props.hasContainerClosable === false) return; if (this.props.hasContainerClosable === false) return;
if (this.state.willClose) return; if (this.state.willClose) return;
this.props.onClose(); this.props.onClose();
} }
private handleKeyDown = (e: KeyboardEvent): void => {
if (e.key === "Escape" || e.key === "Esc" || e.key === "Backspace") {
this.props.onClose();
}
}
} }

View File

@ -138,7 +138,8 @@ export default class UserFolder extends React.Component<IProps, IState> {
private calculateDocumentsPercentageProgress(): number { private calculateDocumentsPercentageProgress(): number {
if (!this.props.customer.documents) return 0; if (!this.props.customer.documents) return 0;
const totalDocuments: number = this.props.customer.documents.length; const documents = this.props.customer.documents.filter((document) => document.folder?.uid === this.props.folder.uid);
const totalDocuments: number = documents.length;
const numberDocumentsRefused: number = this.getDocumentsByStatus(EDocumentStatus.REFUSED)?.length || 0; const numberDocumentsRefused: number = this.getDocumentsByStatus(EDocumentStatus.REFUSED)?.length || 0;
const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0; const numberDocumentsAsked: number = this.getDocumentsByStatus(EDocumentStatus.ASKED)?.length || 0;
const depositedDocuments: number = totalDocuments - numberDocumentsAsked - numberDocumentsRefused; const depositedDocuments: number = totalDocuments - numberDocumentsAsked - numberDocumentsRefused;