Commit be5008e0 authored by devendra's avatar devendra
Browse files

Feat: Delete Form feature

1 merge request!12Delete form
This commit is part of merge request !12. Comments created here will be created in the context of that merge request.
Showing with 32 additions and 38 deletions
+32 -38
...@@ -67,24 +67,7 @@ class ListForms extends Component { ...@@ -67,24 +67,7 @@ class ListForms extends Component {
} else { } else {
formData.status = LANG.FORM_STATUS.UNPUBLISH; formData.status = LANG.FORM_STATUS.UNPUBLISH;
} }
FormService.add(formData).then( this.saveFormDetails(formData, false);
(response) => {
if (response.statusInfo.statusCode === APP.CODE.SUCCESS) {
Notify.success(response.statusInfo.statusMessage);
// this.props.updateParent(response.responseData.id);
setTimeout(() => {
this.getAllForms();
}, 500);
} else {
Notify.error(response.statusInfo.errorMessage);
}
},
(error) => {
error.statusInfo
? Notify.error(error.statusInfo.errorMessage)
: Notify.error(error.message);
}
);
}; };
searchForms = (event) => { searchForms = (event) => {
...@@ -111,25 +94,35 @@ class ListForms extends Component { ...@@ -111,25 +94,35 @@ class ListForms extends Component {
// }; // };
deleteForm = () => { deleteForm = () => {
this.setState({showConfirmModal: false}); const formData = {...this.state.formToDelete, status: LANG.FORM_STATUS.DELETED}
// FormService.deleteForm(formToDelete?.id).then( saveFormDetails(formData, true);
// (response) => { }
// if (response.statusInfo && response.statusInfo.statusCode === APP.CODE.SUCCESS) {
// console.log(response.responseData);
// Notify.success('Form deleted successfully!'); saveFormDetails = (formData, isDelete) => {
// getAllForms(); FormService.add(formData).then(
// } else { (response) => {
// Notify.error(response.statusInfo.errorMessage); if (response.statusInfo.statusCode === APP.CODE.SUCCESS) {
// } if(isDelete) {
// this.setState({showConfirmModal: false}); this.setState({showConfirmModal: false});
// }, Notify.success("Form deleted successfully")
// (error) => { }else {
// error.statusInfo Notify.success(response.statusInfo.statusMessage);
// ? Notify.error(error.statusInfo.errorMessage) }
// : Notify.error(error.message); // this.props.updateParent(response.responseData.id);
// this.setState({showConfirmModal: false}); setTimeout(() => {
// } this.getAllForms();
// ); }, 500);
} else {
Notify.error(response.statusInfo.errorMessage);
}
},
(error) => {
error.statusInfo
? Notify.error(error.statusInfo.errorMessage)
: Notify.error(error.message);
}
);
} }
render() { render() {
......
...@@ -28,7 +28,8 @@ export const LANG = { ...@@ -28,7 +28,8 @@ export const LANG = {
APPROVED: "APPROVED", APPROVED: "APPROVED",
REJECTED: "REJECTED", REJECTED: "REJECTED",
LEAD_INSPECTION_COMPLETED: "LEADINSCOMPLETED", LEAD_INSPECTION_COMPLETED: "LEADINSCOMPLETED",
ASSISTING_INSPECTION_COMPLETED: "INSCOMPLETED" ASSISTING_INSPECTION_COMPLETED: "INSCOMPLETED",
DELETED: "DELETED"
}, },
COL: { COL: {
1: 1, 1: 1,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment