✨ Update folder metadatas working
This commit is contained in:
parent
25202a2542
commit
dea4f93915
@ -7,6 +7,13 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1px solid $grey-medium;
|
border: 1px solid $grey-medium;
|
||||||
|
|
||||||
|
&[data-disabled="true"]{
|
||||||
|
.container-label{
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
.container-label {
|
.container-label {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -17,6 +24,8 @@
|
|||||||
padding: 24px;
|
padding: 24px;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
&[data-border-right-collapsed="true"] {
|
&[data-border-right-collapsed="true"] {
|
||||||
border-radius: 8px 0 0 8px;
|
border-radius: 8px 0 0 8px;
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,13 @@ import classes from "./classes.module.scss";
|
|||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
selectedOption?: IOption;
|
selectedOption?: IOption;
|
||||||
onChange: (selectedOption: IOption) => void;
|
onChange?: (selectedOption: IOption) => void;
|
||||||
options: IOption[];
|
options: IOption[];
|
||||||
hasBorderRightCollapsed?: boolean;
|
hasBorderRightCollapsed?: boolean;
|
||||||
placeholder?: string;
|
placeholder?: string;
|
||||||
className?: string;
|
className?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
|
disabled: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type IOption = {
|
export type IOption = {
|
||||||
@ -35,6 +36,10 @@ export default class Select extends React.Component<IProps, IState> {
|
|||||||
private rootRef = React.createRef<HTMLDivElement>();
|
private rootRef = React.createRef<HTMLDivElement>();
|
||||||
private removeOnresize = () => {};
|
private removeOnresize = () => {};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
disabled: false,
|
||||||
|
};
|
||||||
|
|
||||||
constructor(props: IProps) {
|
constructor(props: IProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
@ -50,7 +55,10 @@ export default class Select extends React.Component<IProps, IState> {
|
|||||||
public override render(): JSX.Element {
|
public override render(): JSX.Element {
|
||||||
const selectedOption = this.state.selectedOption ?? this.props.selectedOption;
|
const selectedOption = this.state.selectedOption ?? this.props.selectedOption;
|
||||||
return (
|
return (
|
||||||
<div className={classNames(classes["root"], this.props.className)} ref={this.rootRef}>
|
<div
|
||||||
|
className={classNames(classes["root"], this.props.className)}
|
||||||
|
ref={this.rootRef}
|
||||||
|
data-disabled={this.props.disabled.toString()}>
|
||||||
{selectedOption && <input type="text" defaultValue={selectedOption.value as string} name={this.props.name} hidden />}
|
{selectedOption && <input type="text" defaultValue={selectedOption.value as string} name={this.props.name} hidden />}
|
||||||
<label
|
<label
|
||||||
className={classNames(classes["container-label"])}
|
className={classNames(classes["container-label"])}
|
||||||
@ -126,6 +134,7 @@ export default class Select extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private toggle(e: FormEvent) {
|
private toggle(e: FormEvent) {
|
||||||
|
if (this.props.disabled) return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let listHeight = 0;
|
let listHeight = 0;
|
||||||
let listWidth = this.rootRef.current?.scrollWidth ?? 0;
|
let listWidth = this.rootRef.current?.scrollWidth ?? 0;
|
||||||
@ -140,6 +149,7 @@ export default class Select extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private onSelect(option: IOption, e: React.MouseEvent<HTMLLIElement, MouseEvent>) {
|
private onSelect(option: IOption, e: React.MouseEvent<HTMLLIElement, MouseEvent>) {
|
||||||
|
if (this.props.disabled) return;
|
||||||
this.props.onChange && this.props.onChange(option);
|
this.props.onChange && this.props.onChange(option);
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedOption: option,
|
selectedOption: option,
|
||||||
|
@ -4,6 +4,7 @@ import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
|||||||
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button";
|
||||||
import Form from "@Front/Components/DesignSystem/Form";
|
import Form from "@Front/Components/DesignSystem/Form";
|
||||||
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
|
import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField";
|
||||||
|
import Select, { IOption } from "@Front/Components/DesignSystem/Select";
|
||||||
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography";
|
||||||
import BackArrow from "@Front/Components/Elements/BackArrow";
|
import BackArrow from "@Front/Components/Elements/BackArrow";
|
||||||
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard";
|
||||||
@ -39,6 +40,11 @@ class UpdateFolderMetadataClass extends BasePage<IPropsClass, IState> {
|
|||||||
const backwardPath = Module.getInstance()
|
const backwardPath = Module.getInstance()
|
||||||
.get()
|
.get()
|
||||||
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.state.selectedFolder?.uid!);
|
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.state.selectedFolder?.uid!);
|
||||||
|
const deedOption = {
|
||||||
|
label: this.state.selectedFolder?.deed?.deed_type?.name,
|
||||||
|
value: this.state.selectedFolder?.deed?.deed_type?.uid,
|
||||||
|
} as IOption;
|
||||||
|
const openingDate = new Date(this.state.selectedFolder?.created_at ?? "");
|
||||||
return (
|
return (
|
||||||
<DefaultNotaryDashboard title={"Ajouter client(s)"} onSelectedFolder={this.onSelectedFolder}>
|
<DefaultNotaryDashboard title={"Ajouter client(s)"} onSelectedFolder={this.onSelectedFolder}>
|
||||||
<div className={classes["root"]}>
|
<div className={classes["root"]}>
|
||||||
@ -55,6 +61,12 @@ class UpdateFolderMetadataClass extends BasePage<IPropsClass, IState> {
|
|||||||
fakeplaceholder="Numéro de dossier"
|
fakeplaceholder="Numéro de dossier"
|
||||||
defaultValue={this.state.selectedFolder?.folder_number}
|
defaultValue={this.state.selectedFolder?.folder_number}
|
||||||
/>
|
/>
|
||||||
|
<Select options={[]} placeholder={"Type d'acte"} selectedOption={deedOption} disabled />
|
||||||
|
<InputField
|
||||||
|
fakeplaceholder="Ouverture du dossier"
|
||||||
|
defaultValue={openingDate.toLocaleDateString("fr-FR")}
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={classes["button-container"]}>
|
<div className={classes["button-container"]}>
|
||||||
@ -73,21 +85,23 @@ class UpdateFolderMetadataClass extends BasePage<IPropsClass, IState> {
|
|||||||
const folder = await this.getFolder();
|
const folder = await this.getFolder();
|
||||||
this.setState({
|
this.setState({
|
||||||
selectedFolder: folder,
|
selectedFolder: folder,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async onFormSubmit(
|
private async onFormSubmit(
|
||||||
e: React.FormEvent<HTMLFormElement> | null,
|
e: React.FormEvent<HTMLFormElement> | null,
|
||||||
values: {
|
values: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
await Folders.getInstance().put(this.props.folderUid, values);
|
await Folders.getInstance().put(this.props.folderUid, values);
|
||||||
const url = Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid);
|
const url = Module.getInstance()
|
||||||
|
.get()
|
||||||
|
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid);
|
||||||
this.props.router.push(url);
|
this.props.router.push(url);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user