diff --git a/client/package.json b/client/package.json index 95e136a..fe756d3 100644 --- a/client/package.json +++ b/client/package.json @@ -51,6 +51,7 @@ "redux-thunk": "^2.3.0", "semantic-ui-react": "^0.86.0", "styled-components": "^4.2.0", + "sweetalert": "^2.1.2", "validator": "^10.11.0" }, "scripts": { diff --git a/client/src/App.js b/client/src/App.js index f564e48..14048b2 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -42,6 +42,7 @@ import AttributeArray from './components/pages/AttributeArray'; import InProgressInvestorCases from './components/pages/inProgressInvestorCases'; import EditInvCompany from './components/pages/EditInvCompany'; import EditLawyerCompany from './components/pages/editLawyerForms'; +// import.meta; class App extends Component { constructor() { super(); diff --git a/client/src/actions/authentication.js b/client/src/actions/authentication.js index 6a6ed51..51afe5e 100644 --- a/client/src/actions/authentication.js +++ b/client/src/actions/authentication.js @@ -3,6 +3,8 @@ import axios from 'axios'; import { GET_ERRORS, SET_CURRENT_USER } from './types'; import setAuthToken from '../setAuthToken'; import jwt_decode from 'jwt-decode'; +import swal from 'sweetalert'; + export const registerUser = (user) => (dispatch) => { axios @@ -10,10 +12,11 @@ export const registerUser = (user) => (dispatch) => { //.then(res => history.push('/login')) //.catch(err => console.log(err)) .then(function(response) { - alert("You have registered successfully. Congratulations :)! ") + swal("You have registered successfully. Congratulations :)! ") + }) .catch((err) => { - alert(err.response.data.error|| err.response.data); + swal(err.response.data.error|| err.response.data); console.log(err.response); }); @@ -29,7 +32,7 @@ export const registerLR = (user) => (dispatch) => { .then(res => { alert('the account has been created') }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); } if (user.userType === 'Reviewer') { @@ -41,7 +44,7 @@ export const registerLR = (user) => (dispatch) => { alert('the account has been created') }) .catch((err) => { - alert(err.response.data.errmsg || err.response.data); + swal(err.response.data.errmsg || err.response.data); console.log(err.response); }); } @@ -78,7 +81,9 @@ export const loginUser = (user) => (dispatch) => { (err) => { console.log(err); localStorage.setItem('isLoggedIn', false); - alert('Wrong email or password'); + swal("Wrong Email or Password!"); + + // alert('wrong password'); return err; } // { diff --git a/client/src/components/pages/AddCommentsLawyer.js b/client/src/components/pages/AddCommentsLawyer.js index 3dab58c..f880148 100644 --- a/client/src/components/pages/AddCommentsLawyer.js +++ b/client/src/components/pages/AddCommentsLawyer.js @@ -6,8 +6,8 @@ import '../../App.css'; import GetAllUserForms from '../form/GetAllUserForms' import { black } from 'material-ui/styles/colors'; import { blue200 } from 'material-ui/styles/colors'; -const mongoose = require('mongoose') - +import swal from 'sweetalert'; +const mongoose = require('mongoose'); class AddCommentsLawyer extends Component{ @@ -104,7 +104,7 @@ class AddCommentsLawyer extends Component{ variant="omar" value="Add Comment" style={{width: "110px",backgroundColor:"#a3dbff",color:black}} - onClick={() => (this.handleClick(this.props.formId), alert('Comments added Succesfully'))} + onClick={() => (this.handleClick(this.props.formId), swal('Comments added Succesfully'))} disabled={!this.validateForm()} >Comment diff --git a/client/src/components/pages/AddCommentsReviewer.js b/client/src/components/pages/AddCommentsReviewer.js index b6d4fa5..2745ae9 100644 --- a/client/src/components/pages/AddCommentsReviewer.js +++ b/client/src/components/pages/AddCommentsReviewer.js @@ -5,7 +5,8 @@ import { Modal } from 'react-bootstrap'; import '../../App.css'; import { black } from 'material-ui/styles/colors'; import { blue200 } from 'material-ui/styles/colors'; -const mongoose = require('mongoose') +import swal from 'sweetalert'; +const mongoose = require('mongoose'); @@ -71,7 +72,7 @@ class AddCommentsReviewer extends Component{ }; handleEvent = () => { - alert("I was clicked"); + swal("I was clicked"); }; @@ -109,7 +110,7 @@ class AddCommentsReviewer extends Component{ value="Comment" style={{width: "110px",backgroundColor:"#a3dbff",color:black}} disabled={!this.validateForm()} - onClick={() => (this.handleClick(this.props.formId) , alert('Comments added Succesfully'))} + onClick={() => (this.handleClick(this.props.formId) , swal('Comments added Succesfully'))} >Comment diff --git a/client/src/components/pages/ApprovedCompanies.js b/client/src/components/pages/ApprovedCompanies.js index ffcde66..b61d5b0 100644 --- a/client/src/components/pages/ApprovedCompanies.js +++ b/client/src/components/pages/ApprovedCompanies.js @@ -1,7 +1,6 @@ import React, { Component } from 'react'; import axios from 'axios'; import '../../App.css'; -// import ApprovedCompaniesFields from '../user/ApprovedCompaniesFields'; import Table from 'react-bootstrap/Table' import Navbar from 'react-bootstrap/Navbar' import {Badge} from 'react-bootstrap' @@ -33,12 +32,6 @@ class ApprovedCompanies extends Component { } }) } - // tabRow(){ - // return ( - // this.state.approvedCompanies.map(function(approvedCompany,i){ - // return }) - // ) - // } printDocument() { const input = document.getElementById('divToPrint'); diff --git a/client/src/components/pages/AttributeArray.js b/client/src/components/pages/AttributeArray.js index 8657c02..9780c60 100644 --- a/client/src/components/pages/AttributeArray.js +++ b/client/src/components/pages/AttributeArray.js @@ -5,6 +5,7 @@ import axios from 'axios'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import AppBar from 'material-ui/AppBar'; import RaisedButton from 'material-ui/RaisedButton'; +import swal from 'sweetalert'; import TextField from 'material-ui/TextField'; import { MDBRow, @@ -244,10 +245,10 @@ class AttributeArray extends Component { axios .put(apiBaseUrl, payload2, { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then(function(response) { - alert('The SSC Manager has been created successfully'); + swal('The SSC Manager has been created successfully'); }) .catch((error) => { - alert(error.response.data.error.details['0'].message||error.response.data.msg || error.response.data.error || error.response.data); + swal(error.response.data.error.details['0'].message||error.response.data.msg || error.response.data.error || error.response.data); console.log(error); }); }; diff --git a/client/src/components/pages/ChangePassword.js b/client/src/components/pages/ChangePassword.js index 25531e7..6dec3a8 100644 --- a/client/src/components/pages/ChangePassword.js +++ b/client/src/components/pages/ChangePassword.js @@ -10,6 +10,7 @@ import { MDBRow, MDBCol, MDBInput, MDBBtn } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; import trans from '../translations/changePasswordTranslation' +import swal from 'sweetalert'; var mongoose = require('mongoose'); class ChangePassword extends React.Component { @@ -34,10 +35,10 @@ class ChangePassword extends React.Component { .then(function(response) { console.log(response); if (response.data.code === 200) { - alert('Password updated Succesfully'); + swal('Password updated Succesfully'); } }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); } changeHandler = (event) => { @@ -108,7 +109,7 @@ class ChangePassword extends React.Component { style={style} disabled={!this.validatePassword()} onClick={(event) => ( - this.handleClick(event), alert('Password updated Successfully') + this.handleClick(event), swal('Password updated Successfully') )} /> diff --git a/client/src/components/pages/CreateANewCompany.js b/client/src/components/pages/CreateANewCompany.js index 1b59a1e..e977729 100644 --- a/client/src/components/pages/CreateANewCompany.js +++ b/client/src/components/pages/CreateANewCompany.js @@ -6,6 +6,7 @@ import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import AppBar from 'material-ui/AppBar'; import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; +import swal from 'sweetalert'; import { MDBRow, MDBCol, @@ -315,13 +316,13 @@ class CreateANewCompany extends Component { axios .post(apiBaseUrl, payload2, { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then(function(response) { - alert('The Form has been created successfully'); + swal('The Form has been created successfully'); }) .catch((error) => { //console.log(error.response.data.error.details['0'].message) // alert(error.response.data.error.details['0'].message) - alert(error.response.data.error.details['0'].message || error.response.data.error || error.response.data.errmsg||error.response.data); + alert(error.response.data.error.details['0'].message || error.response.data.error || error.response.data.errmsg||error.response.data); //console.log(error); }); }; diff --git a/client/src/components/pages/EditInvCompany.js b/client/src/components/pages/EditInvCompany.js index 2be156e..08de0bc 100644 --- a/client/src/components/pages/EditInvCompany.js +++ b/client/src/components/pages/EditInvCompany.js @@ -16,6 +16,8 @@ import DropdownItem from 'react-bootstrap/DropdownItem'; import Footer from "../layout/footer" import { Button } from "react-bootstrap" import { conditionalExpression } from '@babel/types'; +import { CommunicationSwapCalls } from 'material-ui/svg-icons'; +import swal from 'sweetalert'; var mongoose = require('mongoose') @@ -273,6 +275,7 @@ class EditInvCompany extends Component { handleClick = (error) => { error.preventDefault(); console.log("hey") + swal('Form editted successfully') // console.log(this.state.certainFormType) const keys = this.state.certainFormType["0"] //const keys = Object.keys(this.state.certainFormType) @@ -307,7 +310,7 @@ class EditInvCompany extends Component { axios.put(apiBaseUrl, payload2, { headers: { "Authorization": localStorage.getItem('jwtToken') } }) .then(function (response) { - alert('The Form has been updated successfully'); + CommunicationSwapCalls('The Form has been updated successfully'); }) .catch((error) => { diff --git a/client/src/components/pages/EditProfile.js b/client/src/components/pages/EditProfile.js index dc9d6ce..de8cea0 100644 --- a/client/src/components/pages/EditProfile.js +++ b/client/src/components/pages/EditProfile.js @@ -10,6 +10,7 @@ import { MDBRow, MDBCol, MDBInput, MDBBtn, MDBSelect } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; import trans from '../translations/editProfileTranslation' +import swal from 'sweetalert'; var mongoose = require('mongoose'); class EditProfile extends React.Component { @@ -80,10 +81,10 @@ class EditProfile extends React.Component { axios .put(apiBaseUrl, payload, { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then(function(response) { - alert('The profile has been updated successfully'); + swal('The profile has been updated successfully'); }) .catch((error) => { - alert(error.response.data.errmsg || error.response.data); + swal(error.response.data.errmsg || error.response.data); console.log(error); }); } diff --git a/client/src/components/pages/EditSPCForm.js b/client/src/components/pages/EditSPCForm.js index bb2b5e9..9bf9deb 100644 --- a/client/src/components/pages/EditSPCForm.js +++ b/client/src/components/pages/EditSPCForm.js @@ -9,6 +9,7 @@ import TextField from 'material-ui/TextField'; import { MDBRow, MDBCol, MDBInput, MDBBtn } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; +import swal from 'sweetalert'; var mongoose = require('mongoose'); class EditSPCForm extends React.Component { @@ -49,7 +50,7 @@ class EditSPCForm extends React.Component { equityCapital: response.data.data.equityCapital }); }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); axios.get('/routes/api/governorates/').then((res) => { this.setState({ governorate: res.data.data }); }); @@ -72,10 +73,10 @@ class EditSPCForm extends React.Component { axios .put(apiBaseUrl, payload, { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then(function(response) { - alert('The SPC form has been updated successfully'); + swal('The SPC form has been updated successfully'); }) .catch((error) => { - alert(error.response.data.errmsg || error.response.data); + swal(error.response.data.errmsg || error.response.data); console.log(error); }); } diff --git a/client/src/components/pages/EditUnassigned.js b/client/src/components/pages/EditUnassigned.js index 16bacfb..d37af3e 100644 --- a/client/src/components/pages/EditUnassigned.js +++ b/client/src/components/pages/EditUnassigned.js @@ -9,6 +9,7 @@ import TextField from 'material-ui/TextField'; import { MDBRow, MDBCol, MDBInput, MDBBtn } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; +import swal from 'sweetalert'; var mongoose = require('mongoose'); class EditUnassigned extends React.Component { @@ -74,10 +75,10 @@ class EditUnassigned extends React.Component { .put(apiBaseUrl, payload, { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then(function(response) { console.log(response); - alert('The SPC form has been updated successfully'); + swal('The SPC form has been updated successfully'); }) .catch((error) => { - alert(error.response.data.errmsg || error.response.data); + swal(error.response.data.errmsg || error.response.data); console.log(error); }); } diff --git a/client/src/components/pages/GetCaseReviewer.js b/client/src/components/pages/GetCaseReviewer.js index 68f415a..c2d971c 100644 --- a/client/src/components/pages/GetCaseReviewer.js +++ b/client/src/components/pages/GetCaseReviewer.js @@ -4,13 +4,12 @@ import "../../App.css"; import { Button, Container ,ButtonGroup,ButtonToolbar,Card} from "react-bootstrap"; import "mdbreact/dist/css/mdb.css"; import { MDBProgress } from 'mdbreact' -import AddCommentsReviewer from '../pages/AddCommentsReviewer' -import CardReviewer from "../form/CardReviewer"; -import GetAllReviewerForms from "../form/GetAllReviewerForms"; +import AddCommentsReviewer from '../pages/AddCommentsReviewer'; import { Dropdown } from "react-bootstrap"; import { blue200 } from "material-ui/styles/colors"; -import trans from '../translations/getReviewerTranslation' -const mongoose = require('mongoose') +import trans from '../translations/getReviewerTranslation'; +import swal from'sweetalert'; +const mongoose = require('mongoose'); var $ = require("jquery")(window); class Companies extends Component { @@ -32,26 +31,6 @@ class Companies extends Component { } }); } - - // accept = (formId) => { - // console.log("hi"); - // axios.defaults.headers.common["Authorization"] = localStorage.getItem( - // "jwtToken" - // ); - // axios - // .put( - // "/routes/api/userDynamicForms/accept/" + - // mongoose.Types.ObjectId(formId), - // { headers: { Authorization: localStorage.getItem("jwtToken") } }) - // .then((res) => { - // alert("The form was accepted succesfully"); - // document.location.href = '/GetReviewer'; - // }) - // .catch((err)=>{ - // alert(err.response.data.msg|| err.response.data); - // console.log(err.response); - // }) - // }; accept = (formId) => { axios.defaults.headers.common['Authorization'] = localStorage.getItem('jwtToken'); axios @@ -62,7 +41,8 @@ class Companies extends Component { console.log("hello") }) .catch((err)=>{ - alert(err.response.data.msg|| err.response.data); + swal(err.response.data.msg|| err.response.data); + console.log(err.response); }) }; @@ -98,44 +78,13 @@ class Companies extends Component { ) .then(res => { this.setState({ companies: res.data.data }); - alert("Cases have been sorted"); - document.location.href = "/GetReviewer"; + swal("Cases have been sorted"); + setTimeout("document.location.href = '/GetReviewer';",3500); }) .catch(err => { console.log(err); }); }; - // sortByCreationDate = () => { - // axios.defaults.headers.common["Authorization"] = localStorage.getItem( - // "jwtToken" - // ); - // axios - // .get( - // "/routes/api/userDynamicForms/SpecificformsSortedByformDate", - // { headers: { Authorization: localStorage.getItem("jwtToken") } } - // ) - // .then(res => { - // this.setState({ companies: res.data.data }); - // alert("Cases have been sorted"); - // document.location.href = "/GetReviewer"; - // }) - // .catch(err => { - // console.log(err); - // }); - // }; - // sort = () => { - // axios.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('jwtToken'); - // axios - // .get('/routes/api/users/SpecificFormSortedByFormId', { - // headers: { Authorization: localStorage.getItem('jwtToken') } - // }) - // .then((res) => { - // this.setState({ forms: res.data.data }); - // alert('Cases have been sorted'); - // document.location.href = "/GetReviewer"; - // }) - // .catch((err) => alert(err.response.data.errmsg || err.response.data)); - // }; sortByCreationDate = () => { axios.defaults.headers.common['Authorization'] = localStorage.getItem('jwtToken'); axios @@ -144,16 +93,11 @@ class Companies extends Component { }) .then((res) => { this.setState({ companies: res.data.data }); - alert('Cases have been sorted'); - document.location.href = "/GetReviewer"; + swal('Cases have been sorted'); + setTimeout("document.location.href = '/GetReviewer';",3500); }) .catch((err) => alert(err.response.data.errmsg || err.response.data)); }; - // tabRow = () => { - // return this.state.companies.map((company, i) => { - // return ; - // }); - // }; getAttributes = () => { let modalClose = () => this.setState({ modalShow: false }); return this.state.companies.map((Form, index) => { diff --git a/client/src/components/pages/Login.js b/client/src/components/pages/Login.js index 261967d..d00c70a 100644 --- a/client/src/components/pages/Login.js +++ b/client/src/components/pages/Login.js @@ -9,7 +9,6 @@ import { MDBInput } from 'mdbreact'; import { InputAdornment, withStyles } from '@material-ui/core'; import TextField from '@material-ui/core/TextField'; import { RemoveRedEye } from '@material-ui/icons'; - const styles = (theme) => ({ eye: { cursor: 'pointer' @@ -134,7 +133,7 @@ class Login extends Component { this.state.email.match(/^([\w.%+-]+)@([\w-]+\.)+([\w]{2,})$/i) ? ( 'is-valid' ) : ( - 'is-invalid' + 'is-invalid' ) } id="Form-email1" diff --git a/client/src/components/pages/SPCform.js b/client/src/components/pages/SPCform.js index c7f9b7f..5586628 100644 --- a/client/src/components/pages/SPCform.js +++ b/client/src/components/pages/SPCform.js @@ -6,6 +6,7 @@ import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import AppBar from 'material-ui/AppBar'; import RaisedButton from 'material-ui/RaisedButton'; import TextField from 'material-ui/TextField'; +import swal from 'sweetalert'; import { MDBRow, MDBCol, @@ -92,11 +93,11 @@ class SPCform extends Component{ .then(function (response) { console.log(response); - alert('SPCForm Created Successfully') ; + swal('SPCForm Created Successfully') ; }) .catch((error)=> { - alert(error.response.data.errmsg||error.response.data); + swal(error.response.data.errmsg||error.response.data); console.log(error.response) }); } diff --git a/client/src/components/pages/SSCForm.js b/client/src/components/pages/SSCForm.js index 38edaef..1ed4325 100644 --- a/client/src/components/pages/SSCForm.js +++ b/client/src/components/pages/SSCForm.js @@ -10,6 +10,7 @@ import { MDBRow, MDBCol, MDBInput, MDBBtn } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; import trans from '../translations/sscTranslation'; +import swal from 'sweetalert'; var mongoose = require('mongoose'); class SSCForm extends React.Component { @@ -120,10 +121,10 @@ class SSCForm extends React.Component { .then(function(response) { console.log(response); if (response.data.code === 200) { - alert('SSCForm Created Succesfully'); + swal('SSCForm Created Succesfully'); } }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); } changeHandler = (event) => { @@ -575,7 +576,7 @@ class SSCForm extends React.Component { primary={true} style={style} disabled={!this.validateForm()} - onClick={(event) => (this.handleClick(event), alert('SSCForm Created Succesfully'))} + onClick={(event) => (this.handleClick(event), swal('SSCForm Created Succesfully'))} /> diff --git a/client/src/components/pages/SortSpecificUserCase.js b/client/src/components/pages/SortSpecificUserCase.js index c046581..68cc380 100644 --- a/client/src/components/pages/SortSpecificUserCase.js +++ b/client/src/components/pages/SortSpecificUserCase.js @@ -4,6 +4,7 @@ import GetSpecificUserCase from '../form/GetSpecificUserCase'; import Table from 'react-bootstrap/Table'; import { Button } from 'react-bootstrap'; import 'mdbreact/dist/css/mdb.css'; +import swal from 'sweetalert'; export default class SortSpecificUserCase extends React.Component { constructor(props) { @@ -20,9 +21,9 @@ export default class SortSpecificUserCase extends React.Component { }) .then((res) => { this.setState({ forms: res.data.data }); - alert('Cases have been sorted'); + swal('Cases have been sorted'); }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); }; tabRow() { diff --git a/client/src/components/pages/UpdateSSCForm.js b/client/src/components/pages/UpdateSSCForm.js index 3c3d954..2c59d60 100644 --- a/client/src/components/pages/UpdateSSCForm.js +++ b/client/src/components/pages/UpdateSSCForm.js @@ -9,6 +9,7 @@ import TextField from 'material-ui/TextField'; import { MDBRow, MDBCol, MDBInput, MDBBtn } from 'mdbreact'; import DropDownMenu from 'material-ui/DropDownMenu'; import MenuItem from 'material-ui/MenuItem'; +import swal from 'sweetalert'; var mongoose = require('mongoose'); class UpdateSSCForm extends React.Component { @@ -61,7 +62,7 @@ class UpdateSSCForm extends React.Component { reviewerComments: response.data.data.reviewerComments }); }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); axios.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('jwtToken'); axios .get('/routes/api/forms/getSpecificform/' + mongoose.Types.ObjectId(this.props.formId._id), { @@ -88,7 +89,7 @@ class UpdateSSCForm extends React.Component { SSCManagers: test }); }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); } changeHandler2 = (event) => { @@ -122,10 +123,10 @@ class UpdateSSCForm extends React.Component { .then(function(response) { console.log(response); if (response.data.code === 200) { - alert('SSCForm Updated Succesfully'); + swal('SSCForm Updated Succesfully'); } }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); } changeHandler = (event) => { @@ -560,7 +561,7 @@ class UpdateSSCForm extends React.Component { label="Submit" primary={true} style={style} - onClick={(event) => (this.handleClick(event), alert('SSCForm Updated Succesfully'))} + onClick={(event) => (this.handleClick(event), swal('SSCForm Updated Succesfully'))} /> diff --git a/client/src/components/pages/adminPage.js b/client/src/components/pages/adminPage.js index f3b3c2a..b9913c0 100644 --- a/client/src/components/pages/adminPage.js +++ b/client/src/components/pages/adminPage.js @@ -12,6 +12,7 @@ import { Button, Container, ButtonGroup, ButtonToolbar } from 'react-bootstrap'; import axios from 'axios'; import { blue200,black } from 'material-ui/styles/colors'; + class adminPage extends Component { constructor(props) { super(props); diff --git a/client/src/components/pages/assignToReviewer.js b/client/src/components/pages/assignToReviewer.js index 50edbc4..5ca3647 100644 --- a/client/src/components/pages/assignToReviewer.js +++ b/client/src/components/pages/assignToReviewer.js @@ -5,6 +5,7 @@ import 'mdbreact/dist/css/mdb.css'; import { Button } from 'react-bootstrap'; import Flippy, { FrontSide, BackSide } from 'react-flippy'; import trans from '../translations/unassignedRevTranslation'; +import swal from 'sweetalert'; const Mongoose = require('mongoose'); class assignToReviewer extends Component { state = { @@ -29,8 +30,9 @@ class assignToReviewer extends Component { }) .then((res) => { //document.getElementById('Flip').flipOnClick = false; - alert('This Case is assigned to YOU!!'); - document.location.href = '/lawyerAcceptedForms'; + swal('This Case is assigned to YOU!!'); + setTimeout("document.location.href = '/lawyerAcceptedForms';",3500); + // document.location.href = '/lawyerAcceptedForms'; }) .catch((err) => console.log(err)); // document.location.href='/AssignToReviewer' diff --git a/client/src/components/pages/editLawyerForms.js b/client/src/components/pages/editLawyerForms.js index 2dac413..62ae4ee 100644 --- a/client/src/components/pages/editLawyerForms.js +++ b/client/src/components/pages/editLawyerForms.js @@ -16,6 +16,7 @@ import DropdownItem from 'react-bootstrap/DropdownItem'; import Footer from "../layout/footer" import { Button } from "react-bootstrap" import { conditionalExpression } from '@babel/types'; +import swal from 'sweetalert'; var mongoose = require('mongoose') @@ -307,7 +308,7 @@ class editLawyerForms extends Component { axios.put(apiBaseUrl, payload2, { headers: { "Authorization": localStorage.getItem('jwtToken') } }) .then(function (response) { - alert('The Form has been updated successfully'); + swal('The Form has been updated successfully'); }) .catch((error) => { diff --git a/client/src/components/pages/getCaseLawyer.js b/client/src/components/pages/getCaseLawyer.js index 72d4287..c76cdb6 100644 --- a/client/src/components/pages/getCaseLawyer.js +++ b/client/src/components/pages/getCaseLawyer.js @@ -1,16 +1,15 @@ import React, { Component } from 'react'; import axios from 'axios'; import '../../App.css'; -import Table from 'react-bootstrap/Table'; import { Button, Container, ButtonGroup, ButtonToolbar } from 'react-bootstrap'; import 'mdbreact/dist/css/mdb.css'; import AddCommentsLawyer from './AddCommentsLawyer'; import Cardd from '../form/Card'; -import GetAllUserForms from '../form/GetAllUserForms'; import { Dropdown, Card } from 'react-bootstrap'; import { MDBProgress } from 'mdbreact'; import { blue200 } from 'material-ui/styles/colors'; -import trans from '../translations/getCaseLawyerTranslation' +import trans from '../translations/getCaseLawyerTranslation'; +import swal from 'sweetalert'; const mongoose = require('mongoose'); var $ = require('jquery')(window); @@ -45,7 +44,7 @@ class Companies extends Component { console.log(this.state.companies); }) .catch((err) => { - alert('' + err); + swal('' + err); }); } @@ -57,8 +56,15 @@ class Companies extends Component { }) .then((res) => { this.setState({ companies: res.data.data }); - alert('Cases have been sorted'); - document.location.href = '/getCaseLawyer'; + + // const r = swal.confirm("cases have been sorted?"); + // if(r == true){ + + // document.location.href = '/getCaseLawyer'; + // } + + swal('Cases have been sorted') + setTimeout("document.location.href = '/getCaseLawyer';",3500); }) .catch((err) => { console.log(err); @@ -72,8 +78,8 @@ class Companies extends Component { }) .then((res) => { this.setState({ companies: res.data.data }); - alert('Cases have been sorted'); - document.location.href = '/getCaseLawyer'; + swal('Cases have been sorted'); + setTimeout("document.location.href = '/getCaseLawyer';",3500); }) .catch((err) => { console.log(err); @@ -87,11 +93,11 @@ class Companies extends Component { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then((res) => { - alert('The form was accepted succesfully'); - document.location.href = '/getCaseLawyer'; + swal('The form was accepted succesfully'); + setTimeout("document.location.href = '/getCaseLawyer';",3500); }) .catch((err)=>{ - alert(err.response.data.msg|| err.response.data); + swal(err.response.data.msg|| err.response.data); console.log(err.response); }) }; @@ -103,11 +109,11 @@ class Companies extends Component { headers: { Authorization: localStorage.getItem('jwtToken') } }) .then((res) => { - alert('The fees was calculated succesfully'); - document.location.href = '/getCaseLawyer'; + swal('The fees was calculated succesfully'); + setTimeout("document.location.href = '/getCaseLawyer';",3500); }) .catch((err)=>{ - alert(err.response.data.msg|| err.response.data); + swal(err.response.data.msg|| err.response.data); console.log(err.response); }) }; diff --git a/client/src/components/pages/inProgressInvestorCases.js b/client/src/components/pages/inProgressInvestorCases.js index 110dcb3..947d3e6 100644 --- a/client/src/components/pages/inProgressInvestorCases.js +++ b/client/src/components/pages/inProgressInvestorCases.js @@ -7,6 +7,8 @@ import Mongoose from 'mongoose'; import { MDBProgress } from 'mdbreact'; import { Button } from 'react-bootstrap'; import trans from '../translations/inProgressInvestorTranslation'; +import swal from 'sweetalert'; + class InProgressInvestorCases extends Component { state = { certainFormType: [], @@ -48,8 +50,9 @@ class InProgressInvestorCases extends Component { }) .then((res) => { //document.getElementById('Flip').flipOnClick = false; - alert('This case has been deleted successfully!'); - document.location.href = '/investorInProgressform'; + swal('This case has been deleted successfully!'); + setTimeout("document.location.href = '/investorInProgressform';",3500); + // document.location.href = '/investorInProgressform'; }) .catch((err) => { console.log(err); diff --git a/client/src/components/pages/landingBody.js b/client/src/components/pages/landingBody.js index f464350..5308f3f 100644 --- a/client/src/components/pages/landingBody.js +++ b/client/src/components/pages/landingBody.js @@ -17,7 +17,7 @@ import Footer from '../layout/footer'; import { Animate, AnimateGroup } from 'react-simple-animate'; import egypt1 from '../layout/egypt.gif'; import trans from '../translations/landingTranslation'; - +// import meta from '@babel/core'; class LandingBody extends Component { props = { startStyle: { opacity: 0 }, @@ -69,10 +69,12 @@ class LandingBody extends Component { +

+ +
diff --git a/client/src/components/pages/showProfileI.js b/client/src/components/pages/showProfileI.js index e9e17a0..1c49f00 100644 --- a/client/src/components/pages/showProfileI.js +++ b/client/src/components/pages/showProfileI.js @@ -4,6 +4,7 @@ import '../../App.css'; import Table from 'react-bootstrap/Table'; import ShowP from '../user/showPI'; import { Button } from 'react-bootstrap'; +import swal from 'sweetalert'; class ShowProfileI extends Component { constructor(props) { @@ -20,7 +21,7 @@ class ShowProfileI extends Component { .then((res) => { this.setState({ userInfo: [ res.data.data ] }); }) - .catch((err) => alert(err.response.data.errmsg || err.response.data)); + .catch((err) => swal(err.response.data.errmsg || err.response.data)); }; tabRow() { diff --git a/client/src/components/pages/unassignedForm.js b/client/src/components/pages/unassignedForm.js index 98faf2c..78519d5 100644 --- a/client/src/components/pages/unassignedForm.js +++ b/client/src/components/pages/unassignedForm.js @@ -6,6 +6,7 @@ import { Button } from 'react-bootstrap'; import 'mdbreact/dist/css/mdb.css'; import Flippy, { FrontSide, BackSide } from 'react-flippy'; import trans from '../translations/unassignedTranslation'; +import swal from 'sweetalert'; const mongoose = require('mongoose'); class unassignedForm extends Component { state = { @@ -31,8 +32,9 @@ class unassignedForm extends Component { }) .then((res) => { //document.getElementById('Flip').flipOnClick = false; - alert('This Case is assigned to YOU!!'); - document.location.href = '/UnassignedForm'; + swal('This Case is assigned to YOU!!'); + setTimeout("document.location.href = '/UnassignedForm';",3500); + // document.location.href = '/UnassignedForm'; }) .catch((err) => console.log(err)); }; diff --git a/routes/api/users.js b/routes/api/users.js index 3e74890..7202e7f 100644 --- a/routes/api/users.js +++ b/routes/api/users.js @@ -65,7 +65,8 @@ router.get('/CertainAttributes', passport.authenticate('jwt', { session: false } Email: searchUsers.email, Password: searchUsers.password, Telephone: searchUsers.telephone, - Fax: searchUsers.fax + Fax: searchUsers.fax, + FinancialBalance:searchUsers.financialBalance }); });