fix
This commit is contained in:
parent
b86bdfc34d
commit
6259c983bf
36
package-lock.json
generated
36
package-lock.json
generated
@ -400,9 +400,9 @@
|
|||||||
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="
|
"integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA=="
|
||||||
},
|
},
|
||||||
"node_modules/@mui/base": {
|
"node_modules/@mui/base": {
|
||||||
"version": "5.0.0-alpha.128",
|
"version": "5.0.0-beta.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.128.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-beta.0.tgz",
|
||||||
"integrity": "sha512-wub3wxNN+hUp8hzilMlXX3sZrPo75vsy1cXEQpqdTfIFlE9HprP1jlulFiPg5tfPst2OKmygXr2hhmgvAKRrzQ==",
|
"integrity": "sha512-ap+juKvt8R8n3cBqd/pGtZydQ4v2I/hgJKnvJRGjpSh3RvsvnDHO4rXov8MHQlH6VqpOekwgilFLGxMZjNTucA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.21.0",
|
"@babel/runtime": "^7.21.0",
|
||||||
"@emotion/is-prop-valid": "^1.2.0",
|
"@emotion/is-prop-valid": "^1.2.0",
|
||||||
@ -432,26 +432,26 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/core-downloads-tracker": {
|
"node_modules/@mui/core-downloads-tracker": {
|
||||||
"version": "5.12.3",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.12.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.13.0.tgz",
|
||||||
"integrity": "sha512-yiJZ+knaknPHuRKhRk4L6XiwppwkAahVal3LuYpvBH7GkA2g+D9WLEXOEnNYtVFUggyKf6fWGLGnx0iqzkU5YA==",
|
"integrity": "sha512-5nXz2k8Rv2ZjtQY6kXirJVyn2+ODaQuAJmXSJtLDUQDKWp3PFUj6j3bILqR0JGOs9R5ejgwz3crLKsl6GwjwkQ==",
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
"url": "https://opencollective.com/mui"
|
"url": "https://opencollective.com/mui"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/material": {
|
"node_modules/@mui/material": {
|
||||||
"version": "5.12.3",
|
"version": "5.13.0",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.12.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.13.0.tgz",
|
||||||
"integrity": "sha512-xNmKlrEN4HsTaKFNLZfc7ie7CXx2YqEeO//hsXZx2p3MGtDdeMr2sV3jC4hsFs57RhQlF79weY7uVvC8xSuVbg==",
|
"integrity": "sha512-ckS+9tCpAzpdJdaTF+btF0b6mF9wbXg/EVKtnoAWYi0UKXoXBAVvEUMNpLGA5xdpCdf+A6fPbVUEHs9TsfU+Yw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.21.0",
|
"@babel/runtime": "^7.21.0",
|
||||||
"@mui/base": "5.0.0-alpha.128",
|
"@mui/base": "5.0.0-beta.0",
|
||||||
"@mui/core-downloads-tracker": "^5.12.3",
|
"@mui/core-downloads-tracker": "^5.13.0",
|
||||||
"@mui/system": "^5.12.3",
|
"@mui/system": "^5.12.3",
|
||||||
"@mui/types": "^7.2.4",
|
"@mui/types": "^7.2.4",
|
||||||
"@mui/utils": "^5.12.3",
|
"@mui/utils": "^5.12.3",
|
||||||
"@types/react-transition-group": "^4.4.5",
|
"@types/react-transition-group": "^4.4.6",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"csstype": "^3.1.2",
|
"csstype": "^3.1.2",
|
||||||
"prop-types": "^15.8.1",
|
"prop-types": "^15.8.1",
|
||||||
@ -966,9 +966,9 @@
|
|||||||
"integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ=="
|
"integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/validator": {
|
"node_modules/@types/validator": {
|
||||||
"version": "13.7.16",
|
"version": "13.7.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.16.tgz",
|
"resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.17.tgz",
|
||||||
"integrity": "sha512-VyKmLktUHYLbrSbsRi241MSUlGYomQgK/tfCNpej3Gt5qDOM10AZ3nU2aR2s5JritClXuOBu4K7MkywVW/Y6Ow=="
|
"integrity": "sha512-aqayTNmeWrZcvnG2MG9eGYI6b7S5fl+yKgPs6bAjOTwPS316R5SxBGKvtSExfyoJU7pIeHJfsHI0Ji41RVMkvQ=="
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "5.59.5",
|
"version": "5.59.5",
|
||||||
@ -1707,9 +1707,9 @@
|
|||||||
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
"integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="
|
||||||
},
|
},
|
||||||
"node_modules/enhanced-resolve": {
|
"node_modules/enhanced-resolve": {
|
||||||
"version": "5.13.0",
|
"version": "5.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.0.tgz",
|
||||||
"integrity": "sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg==",
|
"integrity": "sha512-+DCows0XNwLDcUhbFJPdlQEVnT2zXlCv7hPxemTz86/O+B/hCQ+mb7ydkPKiflpVraqLPCAfu7lDy+hBXueojw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
"tapable": "^2.2.0"
|
"tapable": "^2.2.0"
|
||||||
|
@ -70,7 +70,12 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
<div className={classes["form-container"]}>
|
<div className={classes["form-container"]}>
|
||||||
<div className={classes["checkbox-container"]}>
|
<div className={classes["checkbox-container"]}>
|
||||||
{this.state.documentTypes.map((documentType) => (
|
{this.state.documentTypes.map((documentType) => (
|
||||||
<CheckBox name="document_types" toolTip="Checkbox with tooltip" option={documentType} key={documentType.value as string} />
|
<CheckBox
|
||||||
|
name="document_types"
|
||||||
|
toolTip="Checkbox with tooltip"
|
||||||
|
option={documentType}
|
||||||
|
key={documentType.value as string}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className={classes["add-document-container"]}>
|
<div className={classes["add-document-container"]}>
|
||||||
@ -125,45 +130,45 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
this.loadData();
|
this.loadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadData(){
|
private async loadData() {
|
||||||
try{
|
try {
|
||||||
const folder = await Folders.getInstance().getByUid(this.props.folderUid, {
|
const folder = await Folders.getInstance().getByUid(this.props.folderUid, {
|
||||||
q:{
|
q: {
|
||||||
deed: {
|
deed: {
|
||||||
include: {
|
include: {
|
||||||
deed_has_document_types: {
|
deed_has_document_types: {
|
||||||
include: {
|
include: {
|
||||||
document_type: true
|
document_type: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
office: true
|
office: true,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
if(!folder) return;
|
if (!folder) return;
|
||||||
this.setState({
|
this.setState({
|
||||||
folder,
|
folder,
|
||||||
documentTypes: await this.getAvailableDocuments(folder),
|
documentTypes: await this.getAvailableDocuments(folder),
|
||||||
});
|
});
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]>{
|
private async getAvailableDocuments(folder: OfficeFolder): Promise<IOption[]> {
|
||||||
const documentTypes = await Deeds.getInstance().getByUid(folder.deed!.uid!, {
|
const documentTypes = await Deeds.getInstance().getByUid(folder.deed!.uid!, {
|
||||||
q: {
|
q: {
|
||||||
deed_has_document_types: {
|
deed_has_document_types: {
|
||||||
include: {
|
include: {
|
||||||
document_type: true
|
document_type: true,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
|
if (!documentTypes) return [];
|
||||||
|
|
||||||
if(!documentTypes) return [];
|
|
||||||
|
|
||||||
const documentTypesOptions: IOption[] = documentTypes.deed_has_document_types!.map((documentType) => {
|
const documentTypesOptions: IOption[] = documentTypes.deed_has_document_types!.map((documentType) => {
|
||||||
return {
|
return {
|
||||||
label: documentType.document_type!.name!,
|
label: documentType.document_type!.name!,
|
||||||
@ -171,8 +176,7 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return documentTypesOptions
|
return documentTypesOptions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private canAddDocument() {
|
private canAddDocument() {
|
||||||
@ -183,24 +187,24 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async addDocument() {
|
private async addDocument() {
|
||||||
try{
|
try {
|
||||||
const documentType = await DocumentTypes.getInstance().post({
|
const documentType = await DocumentTypes.getInstance().post({
|
||||||
name: this.state.documentName,
|
name: this.state.documentName,
|
||||||
private_description: this.state.visibleDescription,
|
private_description: this.state.visibleDescription,
|
||||||
office: {
|
office: {
|
||||||
uid: this.state.folder?.office!.uid!
|
uid: this.state.folder?.office!.uid!,
|
||||||
},
|
},
|
||||||
public_description: this.state.visibleDescription
|
public_description: this.state.visibleDescription,
|
||||||
})
|
});
|
||||||
|
|
||||||
const oldDocumentsType = this.state.folder?.deed?.deed_has_document_types!;
|
const oldDocumentsType = this.state.folder?.deed?.deed_has_document_types!;
|
||||||
const deed = await Deeds.getInstance().put(this.state.folder?.deed?.uid!,{
|
await Deeds.getInstance().put(this.state.folder?.deed?.uid!, {
|
||||||
deed_has_document_types: [
|
deed_has_document_types: [
|
||||||
...oldDocumentsType,
|
...oldDocumentsType,
|
||||||
{
|
{
|
||||||
document_type: documentType,
|
document_type: documentType,
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.loadData();
|
await this.loadData();
|
||||||
@ -209,7 +213,7 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
documentName: "",
|
documentName: "",
|
||||||
visibleDescription: "",
|
visibleDescription: "",
|
||||||
});
|
});
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,32 +257,36 @@ class AskDocumentsClass extends BasePage<IPropsClass, IState> {
|
|||||||
e: React.FormEvent<HTMLFormElement> | null,
|
e: React.FormEvent<HTMLFormElement> | null,
|
||||||
values: {
|
values: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
try{
|
try {
|
||||||
const documentAsked: [] = values["document_types"] as [];
|
const documentAsked: [] = values["document_types"] as [];
|
||||||
await documentAsked.forEach(async (document) => {
|
await documentAsked.forEach(async (document) => {
|
||||||
await Documents.getInstance().post({
|
await Documents.getInstance().post({
|
||||||
folder: {
|
folder: {
|
||||||
uid: this.props.folderUid
|
uid: this.props.folderUid,
|
||||||
},
|
},
|
||||||
depositor: {
|
depositor: {
|
||||||
uid: this.props.customerUid
|
uid: this.props.customerUid,
|
||||||
},
|
},
|
||||||
document_type: {
|
document_type: {
|
||||||
uid: document
|
uid: document,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.props.router.push(Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid));
|
this.props.router.push(
|
||||||
}catch(e){
|
Module.getInstance()
|
||||||
|
.get()
|
||||||
|
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folderUid),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AskDocuments(props: IProps){
|
export default function AskDocuments(props: IProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
let { folderUid, customerUid } = router.query;
|
let { folderUid, customerUid } = router.query;
|
||||||
folderUid = folderUid as string;
|
folderUid = folderUid as string;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user