🎨 fixing build
This commit is contained in:
parent
9000820089
commit
4e4fc97ae5
4
package-lock.json
generated
4
package-lock.json
generated
@ -19,7 +19,7 @@
|
|||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "8.36.0",
|
"eslint": "8.36.0",
|
||||||
"eslint-config-next": "13.2.4",
|
"eslint-config-next": "13.2.4",
|
||||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.27",
|
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35",
|
||||||
"next": "13.2.4",
|
"next": "13.2.4",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
@ -3166,7 +3166,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/le-coffre-resources": {
|
"node_modules/le-coffre-resources": {
|
||||||
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#84a49150d7e6e2856aa7e6f9337d603487b89594",
|
"resolved": "git+ssh://git@github.com/smart-chain-fr/leCoffre-resources.git#5052051e1d3f56b8f895f7132090c77ff7bdd6bc",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"class-transformer": "^0.5.1",
|
"class-transformer": "^0.5.1",
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"eslint": "8.36.0",
|
"eslint": "8.36.0",
|
||||||
"eslint-config-next": "13.2.4",
|
"eslint-config-next": "13.2.4",
|
||||||
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.27",
|
"le-coffre-resources": "git@github.com:smart-chain-fr/leCoffre-resources.git#v2.35",
|
||||||
"next": "13.2.4",
|
"next": "13.2.4",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Customer } from "le-coffre-resources/dist/SuperAdmin";
|
import { Contact, Customer } from "le-coffre-resources/dist/SuperAdmin";
|
||||||
import { Service } from "typedi";
|
import { Service } from "typedi";
|
||||||
|
|
||||||
import BaseSuperAdmin from "../BaseSuperAdmin";
|
import BaseSuperAdmin from "../BaseSuperAdmin";
|
||||||
|
import { ECivility } from "le-coffre-resources/dist/Customer/Contact";
|
||||||
|
|
||||||
// TODO Type get query params -> Where + inclue + orderby
|
// TODO Type get query params -> Where + inclue + orderby
|
||||||
export interface IGetCustomersparams {
|
export interface IGetCustomersparams {
|
||||||
@ -16,6 +17,15 @@ export type IPutCustomersParams = {
|
|||||||
contact?: Customer["contact"];
|
contact?: Customer["contact"];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface IPostCustomersParams {
|
||||||
|
first_name: string;
|
||||||
|
last_name: string;
|
||||||
|
email: string;
|
||||||
|
cell_phone_number: string;
|
||||||
|
civility: ECivility;
|
||||||
|
address?: Contact["address"];
|
||||||
|
}
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export default class Customers extends BaseSuperAdmin {
|
export default class Customers extends BaseSuperAdmin {
|
||||||
private static instance: Customers;
|
private static instance: Customers;
|
||||||
@ -44,6 +54,20 @@ export default class Customers extends BaseSuperAdmin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description : Create a Customer
|
||||||
|
*/
|
||||||
|
public async post(body: any): Promise<Customer> {
|
||||||
|
const url = new URL(this.baseURl);
|
||||||
|
console.log(body);
|
||||||
|
try {
|
||||||
|
return await this.postRequest<Customer>(url, body);
|
||||||
|
} catch (err) {
|
||||||
|
this.onError(err);
|
||||||
|
return Promise.reject(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async getByUid(uid: string, q?: any): Promise<Customer> {
|
public async getByUid(uid: string, q?: any): Promise<Customer> {
|
||||||
const url = new URL(this.baseURl.concat(`/${uid}`));
|
const url = new URL(this.baseURl.concat(`/${uid}`));
|
||||||
const query = { q };
|
const query = { q };
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Service } from "typedi";
|
import { Service } from "typedi";
|
||||||
import User, { DeedType, Office, OfficeFolder } from "le-coffre-resources/dist/Notary";
|
import User, { Customer, DeedType, Office, OfficeFolder } from "le-coffre-resources/dist/Notary";
|
||||||
import BaseSuperAdmin from "../BaseSuperAdmin";
|
import BaseSuperAdmin from "../BaseSuperAdmin";
|
||||||
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
|
import { EFolderStatus } from "le-coffre-resources/dist/Customer/OfficeFolder";
|
||||||
|
|
||||||
@ -39,6 +39,7 @@ export type IPutFoldersParams = {
|
|||||||
archived_description?: OfficeFolder["archived_description"];
|
archived_description?: OfficeFolder["archived_description"];
|
||||||
status?: OfficeFolder["status"];
|
status?: OfficeFolder["status"];
|
||||||
office_folder_has_stakeholder?: OfficeFolder["office_folder_has_stakeholder"];
|
office_folder_has_stakeholder?: OfficeFolder["office_folder_has_stakeholder"];
|
||||||
|
OfficeFolderHasCustomer?: { customer: { uid: Customer["uid"] } }[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
|
@ -65,7 +65,7 @@ class DocumentNotaryClass extends React.Component<IPropsClass, IState> {
|
|||||||
|
|
||||||
private onClick() {
|
private onClick() {
|
||||||
if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return;
|
if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return;
|
||||||
this.props.router.push(`/folders/${this.props.document.folder.uid}/documents/${this.props.document.uid}`);
|
this.props.router.push(`/folders/${this.props.document.folder?.uid}/documents/${this.props.document.uid}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderIcon(): JSX.Element {
|
private renderIcon(): JSX.Element {
|
||||||
|
@ -71,7 +71,7 @@ export default function FolderBoxInformation(props: IProps) {
|
|||||||
</div>
|
</div>
|
||||||
<div className={classes["text-container"]}>
|
<div className={classes["text-container"]}>
|
||||||
<Typography typo={ITypo.NAV_INPUT_16}>Type d'acte</Typography>
|
<Typography typo={ITypo.NAV_INPUT_16}>Type d'acte</Typography>
|
||||||
<Typography typo={ITypo.P_18}>{folder.deed.deed_type.name ?? ""}</Typography>
|
<Typography typo={ITypo.P_18}>{folder.deed?.deed_type?.name ?? ""}</Typography>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes["text-container"]}>
|
<div className={classes["text-container"]}>
|
||||||
<Typography typo={ITypo.NAV_INPUT_16}>Ouverture du dossier</Typography>
|
<Typography typo={ITypo.NAV_INPUT_16}>Ouverture du dossier</Typography>
|
||||||
|
@ -60,9 +60,11 @@ export default class SearchBar extends React.Component<IProps, IState> {
|
|||||||
const value = event.target.value.toLowerCase();
|
const value = event.target.value.toLowerCase();
|
||||||
|
|
||||||
if (folder.office_folder_has_customers) {
|
if (folder.office_folder_has_customers) {
|
||||||
const customerNames = folder.office_folder_has_customers.map((customer) => {
|
const customerNames = folder.office_folder_has_customers
|
||||||
return `${customer.customer.contact.first_name.toLowerCase()} ${customer.customer.contact.last_name.toLowerCase()}`;
|
.map((customer) => {
|
||||||
}).join(", ");
|
return `${customer.customer.contact?.first_name.toLowerCase()} ${customer.customer.contact?.last_name.toLowerCase()}`;
|
||||||
|
})
|
||||||
|
.join(", ");
|
||||||
return name.includes(value) || number.includes(value) || customerNames.includes(value);
|
return name.includes(value) || number.includes(value) || customerNames.includes(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,9 +11,6 @@
|
|||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
|
||||||
width: 100%;
|
|
||||||
|
|
||||||
.radiobox-container {
|
.radiobox-container {
|
||||||
margin: 32px 0;
|
margin: 32px 0;
|
||||||
|
|
||||||
@ -22,6 +19,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
|
||||||
.button-container {
|
.button-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -7,25 +7,32 @@ import { 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";
|
||||||
import { useRouter } from "next/router";
|
import { NextRouter, useRouter } from "next/router";
|
||||||
import { ActionMeta, MultiValue } from "react-select";
|
import { ActionMeta, MultiValue } from "react-select";
|
||||||
|
|
||||||
import BasePage from "../../Base";
|
import BasePage from "../../Base";
|
||||||
import classes from "./classes.module.scss";
|
import classes from "./classes.module.scss";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import Module from "@Front/Config/Module";
|
import Module from "@Front/Config/Module";
|
||||||
|
import { ECivility } from "le-coffre-resources/dist/Customer/Contact";
|
||||||
|
import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders";
|
||||||
|
import Customers from "@Front/Api/LeCoffreApi/SuperAdmin/Customers/Customers";
|
||||||
|
import { Customer } from "le-coffre-resources/dist/Notary";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {};
|
||||||
selectedFolderUid: string;
|
|
||||||
};
|
|
||||||
type IState = {
|
type IState = {
|
||||||
selectedFolder: IDashBoardFolder | null;
|
selectedFolder: IDashBoardFolder | null;
|
||||||
isExistingClientSelected: boolean;
|
isExistingClientSelected: boolean;
|
||||||
isNewClientSelected: boolean;
|
isNewClientSelected: boolean;
|
||||||
hasNewClientSelected: boolean;
|
hasNewClientSelected: boolean;
|
||||||
};
|
};
|
||||||
class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|
||||||
constructor(props: IProps) {
|
type IPropsClass = IProps & {
|
||||||
|
selectedFolderUid: string;
|
||||||
|
router: NextRouter;
|
||||||
|
};
|
||||||
|
class AddClientToFolderClass extends BasePage<IPropsClass, IState> {
|
||||||
|
constructor(props: IPropsClass) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
selectedFolder: null,
|
selectedFolder: null,
|
||||||
@ -37,6 +44,7 @@ class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|||||||
this.onExistingClientSelected = this.onExistingClientSelected.bind(this);
|
this.onExistingClientSelected = this.onExistingClientSelected.bind(this);
|
||||||
this.onNewClientSelected = this.onNewClientSelected.bind(this);
|
this.onNewClientSelected = this.onNewClientSelected.bind(this);
|
||||||
this.onMutiSelectChange = this.onMutiSelectChange.bind(this);
|
this.onMutiSelectChange = this.onMutiSelectChange.bind(this);
|
||||||
|
this.onFormSubmit = this.onFormSubmit.bind(this);
|
||||||
}
|
}
|
||||||
public override render(): JSX.Element {
|
public override render(): JSX.Element {
|
||||||
const selectOptions = [
|
const selectOptions = [
|
||||||
@ -54,7 +62,6 @@ class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|||||||
<BackArrow url={backwardPath} />
|
<BackArrow url={backwardPath} />
|
||||||
</div>
|
</div>
|
||||||
<Typography typo={ITypo.H1Bis}>Associer un ou plusieurs client(s)</Typography>
|
<Typography typo={ITypo.H1Bis}>Associer un ou plusieurs client(s)</Typography>
|
||||||
<Form className={classes["form"]}>
|
|
||||||
<div className={classes["radiobox-container"]}>
|
<div className={classes["radiobox-container"]}>
|
||||||
<RadioBox
|
<RadioBox
|
||||||
name="client"
|
name="client"
|
||||||
@ -72,6 +79,7 @@ class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|||||||
</RadioBox>
|
</RadioBox>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Form className={classes["form"]} onSubmit={this.onFormSubmit}>
|
||||||
{this.state.isExistingClientSelected && (
|
{this.state.isExistingClientSelected && (
|
||||||
<div className={classes["existing-client"]}>
|
<div className={classes["existing-client"]}>
|
||||||
<MultiSelect options={selectOptions} placeholder="Client" onChange={this.onMutiSelectChange} />
|
<MultiSelect options={selectOptions} placeholder="Client" onChange={this.onMutiSelectChange} />
|
||||||
@ -88,10 +96,10 @@ class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|||||||
|
|
||||||
{this.state.isNewClientSelected && (
|
{this.state.isNewClientSelected && (
|
||||||
<div className={classes["new-client"]}>
|
<div className={classes["new-client"]}>
|
||||||
<InputField name="input field" fakeplaceholder="Nom" />
|
<InputField name="last_name" fakeplaceholder="Nom" />
|
||||||
<InputField name="input field" fakeplaceholder="Prénom" />
|
<InputField name="first_name" fakeplaceholder="Prénom" />
|
||||||
<InputField name="input field" fakeplaceholder="E-mail" isEmail />
|
<InputField name="email" fakeplaceholder="E-mail" isEmail />
|
||||||
<InputField name="input field" fakeplaceholder="Numéro de téléphone" numbersOnly maxLength={10} />
|
<InputField name="cell_phone_number" fakeplaceholder="Numéro de téléphone" numbersOnly maxLength={10} />
|
||||||
<div className={classes["button-container"]}>
|
<div className={classes["button-container"]}>
|
||||||
<Link href={backwardPath} className={classes["cancel-button"]}>
|
<Link href={backwardPath} className={classes["cancel-button"]}>
|
||||||
<Button variant={EButtonVariant.GHOST}>Annuler</Button>
|
<Button variant={EButtonVariant.GHOST}>Annuler</Button>
|
||||||
@ -125,11 +133,36 @@ class AddClientToFolderClass extends BasePage<IProps, IState> {
|
|||||||
private onNewClientSelected(): void {
|
private onNewClientSelected(): void {
|
||||||
this.setState({ isExistingClientSelected: false, isNewClientSelected: true });
|
this.setState({ isExistingClientSelected: false, isNewClientSelected: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async onFormSubmit(
|
||||||
|
e: React.FormEvent<HTMLFormElement> | null,
|
||||||
|
values: {
|
||||||
|
[key: string]: any;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
values["civility"] = ECivility.MALE;
|
||||||
|
const customer = {
|
||||||
|
contact: values,
|
||||||
|
};
|
||||||
|
console.log(customer);
|
||||||
|
|
||||||
|
console.log("SELECTD >>>", this.props.selectedFolderUid);
|
||||||
|
const newCustomerCreated: Customer = await Customers.getInstance().post(customer);
|
||||||
|
|
||||||
|
if (newCustomerCreated) {
|
||||||
|
const query = {
|
||||||
|
OfficeFolderHasCustomer: [{ customer: { uid: newCustomerCreated.uid } }],
|
||||||
|
};
|
||||||
|
|
||||||
|
await Folders.getInstance().put(this.props.selectedFolderUid, query);
|
||||||
|
this.props.router.push(`/folders/${this.props.selectedFolderUid}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AddClientToFolder() {
|
export default function AddClientToFolder(props: IProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let { folderUid } = router.query;
|
let { folderUid } = router.query;
|
||||||
folderUid = folderUid as string;
|
folderUid = folderUid as string;
|
||||||
return <AddClientToFolderClass selectedFolderUid={folderUid} />;
|
return <AddClientToFolderClass {...props} selectedFolderUid={folderUid} router={router} />;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"AddClient": {
|
"AddClient": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"props": {
|
"props": {
|
||||||
"path": "/folders/add/clients",
|
"path": "/folders/[folderUid]/add/clients",
|
||||||
"labelKey": "add_client_to_folder"
|
"labelKey": "add_client_to_folder"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"AddClient": {
|
"AddClient": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"props": {
|
"props": {
|
||||||
"path": "/folders/add/clients",
|
"path": "/folders/[folderUid]/add/clients",
|
||||||
"labelKey": "add_client_to_folder"
|
"labelKey": "add_client_to_folder"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"AddClient": {
|
"AddClient": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"props": {
|
"props": {
|
||||||
"path": "/folders/add/clients",
|
"path": "/folders/[folderUid]/add/clients",
|
||||||
"labelKey": "add_client_to_folder"
|
"labelKey": "add_client_to_folder"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
"AddClient": {
|
"AddClient": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"props": {
|
"props": {
|
||||||
"path": "/folders/add/clients",
|
"path": "/folders/[folderUid]/add/clients",
|
||||||
"labelKey": "add_client_to_folder"
|
"labelKey": "add_client_to_folder"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user