Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
ac7c3aa
edit
Jan 1, 2022
ca57028
done
Jan 1, 2022
2650e9d
done
Jan 1, 2022
3d34499
done
Jan 1, 2022
35b13d8
signup
yahialabeeb Jan 1, 2022
faff7b8
done
Jan 1, 2022
edc7264
profile hospital and users
MohammadAl-khatib Jan 1, 2022
373ae3d
Merge pull request #1 from Python-Hiss/profile
yaseen1998 Jan 1, 2022
50f6b20
Merge pull request #2 from Python-Hiss/create_react
yaseen1998 Jan 1, 2022
ec38516
Merge branch 'backup-front' into yahia2
yaseen1998 Jan 1, 2022
61cbda5
Merge pull request #3 from Python-Hiss/yahia2
yaseen1998 Jan 1, 2022
a9d27f1
section 3 + footer
mrobeidat Jan 1, 2022
fcca8ef
edit
Jan 2, 2022
ea5ab68
signup
Jan 2, 2022
b7783b7
done
Jan 2, 2022
a375454
Merge branch 'stylehome' into create_react
yaseen1998 Jan 2, 2022
eb5b8c5
Merge pull request #4 from Python-Hiss/create_react
yaseen1998 Jan 2, 2022
cb295f8
done
Jan 2, 2022
c74ccc3
v1
hayaa123 Jan 2, 2022
e30813b
user profile page styling
MohammadAl-khatib Jan 2, 2022
10b439d
styling footer
mrobeidat Jan 2, 2022
5f1965e
done
Jan 2, 2022
dc186b3
Merge pull request #5 from Python-Hiss/yousef2
yaseen1998 Jan 2, 2022
157859b
done
Jan 2, 2022
1762f26
done
Jan 2, 2022
43b4137
added some style
hayaa123 Jan 3, 2022
19fbeb6
login
Jan 3, 2022
60228b5
finish
Jan 3, 2022
26fdb2f
done
Jan 3, 2022
dd6bf3d
done
Jan 3, 2022
ac9a666
add post page
hayaa123 Jan 3, 2022
5a40b05
regular checkout
MohammadAl-khatib Jan 3, 2022
2e67a5d
add newsfeed funcrionality
yahialabeeb Jan 3, 2022
fa9a6bc
edit
Jan 3, 2022
ad3db8f
done
Jan 3, 2022
767d46e
add
Jan 4, 2022
6bd0832
add post functionality
yahialabeeb Jan 4, 2022
36c4508
added header and footer
hayaa123 Jan 4, 2022
7610ecc
done
Jan 4, 2022
9931b1e
add post functionality
yahialabeeb Jan 4, 2022
43b83e2
done
Jan 4, 2022
76c1894
edit
yahialabeeb Jan 4, 2022
fd93166
done
Jan 4, 2022
f9d035f
done
Jan 4, 2022
e7e9e55
add some style
hayaa123 Jan 4, 2022
0be241f
header and user profile edited
MohammadAl-khatib Jan 4, 2022
e73c655
hospital profile
yahialabeeb Jan 5, 2022
b98acb4
done
Jan 5, 2022
ae4e488
edit profile
yahialabeeb Jan 5, 2022
853e76d
edit
Jan 5, 2022
79ca7ff
editing address and blood
MohammadAl-khatib Jan 5, 2022
3dbf183
Merge branch 'yahiaedit2' of https://github.com/Python-Hiss/life-shar…
Jan 5, 2022
acbbda5
done
Jan 5, 2022
d13cf5f
done
Jan 5, 2022
ecbae26
done
Jan 5, 2022
e756c25
push
Jan 5, 2022
191937a
home-style-final-version
mrobeidat Jan 5, 2022
85501c1
push
Jan 5, 2022
e87be28
done
Jan 5, 2022
d1b0496
done
Jan 5, 2022
cba2425
done
Jan 5, 2022
0566069
done
Jan 5, 2022
9807883
Merge pull request #17 from Python-Hiss/yasedit
yaseen1998 Jan 5, 2022
7722ba2
done
Jan 5, 2022
bcdaf32
done
Jan 5, 2022
109f509
edit post
yahialabeeb Jan 5, 2022
5397055
Merge pull request #18 from Python-Hiss/yahiaaaaa
yaseen1998 Jan 5, 2022
ee8b9c9
edit
Jan 6, 2022
ec00139
Merge branch 'yahiaedits' into yasedit
yaseen1998 Jan 6, 2022
9557a19
Merge pull request #19 from Python-Hiss/yasedit
yaseen1998 Jan 6, 2022
189271c
Update About.js
mrobeidat Feb 22, 2022
d4c40e7
Update About.js
mrobeidat Feb 22, 2022
5c62066
edit yousef image link
mrobeidat Feb 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions components/Cahngepas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React from 'react'
import axios from 'axios';
export default function Cahngepas(props) {
const url = 'https://lifeshareproject.herokuapp.com/'
console.log(props.token);
const handlesubmit=async(e)=>{
e.preventDefault();
let password = {
new_password:e.target.new_password.value,
old_password : e.target.old_password.value

}
const config = {
headers:{'Authorization':`Bearer ${props.token}`},
}
const change = await axios.put(`${url}accounts/api/change-password/`,password,config)
console.log(change.data);
}

return (
<div className="mt-5">
<div className="w-4/5 m-auto ">
<div className="mt-5 md:mt-0 md:col-span-2">
<form onSubmit={handlesubmit}>
<div className="shadow sm:rounded-md sm:overflow-hidden">
<div className="px-4 py-5 space-y-6 bg-white sm:p-6">
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
old_password
</label>
<input
type="password"
name="old_password"
id="old_password-name"
autoComplete="given-name"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
new_password
</label>
<input
// defaultValue={props.result.username}
type="password"
name="new_password"
id="new_password"
autoComplete="given-name"
className="block w-full mt-1 border border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="grid grid-cols-6 gap-6">
<button
onClick={()=>props.setchange(false)}
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-md shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
>
Cancel
</button>
<button
type="submit"
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-md shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
>
Save
</button>
</div>
</div>


</div>
</form>
</div>
</div>
</div>
)
}
267 changes: 267 additions & 0 deletions components/EditHospital.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
import { useState, useEffect } from "react";
import axios from "axios";
// import { comment } from "postcss";
// import { Component } from "react/cjs/react.production.min";
import { useAuth } from "../contexts/auth";

export default function EditHospital(props) {
let url = 'https://lifeshareproject.herokuapp.com/'
const [address, setaddress] = useState("");
const { tokens } = useAuth();
// useEffect(async () => {
// await axios
// .get(`${url}address/address/${props.result.address}/`)
// .then((data) => {
// setaddress(data.data)
// console.log(data);
// });
// }, []);

const handlesubmit = async (e) => {
e.preventDefault();
let area = {
area: e.target.Area.value,

}
let city = {
city: e.target.City.value,

}
const Area = await axios.post(`${url}address/area/`, area)
const City = await axios.post(`${url}address/city/`, city)
let address = {

area: Area.data.id,
city: City.data.id,
direction: e.target.direction.value
}

const Address = await axios.post(`${url}address/address/`, address)
console.log(Area.data);
console.log(City.data);
console.log(Address.data);

console.log(e.target.img.files[0]);
let data = new FormData();

data.append("first_name", e.target.firstname.value);
data.append("username", e.target.username.value);
data.append("email", e.target.email.value);
if (e.target.img.files[0]){
data.append("image", e.target.img.files[0]);
}

data.append("phone_number", e.target.phone_number.value);
data.append("address", Address.data.id);
data.append("website", e.target.Website.value);

let urls = `${url}accounts/hospital/${tokens.id}/`;



axios.put(urls, data, {
headers: {
"content-type": "multipart/form-data",
},
})
.then((res) => {
console.log(res);
props.setprofile(res.data);
props.setedit(false)

});
};

const closing = () => {
props.setedit(false)
}

return (
<>
<div>
<div className="w-4/5 m-auto ">
<div className="mt-5 md:mt-0 md:col-span-2">
<form onSubmit={handlesubmit}>
<div className="shadow sm:rounded-md sm:overflow-hidden">
<div className="px-4 py-5 space-y-6 bg-white sm:p-6">
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
Hospital name
</label>
<input
defaultValue={props.result.first_name}
type="text"
name="firstname"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
User Name
</label>
<input
defaultValue={props.result.username}
type="text"
name="username"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
Email
</label>
<input
defaultValue={props.result.email}
name="email"
type="text"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
Phone Number
</label>
<input
type="text"
defaultValue={props.result.phone_number}
name="phone_number"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
Website
</label>
<input
type="text"
defaultValue={props.result.website}
name="Website"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="grid grid-cols-6 gap-6">
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
Area
</label>

<input
defaultValue='amman'
type="text"
name="Area"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
<div className="col-span-6 sm:col-span-3">
<label
htmlFor="first-name"
className="block text-sm font-medium text-gray-700"
>
City
</label>
{/* {address.area && */}
<input
defaultValue='amman'
type="text"
name="City"
id="first-name"
autoComplete="given-name"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
{/* } */}
</div>
</div>

<div className="grid grid-cols-2 gap-6">

<div>
<label className="block text-sm font-medium text-gray-700">
Photo
</label>
<div className="flex items-center mt-1">

<input
type="file"
accept="image/*"
name="img"
// defaultValue={props.result.image}
/>


</div>
</div>
<div className="relative w-40 mb-3">
<label
className="block mb-2 text-xs font-bold uppercase text-blueGray-600"
htmlFor="grid-password"
>
Direction
</label>
<input
defaultValue="direction"
type="text"
name="direction"
className="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-red-500 focus:border-red-500 sm:text-sm"
/>
</div>
</div>
</div>
<div className="grid grid-cols-6 gap-6">
<button
onClick={closing}
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-md shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
>
Cancel
</button>
<button
type="submit"
className="inline-flex justify-center px-4 py-2 text-sm font-medium text-white bg-red-600 border border-transparent rounded-md shadow-sm hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500"
>
Save
</button>
</div>

</div>
</form>
</div>
</div>
</div>

<div className="hidden sm:block" aria-hidden="true">
<div className="py-5">
<div className="border-t border-gray-200" />
</div>
</div>
</>
);
}
Loading