Merge
merged commit form master that fixed most things
This commit is contained in:
@@ -6,6 +6,8 @@ using LinqToDB;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using SeniorAssistant.Models.Users;
|
||||
using SeniorAssistant.Data;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.IO;
|
||||
|
||||
@@ -16,118 +18,119 @@ namespace IdentityDemo.Controllers
|
||||
public class AccountController : BaseController
|
||||
{
|
||||
private static readonly string NoteModified = "Il tuo dottore ha modificato la nota per te";
|
||||
private static readonly string InvalidLogIn = "Username o Password sbagliati";
|
||||
private static readonly string AlreadyLogIn = "L'utente e' gia' loggato";
|
||||
private static readonly string UsernameDupl = "Lo username selezionato e' gia' in uso";
|
||||
private static readonly string ModNotExists = "L'oggetto da modificare non esiste";
|
||||
private static readonly string AlreadyPatie = "Sei gia' un paziente";
|
||||
private static readonly string DocNotExists = "Il dottore selezionato non esiste";
|
||||
private static readonly string InsertAsDoct = "Ti ha inserito come il suo dottore: ";
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _login(string username, string password)
|
||||
public async Task<ActionResult> _login(string username, string password)
|
||||
{
|
||||
JsonResponse response = new JsonResponse
|
||||
{
|
||||
Success = false,
|
||||
Message = "Username or password is invalid."
|
||||
};
|
||||
|
||||
var result = Db.GetTable<User>().Where(user => user.Username.Equals(username) && user.Password.Equals(password)).ToListAsync().Result;
|
||||
var result = await (from u in Db.Users
|
||||
where u.Username.Equals(username)
|
||||
&& u.Password.Equals(password)
|
||||
select u).ToListAsync();
|
||||
|
||||
if (result.Count == 1)
|
||||
{
|
||||
var loggedUser = HttpContext.Session.GetString(Username);
|
||||
if (loggedUser==null || !loggedUser.Equals(username)) // non ha senso
|
||||
{
|
||||
User user = result.First();
|
||||
HttpContext.Session.SetString(Username, username);
|
||||
HttpContext.Session.SetString("email", user.Email);
|
||||
HttpContext.Session.SetString("name", user.Name);
|
||||
HttpContext.Session.SetString("lastname", user.LastName);
|
||||
User user = result.First();
|
||||
HttpContext.Session.SetString(Username, username);
|
||||
HttpContext.Session.SetString("email", user.Email);
|
||||
HttpContext.Session.SetString("name", user.Name);
|
||||
HttpContext.Session.SetString("lastname", user.LastName);
|
||||
|
||||
var isDoc = (from d in Db.Doctors
|
||||
where d.Username.Equals(username)
|
||||
select d).ToArray().FirstOrDefault() != null;
|
||||
HttpContext.Session.SetString("role", isDoc? "doctor":"patient");
|
||||
var isDoc = (from d in Db.Doctors
|
||||
where d.Username.Equals(username)
|
||||
select d).ToArray().FirstOrDefault() != null;
|
||||
HttpContext.Session.SetString("role", isDoc? "doctor":"patient");
|
||||
|
||||
response.Success = true;
|
||||
response.Message = Request.Query["ReturnUrl"];
|
||||
}
|
||||
else
|
||||
{
|
||||
response.Message = "User already logged";
|
||||
}
|
||||
return Json(OkJson);
|
||||
}
|
||||
return Json(response);
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = InvalidLogIn
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _logout()
|
||||
{
|
||||
HttpContext.Session.Clear();
|
||||
return Json(new JsonResponse());
|
||||
return Json(OkJson);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _register(User user, string code = "")
|
||||
public async Task<ActionResult> _register(User user, string code = "")
|
||||
{
|
||||
return Action(() =>
|
||||
try
|
||||
{
|
||||
try
|
||||
Db.Insert(user);
|
||||
if (code != null && code.Equals("444442220"))
|
||||
{
|
||||
Db.Insert(user);
|
||||
if(code != null && code.Equals("444442220"))
|
||||
Db.Insert(new Doctor
|
||||
{
|
||||
Db.Insert(new Doctor
|
||||
{
|
||||
Username = user.Username
|
||||
});
|
||||
};
|
||||
return _login(user.Username, user.Password);
|
||||
}
|
||||
catch
|
||||
Username = user.Username
|
||||
});
|
||||
};
|
||||
return await _login(user.Username, user.Password);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
return Json(new JsonResponse(false, "Username already exists"));
|
||||
}
|
||||
});
|
||||
Success = false,
|
||||
Message = UsernameDupl
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _notification(string username, string message)
|
||||
public async Task<ActionResult> _notification(string username, string message, string redirectUrl = "#")
|
||||
{
|
||||
return LoggedAction(() =>
|
||||
return await LoggedAction(() =>
|
||||
{
|
||||
Db.Insert(new Notification()
|
||||
{
|
||||
Message = message,
|
||||
Username = username,
|
||||
Time = DateTime.Now,
|
||||
Seen = false
|
||||
Body = message,
|
||||
Username = HttpContext.Session.GetString(Username),
|
||||
Receiver = username,
|
||||
Url = redirectUrl,
|
||||
Time = DateTime.Now
|
||||
});
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public ActionResult _notification(int id)
|
||||
public async Task<ActionResult> _notification(int id)
|
||||
{
|
||||
return LoggedAction(() =>
|
||||
return await LoggedAction(() =>
|
||||
{
|
||||
JsonResponse response = OkJson;
|
||||
|
||||
Notification note = Db.Notifications.Where(n => n.Id == id).ToArray().FirstOrDefault();
|
||||
if(note != null)
|
||||
{
|
||||
note.Seen = true;
|
||||
note.Seen = DateTime.Now;
|
||||
Db.Update(note);
|
||||
}
|
||||
else
|
||||
{
|
||||
response.Success = false;
|
||||
response.Message = "La notifica da modificare non esiste";
|
||||
response.Message = ModNotExists;
|
||||
}
|
||||
return Json(response);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _addDoc(string doctor)
|
||||
public async Task<ActionResult> _addDoc(string doctor)
|
||||
{
|
||||
return LoggedAction(() =>
|
||||
return await LoggedAction(() =>
|
||||
{
|
||||
string username = HttpContext.Session.GetString(Username);
|
||||
var isAlreadyPatient = Db.Patients.Where(p => p.Username.Equals(username)).ToArray().FirstOrDefault() != null;
|
||||
@@ -135,7 +138,7 @@ namespace IdentityDemo.Controllers
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = "You are already a patient"
|
||||
Message = AlreadyPatie
|
||||
});
|
||||
|
||||
var docExist = Db.Doctors.Where(d => d.Username.Equals(doctor)).ToArray().FirstOrDefault() != null;
|
||||
@@ -143,7 +146,7 @@ namespace IdentityDemo.Controllers
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = "Doctor doesn't exist"
|
||||
Message = DocNotExists
|
||||
});
|
||||
|
||||
Db.Insert(new Patient()
|
||||
@@ -152,40 +155,65 @@ namespace IdentityDemo.Controllers
|
||||
Username = username
|
||||
});
|
||||
|
||||
_notification(doctor, "L'utente "+username+" ti ha inserito come il suo dottore.");
|
||||
return Json(new JsonResponse());
|
||||
var a = _notification(doctor, InsertAsDoct + username);
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult _sendMessage(string reciver, string body)
|
||||
public async Task<ActionResult> _sendMessage(string receiver, string body)
|
||||
{
|
||||
return LoggedAction(() => {
|
||||
return await LoggedAction(() => {
|
||||
string username = HttpContext.Session.GetString(Username);
|
||||
Message message = new Message()
|
||||
{
|
||||
Reciver = reciver,
|
||||
Receiver = receiver,
|
||||
Body = body,
|
||||
Time = DateTime.Now,
|
||||
Username = username,
|
||||
Seen = false
|
||||
Username = username
|
||||
};
|
||||
|
||||
Db.Insert(message);
|
||||
|
||||
return Json(new JsonResponse());
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public ActionResult _addNote(string patient, string text)
|
||||
public async Task<ActionResult> _addNote(string patient, string text)
|
||||
{
|
||||
return LoggedAccessDataOf(patient, () =>
|
||||
return await LoggedAccessDataOf(patient, true, () =>
|
||||
{
|
||||
var pat = Db.Patients.Where((p) => p.Username.Equals(patient)).FirstOrDefault();
|
||||
pat.Notes = text;
|
||||
Db.Update(pat);
|
||||
_notification(patient, NoteModified);
|
||||
var a = _notification(patient, NoteModified);
|
||||
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<ActionResult> _minHeartToPatient(string patient, int value)
|
||||
{
|
||||
return await LoggedAccessDataOf(patient, true, () =>
|
||||
{
|
||||
var pat = Db.Patients.Where((p) => p.Username.Equals(patient)).FirstOrDefault();
|
||||
pat.MinHeart = value;
|
||||
Db.Update(pat);
|
||||
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<ActionResult> _maxHeartToPatient(string patient, int value)
|
||||
{
|
||||
return await LoggedAccessDataOf(patient, true, () =>
|
||||
{
|
||||
var pat = Db.Patients.Where((p) => p.Username.Equals(patient)).FirstOrDefault();
|
||||
pat.MaxHeart = value;
|
||||
Db.Update(pat);
|
||||
|
||||
return Json(OkJson);
|
||||
});
|
||||
@@ -193,7 +221,7 @@ namespace IdentityDemo.Controllers
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async System.Threading.Tasks.Task<ActionResult> Save(IFormFile file)
|
||||
public async Task<ActionResult> _save(IFormFile file)
|
||||
{
|
||||
return LoggedAction(() =>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq;
|
||||
|
||||
namespace SeniorAssistant.Controllers
|
||||
{
|
||||
@@ -16,19 +17,19 @@ namespace SeniorAssistant.Controllers
|
||||
[Route("Heartbeat")]
|
||||
public IActionResult Heartbeat()
|
||||
{
|
||||
return CheckAuthorized("Heartbeat");
|
||||
return CheckAuthorized("Data", "Heartbeat");
|
||||
}
|
||||
|
||||
[Route("Sleep")]
|
||||
public IActionResult Sleep()
|
||||
{
|
||||
return CheckAuthorized("Sleep");
|
||||
return CheckAuthorized("Data", "Sleep");
|
||||
}
|
||||
|
||||
[Route("Step")]
|
||||
public IActionResult Step()
|
||||
{
|
||||
return CheckAuthorized("Step");
|
||||
return CheckAuthorized("Data", "Step");
|
||||
}
|
||||
|
||||
[Route("Users")]
|
||||
@@ -40,13 +41,16 @@ namespace SeniorAssistant.Controllers
|
||||
[Route("User/{User}")]
|
||||
public IActionResult SingleUser(string user)
|
||||
{
|
||||
return CheckAuthorized("Data", user);
|
||||
var u = (from us in Db.Users
|
||||
where us.Username.Equals(user)
|
||||
select us).FirstOrDefault();
|
||||
return CheckAuthorized("User", u);
|
||||
}
|
||||
|
||||
[Route("Message/{Id}")]
|
||||
public IActionResult Message(int id)
|
||||
[Route("Message/{User}")]
|
||||
public IActionResult Message(string user)
|
||||
{
|
||||
return CheckAuthorized("Message", id);
|
||||
return CheckAuthorized("Message", user);
|
||||
}
|
||||
|
||||
private IActionResult CheckAuthorized(string view, object model = null)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SeniorAssistant.Models;
|
||||
using SeniorAssistant.Models.Data;
|
||||
using SeniorAssistant.Models.Users;
|
||||
|
||||
namespace SeniorAssistant.Controllers.Services
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SeniorAssistant.Data;
|
||||
using SeniorAssistant.Models.Users;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SeniorAssistant.Controllers
|
||||
{
|
||||
@@ -10,12 +12,13 @@ namespace SeniorAssistant.Controllers
|
||||
{
|
||||
protected static readonly string MustBeLogged = "Devi essere loggato per vedere/modificare questo dato";
|
||||
protected static readonly string InvalidModel = "Modello non valido";
|
||||
protected static readonly string NoAuthorized = "Non sei autorizzato a vedere questi dati";
|
||||
protected static readonly string NoAuthorized = "Non sei autorizzato ad accedere a questi dati";
|
||||
protected static readonly string ExceptionSer = "Il server ha riscontrato un problema: ";
|
||||
protected static readonly string Username = "username";
|
||||
protected readonly JsonResponse OkJson = new JsonResponse();
|
||||
|
||||
IDataContextFactory<SeniorDataContext> dbFactory;
|
||||
SeniorDataContext db;
|
||||
private IDataContextFactory<SeniorDataContext> dbFactory;
|
||||
private SeniorDataContext db;
|
||||
|
||||
protected T TryResolve<T>() => (T)HttpContext.RequestServices.GetService(typeof(T));
|
||||
|
||||
@@ -34,42 +37,45 @@ namespace SeniorAssistant.Controllers
|
||||
{
|
||||
return HttpContext.Session.GetString(Username) != null;
|
||||
}
|
||||
|
||||
protected ActionResult Action(Func<ActionResult> success)
|
||||
|
||||
protected async Task<ActionResult> LoggedAction(Func<ActionResult> success)
|
||||
{
|
||||
return ModelState.IsValid ?
|
||||
success.Invoke() :
|
||||
Json(new JsonResponse()
|
||||
try
|
||||
{
|
||||
if (IsLogged())
|
||||
return success.Invoke();
|
||||
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = InvalidModel
|
||||
Message = MustBeLogged
|
||||
});
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = ExceptionSer + Environment.NewLine +
|
||||
e.Message + Environment.NewLine +
|
||||
e.StackTrace + Environment.NewLine +
|
||||
e.TargetSite + Environment.NewLine +
|
||||
e.InnerException
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected ActionResult LoggedAction(Func<ActionResult> success)
|
||||
protected async Task<ActionResult> LoggedAccessDataOf(string username, bool patients, Func<ActionResult> success)
|
||||
{
|
||||
return Action(() =>
|
||||
return await LoggedAction(() =>
|
||||
{
|
||||
return IsLogged() ?
|
||||
success.Invoke() :
|
||||
Json(new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = MustBeLogged
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected ActionResult LoggedAccessDataOf(string username, Func<ActionResult> success, bool patients = true)
|
||||
{
|
||||
return LoggedAction(() =>
|
||||
{
|
||||
var loggedUser = HttpContext.Session.GetString(Username);
|
||||
var condition = username.Equals(loggedUser);
|
||||
|
||||
condition = condition || (patients && (from patient in Db.Patients
|
||||
where patient.Doctor.Equals(loggedUser) && patient.Username.Equals(username)
|
||||
select patient).ToArray().FirstOrDefault() != null);
|
||||
var session = HttpContext.Session.GetString(Username);
|
||||
var condition = username.Equals(session);
|
||||
var query = from patient in Db.Patients
|
||||
where patient.Doctor.Equals(session) && patient.Username.Equals(username)
|
||||
select patient;
|
||||
var num = query.ToList().Count();
|
||||
condition = condition || (patients && num != 0);
|
||||
|
||||
return condition ?
|
||||
success.Invoke() :
|
||||
@@ -80,6 +86,47 @@ namespace SeniorAssistant.Controllers
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
static protected JsonResponse LoggedAction(SeniorDataContext db, string session, Func<JsonResponse> success)
|
||||
{
|
||||
try
|
||||
{
|
||||
return session != null ?
|
||||
success.Invoke() :
|
||||
new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = MustBeLogged
|
||||
};
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = ExceptionSer + e.Message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
static protected JsonResponse LoggedAccessDataOf(SeniorDataContext db, string session, string username, bool patients, Func<JsonResponse> success)
|
||||
{
|
||||
return LoggedAction(db, session, () =>
|
||||
{
|
||||
var condition = username.Equals(session);
|
||||
condition = condition || (patients && (from patient in db.Patients
|
||||
where patient.Doctor.Equals(session) && patient.Username.Equals(username)
|
||||
select patient).ToArray().FirstOrDefault() != null);
|
||||
|
||||
return condition ?
|
||||
success.Invoke() :
|
||||
new JsonResponse()
|
||||
{
|
||||
Success = false,
|
||||
Message = NoAuthorized
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class JsonResponse
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace SeniorAssistant.Controllers.Services
|
||||
[HttpGet("{username}")]
|
||||
public async Task<IActionResult> Read(string username)
|
||||
{
|
||||
return LoggedAccessDataOf(username, () =>
|
||||
return await LoggedAccessDataOf(username, true, () =>
|
||||
{
|
||||
return Json(Db.GetTable<TEntity>().Where((u) => u.Username.Equals(username)).ToArray());
|
||||
});
|
||||
@@ -22,12 +22,12 @@ namespace SeniorAssistant.Controllers.Services
|
||||
[HttpPut("{username}")]
|
||||
public async Task<IActionResult> Update(string username, [FromBody] TEntity entity)
|
||||
{
|
||||
return LoggedAccessDataOf(username, () =>
|
||||
return await LoggedAccessDataOf(username, false, () =>
|
||||
{
|
||||
entity.Username = username;
|
||||
Db.Update(entity);
|
||||
return Json(OkJson);
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using LinqToDB;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SeniorAssistant.Models.Data;
|
||||
using SeniorAssistant.Models;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SeniorAssistant.Controllers.Services
|
||||
@@ -11,6 +13,7 @@ namespace SeniorAssistant.Controllers.Services
|
||||
where TEntity : class, IHasTime
|
||||
{
|
||||
private static readonly string DateNotCorrect = "Il formato della data non e' corretto";
|
||||
private static readonly string AnomalDataHear = "Valore dei battiti cardiaci anomalo";
|
||||
|
||||
[HttpGet("{username}/{date:regex((today|\\d{{4}}-\\d{{2}}-\\d{{2}}))}/{hour:range(0, 23)?}")]
|
||||
public async Task<IActionResult> Read(string username, string date, int hour = -1) => await Read(username, date, date, hour);
|
||||
@@ -18,7 +21,7 @@ namespace SeniorAssistant.Controllers.Services
|
||||
[HttpGet("{username}/{from:regex((today|\\d{{4}}-\\d{{2}}-\\d{{2}}))}/{to:regex((today|\\d{{4}}-\\d{{2}}-\\d{{2}}))}/{hour:range(0, 23)?}")]
|
||||
public async Task<IActionResult> Read(string username, string from, string to, int hour = -1)
|
||||
{
|
||||
return LoggedAccessDataOf(username, () =>
|
||||
return await LoggedAccessDataOf(username, true, () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -42,7 +45,7 @@ namespace SeniorAssistant.Controllers.Services
|
||||
[HttpGet("{username}/last/{hour:min(1)}")]
|
||||
public async Task<IActionResult> Read(string username, int hour)
|
||||
{
|
||||
return LoggedAccessDataOf(username, () =>
|
||||
return await LoggedAccessDataOf(username, true, () =>
|
||||
{
|
||||
DateTime date = DateTime.Now.AddHours(-hour);
|
||||
return Json((from entity in Db.GetTable<TEntity>()
|
||||
@@ -53,24 +56,42 @@ namespace SeniorAssistant.Controllers.Services
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Create([FromBody]TEntity item)
|
||||
public async Task<IActionResult> Create(TEntity item)
|
||||
{
|
||||
return Action(() =>
|
||||
return await LoggedAccessDataOf(item.Username, false, () =>
|
||||
{
|
||||
Db.Insert(item);
|
||||
|
||||
if (item is Heartbeat temp)
|
||||
{
|
||||
var result = (from p in Db.Patients
|
||||
where p.Username.Equals(item.Username)
|
||||
select p).ToArray().FirstOrDefault();
|
||||
if (result.MinHeart > temp.Value || result.MaxHeart < temp.Value)
|
||||
{
|
||||
var date = WebUtility.UrlEncode(item.Time.ToString("yyyy/MM/dd"));
|
||||
Db.Insert(new Notification() {
|
||||
Username = item.Username,
|
||||
Receiver = result.Doctor,
|
||||
Body = item.Username + ":" + AnomalDataHear,
|
||||
Url = "/user/" + item.Username + "?from=" + date + "&to=" + date,
|
||||
Time = DateTime.Now
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return Json(OkJson);
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
public async Task<IActionResult> Update([FromBody]TEntity item)
|
||||
public async Task<IActionResult> Update(TEntity item)
|
||||
{
|
||||
return LoggedAccessDataOf(item.Username, () =>
|
||||
return await LoggedAccessDataOf(item.Username, false, () =>
|
||||
{
|
||||
var e = Read(item.Username, item.Time);
|
||||
if (e == null)
|
||||
if (Read(item.Username, item.Time) == null)
|
||||
{
|
||||
Create(item);
|
||||
var a = Create(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -78,7 +99,7 @@ namespace SeniorAssistant.Controllers.Services
|
||||
}
|
||||
|
||||
return Json(OkJson);
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
using LinqToDB;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using LinqToDB;
|
||||
using LinqToDB.Data;
|
||||
using LinqToDB.DataProvider;
|
||||
using SeniorAssistant.Models;
|
||||
using SeniorAssistant.Models.Data;
|
||||
using SeniorAssistant.Models.Users;
|
||||
|
||||
namespace SeniorAssistant.Data
|
||||
@@ -20,5 +23,37 @@ namespace SeniorAssistant.Data
|
||||
public ITable<Patient> Patients => GetTable<Patient>();
|
||||
public ITable<Notification> Notifications => GetTable<Notification>();
|
||||
public ITable<Message> Messages => GetTable<Message>();
|
||||
|
||||
public T[] GetLastMessages<T>(ITable<T> table, string receiver, ref int numNotSeen, int max = 10)
|
||||
where T : IHasMessage
|
||||
{
|
||||
var notSeen = (from t in table
|
||||
where t.Receiver.Equals(receiver) && t.Seen == default
|
||||
orderby t.Time descending
|
||||
select t).Take(max).ToArray();
|
||||
var messages = new T[max];
|
||||
numNotSeen = notSeen.Length;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < numNotSeen; i++)
|
||||
{
|
||||
messages[i] = notSeen[i];
|
||||
}
|
||||
|
||||
if (numNotSeen < max)
|
||||
{
|
||||
var messSeen = (from t in table
|
||||
where t.Receiver.Equals(receiver) && t.Seen != default
|
||||
orderby t.Time descending
|
||||
select t).Take(max - numNotSeen).ToArray();
|
||||
|
||||
foreach (var m in messSeen)
|
||||
{
|
||||
messages[i] = m;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using LinqToDB.Mapping;
|
||||
using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
namespace SeniorAssistant.Models.Data
|
||||
{
|
||||
public class Heartbeat : IHasTime
|
||||
{
|
||||
@@ -14,10 +14,5 @@ namespace SeniorAssistant.Models
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public double Value { get; set; }
|
||||
|
||||
/*
|
||||
[Association(ThisKey = nameof(Username), OtherKey = nameof(User.Username), CanBeNull = false)]
|
||||
public User UserObj { get; set; }
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using LinqToDB.Mapping;
|
||||
using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
namespace SeniorAssistant.Models.Data
|
||||
{
|
||||
public class Sleep : IHasTime
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
using LinqToDB.Mapping;
|
||||
using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
namespace SeniorAssistant.Models.Data
|
||||
{
|
||||
public class Step : IHasTime
|
||||
{
|
||||
14
SeniorAssistant/Models/Interfaces/IHasMessage.cs
Normal file
14
SeniorAssistant/Models/Interfaces/IHasMessage.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using LinqToDB.Mapping;
|
||||
using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
{
|
||||
public interface IHasMessage : IHasTime
|
||||
{
|
||||
string Receiver { get; set; }
|
||||
|
||||
string Body { get; set; }
|
||||
|
||||
DateTime Seen { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
{
|
||||
public class Message : IHasTime
|
||||
public class Message : IHasMessage
|
||||
{
|
||||
[Column(IsPrimaryKey = true, CanBeNull = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
@@ -13,14 +13,12 @@ namespace SeniorAssistant.Models
|
||||
|
||||
[NotNull]
|
||||
public string Username { get; set; }
|
||||
|
||||
|
||||
[NotNull]
|
||||
public string Reciver { get; set; }
|
||||
public string Receiver { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public string Body { get; set; }
|
||||
|
||||
public bool Seen { get; set; }
|
||||
|
||||
public DateTime Seen { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace SeniorAssistant.Models
|
||||
{
|
||||
public class Notification : IHasTime
|
||||
public class Notification : IHasMessage
|
||||
{
|
||||
[Column(IsPrimaryKey = true, CanBeNull = false, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
@@ -13,9 +13,14 @@ namespace SeniorAssistant.Models
|
||||
|
||||
[NotNull]
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
public bool Seen { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public string Receiver { get; set; }
|
||||
|
||||
public string Body { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public DateTime Seen { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,11 +7,10 @@ namespace SeniorAssistant.Models.Users
|
||||
[Column(IsPrimaryKey = true, CanBeNull = false)]
|
||||
public string Username { get; set; }
|
||||
|
||||
[Association(ThisKey = "Username", OtherKey = nameof(User.Username), CanBeNull = false)]
|
||||
public User UserData { get; set; }
|
||||
|
||||
public string Location { get; set; }
|
||||
|
||||
public string Schedule { get; set; }
|
||||
|
||||
public string PhoneNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,13 @@ namespace SeniorAssistant.Models.Users
|
||||
[Column(IsPrimaryKey = true, CanBeNull = false)]
|
||||
public string Username { get; set; }
|
||||
|
||||
[Association(ThisKey = "Username", OtherKey = nameof(User.Username), CanBeNull = false)]
|
||||
public User UserData { get; set; }
|
||||
|
||||
[NotNull]
|
||||
public string Doctor { get; set; }
|
||||
|
||||
public string Notes { get; set; }
|
||||
|
||||
public int MaxHeart { get; set; }
|
||||
|
||||
public int MinHeart { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<DockerTargetOS>Windows</DockerTargetOS>
|
||||
<UserSecretsId>7506fc54-8ed1-4c9b-9004-35d36db99964</UserSecretsId>
|
||||
<LangVersion>7.1</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,10 +10,11 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using SeniorAssistant.Configuration;
|
||||
using SeniorAssistant.Data;
|
||||
using SeniorAssistant.Models;
|
||||
using SeniorAssistant.Models.Data;
|
||||
using SeniorAssistant.Models.Users;
|
||||
using SeniorAssistant.Extensions;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using SeniorAssistant.Models.Users;
|
||||
|
||||
namespace SeniorAssistant
|
||||
{
|
||||
@@ -71,21 +72,6 @@ namespace SeniorAssistant
|
||||
// .AddEntityFrameworkStores<ApplicationDbContext>();
|
||||
|
||||
services.TryAddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
services.AddSingleton<IList<IMenuItem>>(new List<IMenuItem>
|
||||
{
|
||||
new MenuItem("Index", "/"),
|
||||
new SubMenu()
|
||||
{
|
||||
Text = "Raw Data",
|
||||
Items = new MenuItem[]
|
||||
{
|
||||
new MenuItem("Users", "/users"),
|
||||
new MenuItem("Heartbeat", "/heartbeat"),
|
||||
new MenuItem("Sleep", "/sleep"),
|
||||
new MenuItem("Step", "/step")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var dbFactory = new SeniorDataContextFactory(
|
||||
dataProvider: SQLiteTools.GetDataProvider(),
|
||||
@@ -131,7 +117,7 @@ namespace SeniorAssistant
|
||||
|
||||
app.Run(async (context) =>
|
||||
{
|
||||
await context.Response.WriteAsync("Oops, something went wrong");
|
||||
await context.Response.WriteAsync("Oops, this page doesn't exist");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,154 +1,57 @@
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject IDataContextFactory<SeniorDataContext> dbFactory
|
||||
@model string
|
||||
|
||||
@model string
|
||||
@inject IHttpContextAccessor Http
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
var session = HttpContextAccessor.HttpContext.Session;
|
||||
var username = session.GetString("username");
|
||||
|
||||
bool auth = username.Equals(Model);
|
||||
bool isDoc = session.GetString("role").Equals("doctor");
|
||||
Patient patient = null;
|
||||
if (isDoc)
|
||||
{
|
||||
var db = dbFactory.Create();
|
||||
patient = (from p in db.Patients
|
||||
where p.Username.Equals(Model) && p.Doctor.Equals(username)
|
||||
select p).ToArray().FirstOrDefault();
|
||||
auth = auth || patient != null;
|
||||
}
|
||||
var session = Http.HttpContext.Session.GetString("username");
|
||||
}
|
||||
|
||||
@if (!auth)
|
||||
{
|
||||
<p class="box-title text-red">Non sei autorizzato a vedere i dati di @Model</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
// Aggiungere un qualcosa per scegliere le ore da vedere (Max 48?)
|
||||
<div>
|
||||
<input id="hours-data" type="text" placeholder="hours" value="24" />
|
||||
<button id="refresh-hours" class="fc-button">Cambia ora</button>
|
||||
<div id="chart-data"></div>
|
||||
</div>
|
||||
@if(isDoc && patient != null)
|
||||
{
|
||||
<div>
|
||||
<textarea id="note-area" placeholder="Scrivi una nota..">@patient.Notes</textarea>
|
||||
<button id="send-note" class="btn">Salva</button>
|
||||
<p id="note-error"></p>
|
||||
</div>
|
||||
<script>
|
||||
$("#send-note").on("click", function () {
|
||||
var text = $("#note-area").val().trim();
|
||||
$.ajax({
|
||||
url: "/Account/_addNote",
|
||||
type: "PUT",
|
||||
data: {
|
||||
Patient: "@Model", Text: text
|
||||
},
|
||||
success: function (data) {
|
||||
$("#note-error").html(data.success?"Nota salvata":data.message);
|
||||
<div id="grid"></div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var baseUrl = "@Url.Content("~/api/" + Model + "/" + session + "/today")";
|
||||
|
||||
$("#grid").kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: {
|
||||
url: baseUrl,
|
||||
type: "GET"
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$("#hours-data").on("change keyup paste click", function () {
|
||||
var t = $(this);
|
||||
t.val(t.val().replace(/[^0-9]/g, '').substring(0, 2));
|
||||
},
|
||||
serverPaging: false,
|
||||
serverSorting: false,
|
||||
batch: false,
|
||||
schema: {
|
||||
model: {
|
||||
id: "username",
|
||||
fields: {
|
||||
username: { type: "string" },
|
||||
time: { type: "date" },
|
||||
value: { type: "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollable: true,
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
editable: false,
|
||||
columns: [
|
||||
{
|
||||
field: "username",
|
||||
title: "Username"
|
||||
},
|
||||
{
|
||||
field: "time",
|
||||
title: "Date/Time",
|
||||
format: "{0:dd/MM/yyyy HH:mm}"
|
||||
},
|
||||
{
|
||||
field: "value",
|
||||
title: "@Model"
|
||||
}
|
||||
]
|
||||
});
|
||||
$("#refresh-hours").on("click", function () {
|
||||
var hours = $("#hours-data").val();
|
||||
var base_url = "@Url.Content("~/api/")";
|
||||
var end_url = "/@Model/last/" + hours;
|
||||
|
||||
$.getJSON(base_url + "heartbeat" + end_url, function (heartbeat) {
|
||||
$.getJSON(base_url + "step" + end_url, function (steps) {
|
||||
$.getJSON(base_url + "sleep" + end_url, function (sleep) {
|
||||
var sleepArr = [];
|
||||
sleep.forEach( function (el) {
|
||||
sleepArr.push({ "time": el.time, "value": 1 });
|
||||
var base_time = new Date(el.time).getTime();
|
||||
|
||||
for (var i = 60000; i <= el.value; i += 60000) {
|
||||
sleepArr.push({ "time": new Date(base_time + i), "value": 1 });
|
||||
}
|
||||
});
|
||||
|
||||
$("#chart-data").kendoChart({
|
||||
title: { text: "Visualizzazione attivita' di @Model" },
|
||||
legend: { position: "bottom" },
|
||||
seriesDefaults: {
|
||||
type: "line",
|
||||
style: "smooth"
|
||||
},
|
||||
series: [{
|
||||
name: "Battito",
|
||||
field: "value",
|
||||
color: "red",
|
||||
axis: "Heartbeat",
|
||||
categoryField: "time",
|
||||
data: heartbeat,
|
||||
tooltip: {
|
||||
visible: true,
|
||||
format: "{0}%",
|
||||
template: "Media di: #= value # bpm"
|
||||
}
|
||||
}, {
|
||||
name: "Passi",
|
||||
field: "value",
|
||||
color: "blue",
|
||||
axis: "Steps",
|
||||
categoryField: "time",
|
||||
data: steps,
|
||||
tooltip: {
|
||||
visible: true,
|
||||
format: "{0}%",
|
||||
template: "#= series.name #: #= value #"
|
||||
}
|
||||
}, {
|
||||
type: "area",
|
||||
name: "Sonno",
|
||||
field: "value",
|
||||
color: "black",
|
||||
axis: "Sleep",
|
||||
categoryField: "time",
|
||||
data: sleepArr
|
||||
}],
|
||||
categoryAxis: {
|
||||
labels: {
|
||||
rotation: +45,
|
||||
dateFormats: {
|
||||
hours: "HH:mm"
|
||||
}
|
||||
},
|
||||
type: "Date",
|
||||
baseUnit: "hours"
|
||||
},
|
||||
valueAxes: [{
|
||||
name: "Heartbeat",
|
||||
color: "red"
|
||||
}, {
|
||||
name: "Steps",
|
||||
color: "blue"
|
||||
}, {
|
||||
name: "Sleep",
|
||||
color: "gray",
|
||||
visible: false,
|
||||
max: 1,
|
||||
min: 0
|
||||
}]
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
$("#refresh-hours").click();
|
||||
</script>
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -1,42 +0,0 @@
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
}
|
||||
|
||||
<div id="grid"></div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var baseUrl = "@Url.Content("~/api/heartbeat/")";
|
||||
|
||||
$("#grid").kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: { url: baseUrl, type: "GET" }
|
||||
},
|
||||
serverPaging: false,
|
||||
serverSorting: false,
|
||||
batch: false,
|
||||
schema: {
|
||||
model: {
|
||||
id: "username",
|
||||
fields: {
|
||||
username: { type: "string" },
|
||||
time: { type: "date" },
|
||||
value: {type: "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollable: true,
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
editable: false,
|
||||
columns: [
|
||||
{ field: "username", title: "Username" },
|
||||
{ field: "time", title: "Date/Time", format: "{0:dd/MM/yyyy HH:mm}" },
|
||||
{ field: "value", title: "Heartbeats" }
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -1,4 +1,4 @@
|
||||
@model int
|
||||
@model string
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject IDataContextFactory<SeniorDataContext> dbFactory
|
||||
@using LinqToDB;
|
||||
@@ -7,24 +7,81 @@
|
||||
ViewBag.Title = "Hello Razor";
|
||||
string username = HttpContextAccessor.HttpContext.Session.GetString("username");
|
||||
var db = dbFactory.Create();
|
||||
var message = (from m in db.Messages
|
||||
where m.Id.Equals(Model) && m.Reciver.Equals(username)
|
||||
select m).ToArray().FirstOrDefault();
|
||||
var user = (from u in db.Users
|
||||
where u.Username.Equals(Model)
|
||||
select u).FirstOrDefault();
|
||||
var messages = (from m in db.Messages
|
||||
where (m.Username.Equals(Model) && m.Receiver.Equals(username))
|
||||
||(m.Receiver.Equals(Model) && m.Username.Equals(username))
|
||||
orderby m.Time ascending
|
||||
select m).ToArray();
|
||||
}
|
||||
|
||||
<div class="content">
|
||||
@if (message == null)
|
||||
@if (messages.Count() == 0)
|
||||
{
|
||||
<p class="text-red">Non hai il permesso</p>
|
||||
<p class="text-red">Non hai messaggi</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
message.Seen = true;
|
||||
db.Update(message);
|
||||
<p>Messaggio da @message.Username</p>
|
||||
<p>Inviato il @message.Time</p>
|
||||
<div class="info-box-text">
|
||||
@message.Body
|
||||
</div>
|
||||
<h3 class="text-bold">Messaggi con @user.Name @user.LastName</h3>
|
||||
|
||||
foreach (var message in messages)
|
||||
{
|
||||
if (message.Seen == default && message.Receiver.Equals(username))
|
||||
{
|
||||
message.Seen = DateTime.Now;
|
||||
db.Update(message);
|
||||
}
|
||||
<div>
|
||||
@if (message.Receiver.Equals(username))
|
||||
{
|
||||
<div class="pull-left"></div>
|
||||
<div class="pull-right-container bg-light-blue">
|
||||
<span style="white-space: pre-line" class="">@message.Body</span>
|
||||
<p class="text-aqua">@message.Seen</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="pull-right-container bg-green-gradient">
|
||||
<div style="white-space: pre-line" class="">@message.Body</div>
|
||||
<p class="text-aqua">@message.Seen</p>
|
||||
</div>
|
||||
<div class="pull-right"></div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<div class="pull-right">
|
||||
<textarea id="res-message" class="progress-text" placeholder="Scrivi qui per scrivere un messaggio"></textarea>
|
||||
<button id="btn-send-message">Invia</button>
|
||||
<p id="message-error" class="text-red"></p>
|
||||
</div>
|
||||
<script>
|
||||
$("#btn-send-message").on("click", function () {
|
||||
var min = 10;
|
||||
var body = $("#res-message").val().trim();
|
||||
var endMessage = $("#message-error");
|
||||
if (body.length < min) {
|
||||
endMessage.html("Messaggio non valido (minimo " + min + " caratteri)");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/Account/_sendMessage",
|
||||
type: "POST",
|
||||
data: {
|
||||
Receiver: "@Model",
|
||||
Body: body
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$("#res-message").val("");
|
||||
endMessage.html("Messaggio inviato");
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
}
|
||||
|
||||
<div id="grid"></div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var baseUrl = "@Url.Content("~/api/sleep/")";
|
||||
|
||||
$("#grid").kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: { url: baseUrl, type: "GET" }
|
||||
},
|
||||
serverPaging: false,
|
||||
serverSorting: false,
|
||||
batch: false,
|
||||
schema: {
|
||||
model: {
|
||||
id: "username",
|
||||
fields: {
|
||||
username: { type: "string", },
|
||||
time: { type: "date" },
|
||||
value: { type: "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollable: true,
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
editable: false,
|
||||
columns: [
|
||||
{ field: "username", title: "Username" },
|
||||
{ field: "time", title: "Date/Time", format: "{0:dd/MM/yyyy HH:mm}" },
|
||||
{ field: "value", title: "Sleep Time", format: "{n2}", template: '${value/3600000}' }
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
@@ -1,42 +0,0 @@
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
}
|
||||
|
||||
<div id="grid"></div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
var baseUrl = "@Url.Content("~/api/step/")";
|
||||
|
||||
$("#grid").kendoGrid({
|
||||
dataSource: {
|
||||
transport: {
|
||||
read: { url: baseUrl, type: "GET" }
|
||||
},
|
||||
serverPaging: false,
|
||||
serverSorting: false,
|
||||
batch: false,
|
||||
schema: {
|
||||
model: {
|
||||
id: "username",
|
||||
fields: {
|
||||
username: { type: "string", },
|
||||
time: { type: "date" },
|
||||
value: { type: "number" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollable: true,
|
||||
sortable: true,
|
||||
filterable: true,
|
||||
editable: false,
|
||||
columns: [
|
||||
{ field: "username", title: "Username" },
|
||||
{ field: "time", title: "Date/Time", format: "{0:dd/MM/yyyy HH:mm}" },
|
||||
{ field: "value", title: "Steps done" }
|
||||
]
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
184
SeniorAssistant/Views/Home/User.cshtml
Normal file
184
SeniorAssistant/Views/Home/User.cshtml
Normal file
@@ -0,0 +1,184 @@
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject IDataContextFactory<SeniorDataContext> dbFactory
|
||||
@model User
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Hello Razor";
|
||||
var session = HttpContextAccessor.HttpContext.Session;
|
||||
var username = session.GetString("username");
|
||||
|
||||
bool auth = username.Equals(Model.Username);
|
||||
bool isDoc = session.GetString("role").Equals("doctor");
|
||||
Patient patient = null;
|
||||
if (isDoc)
|
||||
{
|
||||
var db = dbFactory.Create();
|
||||
patient = (from p in db.Patients
|
||||
where p.Username.Equals(Model.Username) && p.Doctor.Equals(username)
|
||||
select p).ToArray().FirstOrDefault();
|
||||
auth = auth || patient != null;
|
||||
}
|
||||
}
|
||||
|
||||
@if (!auth)
|
||||
{
|
||||
<p class="box-title text-red">Non sei autorizzato a vedere i dati di @Model.Name @Model.LastName</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
<input id="hours-data" type="text" placeholder="hours" value="24" />
|
||||
<button id="refresh-hours" class="fc-button">Cambia ora</button>
|
||||
<div id="chart-data"></div>
|
||||
</div>
|
||||
@if (isDoc && patient != null)
|
||||
{
|
||||
<div>
|
||||
<textarea id="note-area" placeholder="Scrivi una nota..">@patient.Notes</textarea>
|
||||
<button id="send-note" class="btn">Salva</button>
|
||||
<p id="note-error"></p>
|
||||
</div>
|
||||
<a class="" href="/Message/@patient.Username">Invia un messaggio al tuo paziente</a>
|
||||
<div>
|
||||
<p>Inserisci un minimo o massimo valore per il battito cardiaco</p>
|
||||
<p>Se il valore del battito del paziente supera i valori che hai inserito verrai notificato</p>
|
||||
<label>Max:</label>
|
||||
<input id="maxHeart" placeholder="max" value="@patient.MaxHeart" />
|
||||
<label>Min:</label>
|
||||
<input id="minHeart" placeholder="min" value="@patient.MinHeart" />
|
||||
</div>
|
||||
<script>
|
||||
$("#send-note").on("click", function () {
|
||||
var text = $("#note-area").val().trim();
|
||||
$.ajax({
|
||||
url: "/Account/_addNote",
|
||||
type: "PUT",
|
||||
data: {
|
||||
Patient: "@Model.Username", Text: text
|
||||
},
|
||||
success: function (data) {
|
||||
$("#note-error").html(data.success ? "Nota salvata" : data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#maxHeart, #minHeart").on("change keyup paste click", function () {
|
||||
onlyNum($(this));
|
||||
});
|
||||
$("#maxHeart, #minHeart").on("blur", function () {
|
||||
var value = parseInt($(this).val());
|
||||
var id = $(this).attr("id");
|
||||
$.ajax({
|
||||
url: "/Account/_" + id + "ToPatient",
|
||||
type: "PUT",
|
||||
data: {
|
||||
Patient: "@Model.Username",
|
||||
Value: value
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
}
|
||||
|
||||
<script>
|
||||
function onlyNum(object, numChar = 3) {
|
||||
object.val(object.val().replace(/[^0-9]/g, '').substring(0, numChar));
|
||||
}
|
||||
|
||||
$("#hours-data").on("change keyup paste click", function () {
|
||||
onlyNum($(this), 2);
|
||||
});
|
||||
$("#refresh-hours").on("click", function () {
|
||||
var hours = $("#hours-data").val();
|
||||
var base_url = "@Url.Content("~/api/")";
|
||||
var end_url = "/@Model.Username/last/" + hours;
|
||||
|
||||
$.getJSON(base_url + "heartbeat" + end_url, function (heartbeat) {
|
||||
$.getJSON(base_url + "step" + end_url, function (steps) {
|
||||
$.getJSON(base_url + "sleep" + end_url, function (sleep) {
|
||||
var sleepArr = [];
|
||||
|
||||
sleep.forEach(function (el) {
|
||||
sleepArr.push({ "time": el.time, "value": 1 });
|
||||
var base_time = new Date(el.time).getTime();
|
||||
|
||||
for (var i = 60000; i <= el.value; i += 60000) {
|
||||
sleepArr.push({ "time": new Date(base_time + i), "value": 1 });
|
||||
}
|
||||
});
|
||||
|
||||
if (Object.keys(heartbeat).length == 0
|
||||
&& Object.keys(steps).length == 0
|
||||
&& Object.keys(sleep).length == 0)
|
||||
$("#chart-data").html("Nessun dato");
|
||||
else
|
||||
$("#chart-data").kendoChart({
|
||||
title: { text: "Visualizzazione attivita' di @Model.Name @Model.LastName" },
|
||||
legend: { position: "bottom" },
|
||||
seriesDefaults: {
|
||||
type: "line",
|
||||
style: "smooth"
|
||||
},
|
||||
series: [{
|
||||
name: "Battito",
|
||||
field: "value",
|
||||
color: "red",
|
||||
axis: "Heartbeat",
|
||||
categoryField: "time",
|
||||
data: heartbeat,
|
||||
tooltip: {
|
||||
visible: true,
|
||||
format: "{0}%",
|
||||
template: "Media di: #= value # bpm"
|
||||
}
|
||||
}, {
|
||||
name: "Passi",
|
||||
field: "value",
|
||||
color: "blue",
|
||||
axis: "Steps",
|
||||
categoryField: "time",
|
||||
data: steps,
|
||||
tooltip: {
|
||||
visible: true,
|
||||
format: "{0}%",
|
||||
template: "#= series.name #: #= value #"
|
||||
}
|
||||
}, {
|
||||
type: "area",
|
||||
name: "Sonno",
|
||||
field: "value",
|
||||
color: "black",
|
||||
axis: "Sleep",
|
||||
categoryField: "time",
|
||||
data: sleepArr
|
||||
}],
|
||||
categoryAxis: {
|
||||
labels: {
|
||||
rotation: +45,
|
||||
dateFormats: {
|
||||
hours: "HH:mm"
|
||||
}
|
||||
},
|
||||
type: "Date",
|
||||
baseUnit: "hours"
|
||||
},
|
||||
valueAxes: [{
|
||||
name: "Heartbeat",
|
||||
color: "red"
|
||||
}, {
|
||||
name: "Steps",
|
||||
color: "blue"
|
||||
}, {
|
||||
name: "Sleep",
|
||||
color: "gray",
|
||||
visible: false,
|
||||
max: 1,
|
||||
min: 0
|
||||
}]
|
||||
}); /* Kendo */
|
||||
}); /* sleep */
|
||||
}); /* steps */
|
||||
}); /* heart */
|
||||
}); /* click */
|
||||
$("#refresh-hours").click();
|
||||
</script>
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
<!-- hidden-xs hides the username on small devices so only the image appears. -->
|
||||
<span id="user-name" class="hidden-xs">@Model</span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown-menu" style="box-shadow: black 0px 0px 2px">
|
||||
<!-- The user image in the menu -->
|
||||
<li class="user-header">
|
||||
<img src="@session.GetString("avatar")" class="img-circle" alt="User Image" id="avatar">
|
||||
|
||||
@@ -4,51 +4,10 @@
|
||||
@{
|
||||
var db = dbFactory.Create();
|
||||
var maxMessage = 10;
|
||||
var notSeen = (from n in db.Messages
|
||||
where n.Reciver.Equals(Model) && n.Seen == false
|
||||
orderby n.Time descending
|
||||
select n).Take(maxMessage).ToArray();
|
||||
|
||||
var messages = new Message[maxMessage];
|
||||
var num = notSeen.Length;
|
||||
|
||||
int i;
|
||||
for (i=0; i<num; i++)
|
||||
{
|
||||
messages[i] = notSeen[i];
|
||||
}
|
||||
|
||||
if (num < maxMessage)
|
||||
{
|
||||
var messSeen = (from n in db.Messages
|
||||
where n.Reciver.Equals(Model) && n.Seen == true
|
||||
orderby n.Time descending
|
||||
select n).Take(maxMessage-num).ToArray();
|
||||
|
||||
foreach(var m in messSeen)
|
||||
{
|
||||
messages[i] = m;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
var num = 0;
|
||||
var messages = db.GetLastMessages(db.Messages, Model, ref num, maxMessage);
|
||||
}
|
||||
|
||||
<!--
|
||||
<script>
|
||||
$(document).ready(
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "/Account/_message",
|
||||
data: { Username: "@Model", Message: "stronzo" },
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
})
|
||||
);
|
||||
</script>
|
||||
-->
|
||||
|
||||
<a id="id-message-toggle" href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-envelope-o"></i>
|
||||
@if (num != 0)
|
||||
@@ -64,8 +23,8 @@
|
||||
</a>
|
||||
@if (messages.Length != 0)
|
||||
{
|
||||
<ul id="id-message-drop" class="dropdown-menu">
|
||||
<li class="header">You have @num unread message</li>
|
||||
<ul id="id-message-drop" class="dropdown-menu" style="box-shadow: black 0px 0px 2px">
|
||||
<li class="header">Hai @num messaggi non letti</li>
|
||||
<li>
|
||||
<!-- Inner Menu: contains the messages -->
|
||||
<ul class="menu">
|
||||
@@ -75,7 +34,7 @@
|
||||
{
|
||||
<li>
|
||||
<!-- start notification -->
|
||||
<a id="message-@message.Id" @if(message.Seen) {<text>class= "bg-gray"</text>} href="/Message/@message.Id">
|
||||
<a id="message-@message.Id" @if(message.Seen != default) {<text>class= "bg-gray"</text>} href="/Message/@message.Username">
|
||||
<i class="fa text-lime">@message.Time</i><br />
|
||||
@message.Body
|
||||
</a>
|
||||
|
||||
@@ -3,29 +3,10 @@
|
||||
|
||||
@{
|
||||
var db = dbFactory.Create();
|
||||
var notifications = (from n in db.Notifications
|
||||
where n.Username.Equals(Model) && n.Seen == false
|
||||
orderby n.Time
|
||||
select n).ToArray();
|
||||
var num = notifications.Length;
|
||||
var num = 0;
|
||||
var notifications = db.GetLastMessages(db.Notifications, Model, ref num);
|
||||
}
|
||||
|
||||
<!--
|
||||
<script>
|
||||
$(document).ready(
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
url: "/Account/_notification",
|
||||
data: { Username: "@Model", Message: "stronzo" },
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
})
|
||||
);
|
||||
</script>
|
||||
-->
|
||||
|
||||
<a id="id-notification-toggle" href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<i class="fa fa-bell-o"></i>
|
||||
@if (num != 0)
|
||||
@@ -33,50 +14,48 @@
|
||||
<span class="label label-warning">@num</span>
|
||||
}
|
||||
</a>
|
||||
@if (num != 0)
|
||||
{
|
||||
<ul id="id-notification-drop" class="dropdown-menu">
|
||||
<li class="header">You have @num notifications</li>
|
||||
<li>
|
||||
<!-- Inner Menu: contains the notifications -->
|
||||
<ul class="menu">
|
||||
@foreach (var notification in notifications)
|
||||
<ul id="id-notification-drop" class="dropdown-menu" style="box-shadow: black 0px 0px 2px">
|
||||
<li class="header">Hai @num nuove notifiche</li>
|
||||
<li>
|
||||
<!-- Inner Menu: contains the notifications -->
|
||||
<ul class="menu">
|
||||
@foreach (var notification in notifications)
|
||||
{
|
||||
if (notification != null)
|
||||
{
|
||||
<li>
|
||||
<!-- start notification -->
|
||||
<a id="notification-@notification.Id" href="#">
|
||||
<a id="notification-@notification.Id" class="@if (notification.Seen != default) {<text>bg-gray</text>}" href="@notification.Url">
|
||||
<i class="fa fa-users text-aqua">@notification.Time</i><br />
|
||||
@notification.Message
|
||||
@notification.Body
|
||||
</a>
|
||||
</li>
|
||||
<!-- end notification -->
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
<!-- <li class="footer"><a href="#">View all</a></li> -->
|
||||
</ul>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
<!-- <li class="footer"><a href="#">View all</a></li> -->
|
||||
</ul>
|
||||
|
||||
<script>
|
||||
var user = "@Model";
|
||||
$("[id^='notification-']").on("click", function () {
|
||||
var id = this.id.replace(/notification-/g, '');
|
||||
var allId = this.id;
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
url: "/Account/_notification",
|
||||
data: { id: id },
|
||||
success: function () {
|
||||
$("#" + allId).remove();
|
||||
var num = parseInt($("#id-notification-toggle span").html()) - 1;
|
||||
if (num == 0) {
|
||||
$("#id-notification-toggle span").remove();
|
||||
$("#id-notification-drop").remove();
|
||||
}
|
||||
else
|
||||
$("#id-notification-toggle span").html(num);
|
||||
}
|
||||
});
|
||||
<script>
|
||||
var user = "@Model";
|
||||
$("[id^='notification-']").on("click", function () {
|
||||
var id = this.id.replace(/notification-/g, '');
|
||||
var allId = this.id;
|
||||
$.ajax({
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
url: "/Account/_notification",
|
||||
data: { id: id },
|
||||
success: function () {
|
||||
$("#" + allId).addClass("bg-gray");
|
||||
var num = parseInt($("#id-notification-toggle span").html()) - 1;
|
||||
if (num == 0)
|
||||
$("#id-notification-toggle span").remove();
|
||||
else
|
||||
$("#id-notification-toggle span").html(num);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -30,37 +30,8 @@
|
||||
<p class="text-bold">Dottore: @doctor.Name @doctor.LastName</p>
|
||||
<p class="text-fuchsia">Dove mi puoi trovare? @doctor.Location</p>
|
||||
<textarea class="progress-text" placeholder="Nessuna nuova nota" readonly>@patientData.Notes</textarea>
|
||||
|
||||
<div id="send-doc-message">
|
||||
<p>Invia un messaggio al tuo dottore</p>
|
||||
<textarea id="doc-message" class="progress-text" placeholder="scrivi qui"></textarea>
|
||||
<button id="btn-send-message">Invia</button>
|
||||
<p id="message-error" class="text-red"></p>
|
||||
|
||||
<script>
|
||||
$("#btn-send-message").on("click", function () {
|
||||
var body = $("#doc-message").val().trim();
|
||||
var endMessage = $("#message-error");
|
||||
if (body.length < 20) {
|
||||
endMessage.html("Messaggio non valido (minimo 20 caratteri)");
|
||||
return false;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "Account/_sendMessage",
|
||||
type: "POST",
|
||||
data: {
|
||||
Reciver: "@doctor.Username",
|
||||
Body: body
|
||||
},
|
||||
success: function () {
|
||||
$("#doc-message").val("");
|
||||
endMessage.html("Messaggio inviato");
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<a class="" href="/Message/@doctor.Username">Invia un messaggio al tuo dottore</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
@inject IList<IMenuItem> Menu
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject IDataContextFactory<SeniorDataContext> dbFactory
|
||||
|
||||
@{
|
||||
var session = HttpContextAccessor.HttpContext.Session;
|
||||
string search = HttpContextAccessor.HttpContext.Request.Query["q"];
|
||||
string username = session.GetString("username");
|
||||
|
||||
if (username != null)
|
||||
{
|
||||
Menu = new List<IMenuItem>(Menu);
|
||||
Menu.RemoveAt(1);
|
||||
Menu.Insert(1, new MenuItem("Dati personali", "/user/" + username));
|
||||
if (session.GetString("role").Equals("doctor"))
|
||||
var isDoc = session.GetString("role").Equals("doctor");
|
||||
var Menu = new List<IMenuItem>();
|
||||
Menu.Add(new MenuItem("Profilo", "/"));
|
||||
Menu.Add(new MenuItem("Dati personali", "/user/" + username));
|
||||
if (isDoc)
|
||||
{
|
||||
var db = dbFactory.Create();
|
||||
var patients = (from p in db.Patients
|
||||
@@ -25,36 +26,87 @@
|
||||
}
|
||||
Menu.Add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
@foreach (var menuItem in Menu)
|
||||
{
|
||||
switch (menuItem)
|
||||
else
|
||||
{
|
||||
case MenuItem single:
|
||||
<li>
|
||||
<a href="@single.HRef">@single.Text</a>
|
||||
</li>
|
||||
break;
|
||||
case SubMenu multi:
|
||||
<li class="treeview">
|
||||
<a href="#">
|
||||
<i class="fa fa-link"></i><span>@multi.Text</span>
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu">
|
||||
@foreach (MenuItem item in multi.Items)
|
||||
var db = dbFactory.Create();
|
||||
var patient = (from p in db.Patients
|
||||
where p.Username.Equals(username)
|
||||
select p).FirstOrDefault();
|
||||
Menu.Add(new MenuItem("Invia un messaggio al dottore", "/Message/" + patient.Doctor));
|
||||
}
|
||||
<aside class="main-sidebar">
|
||||
<!-- sidebar: style can be found in sidebar.less -->
|
||||
<section class="sidebar">
|
||||
@if (isDoc)
|
||||
{
|
||||
<!-- Sidebar user panel (optional) -->
|
||||
<!-- search form (Optional) -->
|
||||
<form action="#" method="get" class="sidebar-form">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search..." , value="@search">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /.search form -->
|
||||
<!-- Sidebar Menu -->
|
||||
}
|
||||
<div>
|
||||
<ul class="sidebar-menu" data-widget="tree">
|
||||
@foreach (var menuItem in Menu)
|
||||
{
|
||||
<li>
|
||||
<a href="@item.HRef">@item.Text</a>
|
||||
</li>
|
||||
switch (menuItem)
|
||||
{
|
||||
case MenuItem single:
|
||||
<li>
|
||||
<a href="@single.HRef">@single.Text</a>
|
||||
</li>
|
||||
break;
|
||||
case SubMenu multi:
|
||||
<li class="treeview @if(search != null) {<text>menu-open</text>}">
|
||||
<a href="#">
|
||||
<i class="fa fa-link"></i><span>@multi.Text</span>
|
||||
<span class="pull-right-container">
|
||||
<i class="fa fa-angle-left pull-right"></i>
|
||||
</span>
|
||||
</a>
|
||||
<ul class="treeview-menu" @if (search != null) { <text> style="display: block;" </text> }>
|
||||
@foreach (MenuItem item in multi.Items)
|
||||
{
|
||||
<li>
|
||||
@{
|
||||
var text = item.Text;
|
||||
var bg = "";
|
||||
if (search != null && item.Text.StartsWith(search))
|
||||
{
|
||||
bg = "bg-aqua";
|
||||
text = item.Text.Replace(search, "<em>" + search + "</em>");
|
||||
}
|
||||
}
|
||||
<a href="@item.HRef" class="@bg">
|
||||
@Html.Raw(text)
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
break;
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
</li>
|
||||
break;
|
||||
</div>
|
||||
<!-- /.sidebar-menu -->
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
@if (search != null)
|
||||
{
|
||||
<script>
|
||||
$("body").removeClass("sidebar-collapse");
|
||||
</script>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
@@ -2,10 +2,12 @@
|
||||
@using Microsoft.Extensions.Options
|
||||
@inject IOptions<SeniorAssistant.Configuration.Kendo> Kendo
|
||||
@inject IOptions<SeniorAssistant.Configuration.Theme> Theme
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
|
||||
@{
|
||||
var kendo = Kendo.Value;
|
||||
var theme = Theme.Value;
|
||||
var logged = HttpContextAccessor.HttpContext.Session.GetString("username") != null;
|
||||
}
|
||||
|
||||
<!DOCTYPE html>
|
||||
@@ -46,27 +48,8 @@ scratch. This page gets rid of all links and provides the needed markup only.
|
||||
<script src="~/kendo/@(kendo.Version)/js/jquery.min.js"></script>
|
||||
<script src="~/kendo/@(kendo.Version)/js/kendo.all.min.js"></script>
|
||||
</head>
|
||||
<!--
|
||||
BODY TAG OPTIONS:
|
||||
=================
|
||||
Apply one or more of the following classes to get the
|
||||
desired effect
|
||||
|---------------------------------------------------------|
|
||||
| SKINS | skin-blue |
|
||||
| | skin-black |
|
||||
| | skin-purple |
|
||||
| | skin-yellow |
|
||||
| | skin-red |
|
||||
| | skin-green |
|
||||
|---------------------------------------------------------|
|
||||
|LAYOUT OPTIONS | fixed |
|
||||
| | layout-boxed |
|
||||
| | layout-top-nav |
|
||||
| | sidebar-collapse |
|
||||
| | sidebar-mini |
|
||||
|---------------------------------------------------------|
|
||||
-->
|
||||
<body class="hold-transition @(theme.Skin.GetDescription()) @(theme.Layout.GetDescription())">
|
||||
|
||||
<body class="hold-transition @(theme.Skin.GetDescription()) @(!logged?theme.Layout.GetDescription():"")">
|
||||
<div class="wrapper">
|
||||
<!-- Main Header -->
|
||||
<header class="main-header">
|
||||
@@ -80,9 +63,14 @@ desired effect
|
||||
<!-- Header Navbar -->
|
||||
<nav class="navbar navbar-static-top" role="navigation">
|
||||
<!-- Sidebar toggle button-->
|
||||
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
@if (logged)
|
||||
{
|
||||
<text>
|
||||
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
</a>
|
||||
</text>
|
||||
}
|
||||
<!-- Navbar Right Menu -->
|
||||
<div>
|
||||
@{ await Html.RenderPartialAsync("NavbarRightMenu"); }
|
||||
@@ -90,30 +78,7 @@ desired effect
|
||||
</nav>
|
||||
</header>
|
||||
<!-- Left side column. contains the logo and sidebar -->
|
||||
<aside class="main-sidebar">
|
||||
<!-- sidebar: style can be found in sidebar.less -->
|
||||
<section class="sidebar">
|
||||
<!-- Sidebar user panel (optional) -->
|
||||
<!-- search form (Optional) -->
|
||||
<form action="#" method="get" class="sidebar-form">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Search...">
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<!-- /.search form -->
|
||||
<!-- Sidebar Menu -->
|
||||
<div>
|
||||
@{ await Html.RenderPartialAsync("SidebarMenu"); }
|
||||
</div>
|
||||
<!-- /.sidebar-menu -->
|
||||
</section>
|
||||
<!-- /.sidebar -->
|
||||
</aside>
|
||||
@{ await Html.RenderPartialAsync("SidebarMenu"); }
|
||||
<!-- Content Wrapper. Contains page content -->
|
||||
<div class="content-wrapper">
|
||||
<!-- Content Header (Page header) -->
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@using SeniorAssistant.Models;
|
||||
@using SeniorAssistant.Models.Users;
|
||||
@using SeniorAssistant.Models.Data;
|
||||
@using SeniorAssistant.Data;
|
||||
@using Microsoft.AspNetCore.Mvc;
|
||||
@using Microsoft.AspNetCore.Http;
|
||||
@using Microsoft.AspNetCore.Http;
|
||||
@using System.Linq;
|
||||
@@ -5,7 +5,7 @@
|
||||
},
|
||||
"theme": {
|
||||
"skin": "Purple",
|
||||
"layout": "SidebarMini"
|
||||
"layout": "SidebarCollapse"
|
||||
},
|
||||
"connectionStrings": {
|
||||
"SeniorDb": "Data Source=senior.db;"
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user