Profile avatar

This commit is contained in:
DawitG96
2019-01-18 23:24:50 +01:00
parent 1246116804
commit 4294f48fd8
8 changed files with 113 additions and 21 deletions

View File

@@ -14,7 +14,19 @@
<ul class="dropdown-menu">
<!-- The user image in the menu -->
<li class="user-header">
<img src="~/AdminLTE-2.4.3/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
<img src="@session.GetString("avatar")" class="img-circle" alt="User Image" id="avatar">
<div>
<input type="button" class="btn-flat" value="+" id="btn-plus" />
</div>
<!--<div id="image-uploader" style="display:none">
<input name="files" id="files" type="file" />
</div>-->
<div id="image-uploader" style="display:none">
<form method="post" enctype="multipart/form-data">
<input type="file" name="files" id="files" />
</form>
</div>
<p>
@session.GetString("name") @session.GetString("lastname") - @session.GetString("role")
<small>@session.GetString("email")</small>
@@ -32,6 +44,19 @@
</ul>
<script>
$(document).ready(function () {
$("#files").kendoUpload({
async: {
saveUrl: "save",
autoUpload: true
}
});
});
$("#btn-plus").on("click", function () {
$("#image-uploader").toggle();
});
$("#logout-btn").on("click", function () {
$.ajax({
url: "/Account/_logout",

View File

@@ -78,7 +78,7 @@
where p.Doctor.Equals(docData.Username)
select new { u.Username, u.Name, u.LastName, p.Notes, Profile = "<a href=\\\"/user/" + u.Username + "\\\">Profile</a>" }).ToArray();
data = patients;
type = patients.FirstOrDefault().GetType();
type = patients.FirstOrDefault()?.GetType();
}
else // is a patient and need to choose a doctor
{
@@ -91,15 +91,19 @@
type = docs.FirstOrDefault().GetType();
}
var fields = new List<string>();
foreach (var field in type.GetProperties())
if (type != null)
{
fields.Add(field.Name);
}
<p>@title</p>
<div id="var-table"></div>
<script>
var fields = new List<string>();
foreach (var field in type.GetProperties())
{
fields.Add(field.Name);
}
<p>@title</p>
<div id="var-table"></div>
<script>
var datas = [
@foreach (var el in data)
{
@@ -156,7 +160,8 @@
</text>
}
});
</script>
</script>
}
}
</div>
</div>

View File

@@ -5,7 +5,7 @@
<input type="text" id="regLastname" placeholder="Lastname" />
<input type="password" id="regPassword" placeholder="Password" required />
<input type="email" id="regEmail" placeholder="Email" required />
<label>Doc?</label><input type="checkbox" id="regDoctor" />
<input type="text" id="regDoctor" placeholder="Doctor only (543210)" />
<div>
<button class="btn-default btn btn-flat" id="register-btn">Register</button>
</div>
@@ -20,17 +20,19 @@
var lastname = $("#regLastname").val();
var password = $("#regPassword").val();
var email = $("#regEmail").val();
var role = $("#regDoctor").is(":checked")? "Doctor":"User";
var code = $("#regDoctor").val();
$.ajax({
url: "/Account/_register",
data: {
Username: username,
Name: name,
Lastname: lastname,
Password: password,
Email: email,
Role: role
Code: code,
User: {
Username: username,
Name: name,
Lastname: lastname,
Password: password,
Email: email
}
},
dataType: "json",
type: "POST",
@@ -43,7 +45,7 @@
}
},
error: function (xhr, status, error) {
alert(xhr.responseText)
alert(error)
}
})
});