Skip to content

Commit

Permalink
nada
Browse files Browse the repository at this point in the history
  • Loading branch information
NadaAboudeshish committed May 3, 2019
1 parent 66e03da commit 49787d5
Show file tree
Hide file tree
Showing 28 changed files with 114 additions and 137 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 10 additions & 5 deletions client/src/actions/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ 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
.post('/routes/api/users/register', user)
//.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);
});

Expand All @@ -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') {
Expand All @@ -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);
});
}
Expand Down Expand Up @@ -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;
}
// {
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/pages/AddCommentsLawyer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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</Button>
</Modal.Body>
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/pages/AddCommentsReviewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');



Expand Down Expand Up @@ -71,7 +72,7 @@ class AddCommentsReviewer extends Component{
};

handleEvent = () => {
alert("I was clicked");
swal("I was clicked");
};


Expand Down Expand Up @@ -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</Button>
</Modal.Body>
<Modal.Footer>
Expand Down
7 changes: 0 additions & 7 deletions client/src/components/pages/ApprovedCompanies.js
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -33,12 +32,6 @@ class ApprovedCompanies extends Component {
}
})
}
// tabRow(){
// return (
// this.state.approvedCompanies.map(function(approvedCompany,i){
// return <ApprovedCompaniesFields approvedCompany={approvedCompany} key={i}/>})
// )
// }

printDocument() {
const input = document.getElementById('divToPrint');
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/pages/AttributeArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
});
};
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/pages/ChangePassword.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) => {
Expand Down Expand Up @@ -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')
)}
/>
</div>
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/pages/CreateANewCompany.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
});
};
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/pages/EditInvCompany.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) => {
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/pages/EditProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
});
}
Expand Down
7 changes: 4 additions & 3 deletions client/src/components/pages/EditSPCForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 });
});
Expand All @@ -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);
});
}
Expand Down
5 changes: 3 additions & 2 deletions client/src/components/pages/EditUnassigned.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
});
}
Expand Down
Loading

0 comments on commit 49787d5

Please sign in to comment.